No description
  • TypeScript 79.7%
  • Luau 15.7%
  • JavaScript 4.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jonas Koenig 8acb38c49d
All checks were successful
release / release (push) Successful in 6s
feat: add staged limitation workflow and evidence gates (v2.4.0)
- Add /secgaps and /secimprove with research, plan, implement, and verify artifacts plus turn guards.
- Await print-mode skill turns so headless /secscan completes and seals its scan.
- Add security_record_repair and a five-field evidence gate for fixed findings.
- Add Semgrep JS/TS taint rules and a dotenv credential rule with fixture coverage.
- Add application-scoped Python/Node dependency inventory.
- Document the limitation loop, sources, status, and remaining gaps; bump manifests to 2.4.0.
2026-11-27 04:42:55 +00:00
.forgejo/workflows fix: add root plugin.toml for git install (v2.1.2) 2026-11-27 02:45:12 +00:00
.omp-plugin feat: add staged limitation workflow and evidence gates (v2.4.0) 2026-11-27 04:42:55 +00:00
docs feat: add staged limitation workflow and evidence gates (v2.4.0) 2026-11-27 04:42:55 +00:00
plugins/codex-security-omp feat: add staged limitation workflow and evidence gates (v2.4.0) 2026-11-27 04:42:55 +00:00
AGENTS.md feat: add staged limitation workflow and evidence gates (v2.4.0) 2026-11-27 04:42:55 +00:00
CREDITS.md feat: add selectable workflows, validation ledger, and scan history (v2.3.0) 2026-11-27 04:18:44 +00:00
plugin.toml feat: add staged limitation workflow and evidence gates (v2.4.0) 2026-11-27 04:42:55 +00:00
README.md feat: add staged limitation workflow and evidence gates (v2.4.0) 2026-11-27 04:42:55 +00:00

codex-security-omp

Local, container-isolated security testing for Oh My Pi (omp), with selectable workflows and a live dashboard in Tern.

One plugin. Four workflow profiles. Bundled methodology. No hosted security service and no MCP server.

What it does

  • Runs a security audit on the OMP session model.
  • Runs static tools in a user-provided Podman/Docker engine with no network and a read-only source mount.
  • Streams job and container activity to a native Tern block, with a terminal fallback for remote windows.
  • Writes .omp/security/findings.json and report.md; the turn cannot end without them.
  • Fixes one finding, proves the fix, and updates its status.
  • Exports SARIF for OMP's native /security import.
flowchart LR
  C["/secscan"] --> J["Job: .omp/security/live.json"]
  J --> K[OMP skill + bundled references]
  K --> T[Container tool: Semgrep]
  T --> S[SARIF + logs]
  S --> K
  K --> A[findings.json + report.md]
  J --> D[Tern live dashboard]
  A --> D

Why one plugin

The old marketplace installed this plugin plus upstream openai/codex-security. That package registers an MCP server whose managed-scan tools require the owning Codex thread, and the git source ships no built server. The workaround patched the MCP cache on every session start.

This version removes the workaround and the second install:

  • methodology is bundled here, independently written and inspired by Codex Security;
  • no MCP server is registered;
  • nothing writes to ~/.omp/plugins/cache, .mcp.json, or ~/.omp/agent/mcp.json;
  • tools run locally in containers, not in a hosted workbench.

If the upstream plugin is still installed:

/marketplace uninstall codex-security@codex-security-omp

Then restart the session or run /reload-plugins.

Install

OMP plugin:

/marketplace add ssh://git@git.tni.dev/tni/codex-security-omp.git
/marketplace install codex-security-omp@codex-security-omp

CLI equivalent:

omp plugin marketplace add ssh://git@git.tni.dev/tni/codex-security-omp.git
omp plugin install codex-security-omp@codex-security-omp

The Tern host package is bundled and linked by /secdash. The window package is installed separately on the machine showing the Tern window; see Install the window package.

Container tools need an engine and image:

podman pull docker.io/semgrep/semgrep:latest
# or: docker pull docker.io/semgrep/semgrep:latest

Commands

All commands run from the OMP prompt; no /skill: prefix is needed.

Command Action
/secscan Start an isolated local scan
/secscan src/ api/ Scan only the named paths
/secscan review origin/main..HEAD Review a diff
/secscan working-tree Review the uncommitted checkout
/secscan --local Run without a container engine
/secscan --quick Focused change review: one pass, targeted validation
/secscan --deep --passes 3 Research, plan, repeated passes, independent validation
/secscan --deps Dependency and lockfile review
/secdeps Write an application-scoped dependency inventory
/secscan --threat Threat model; no container required
/secworkflows List profiles and their guidelines
/secgaps List known plugin limitations and improvement progress
/secimprove <id> [stage] Research, plan, implement, or verify one limitation
/secfix F1 Patch one finding, prove it, update its status
/secstatus Active job plus artifact summary
/secdash Open the live native dashboard or terminal fallback
/seccancel Cancel the active job and its containers
/secdoctor Check engine, image, rules, and limits
/sechistory List sealed scans
/seccompare A B Compare two sealed scans
/sectriage F1 fixed "reason" Set a finding disposition
/secvalidate F1 validated "evidence" Record a validation verdict
/secexport Write .omp/security/results.sarif for /security import

/skill:security-scan-omp still works, but the short commands are the supported surface.

A scan is incomplete until both artifacts exist. If a scan was requested and the turn tries to end without them, the extension holds the turn open, up to two blocks.

Improving the plugin

The limitation workflow is separate from scanning. /secgaps lists the known gaps; /secimprove <id> research|plan|implement|verify|all runs one stage at a time. Each stage writes .omp/security/improvements/<id>/ and the extension blocks a turn without the requested artifact. This keeps research, planning, code changes, and verification separate instead of one optimistic chat turn.

security_record_repair gates /secfix: a finding cannot become fixed without structural, semantic, executable, negative-control, and consistency evidence. Details and sources: docs/improvements.md.

Workflow profiles

The same result contract, different process. Pick by task.

Profile Use when Process
quick A diff, small path set, or fast gate Scope → static → one targeted pass → validation → report
deep Repository or security-sensitive subsystem Research → plan → static → repeated passes with task workers → independent validation → report → coverage audit
deps Dependencies, lockfiles, supply chain Inventory → lockfiles → optional offline SCA → reachability validation → report
threat Trust boundaries and design Assets → boundaries → entry points → threats → report

Default: deep. /secworkflows lists them; /secscan --profile <id> is the long form.

Guidelines and decision guidance: docs/workflows.md. The deep and dependency profiles include the 13-point coverage audit from the structural false-negative paper. Independent validation means a different worker or fresh pass checks the discovery worker's candidates; the verdict goes through security_record_validation.

How a scan runs

  1. /secscan selects the profile, checks the container engine and image, creates .omp/security/live.json, archives the previous findings/report under the new job directory, and writes an empty findings placeholder.
  2. The skill inventories scope and runs the static baseline through security_container_run.
  3. security_import_sarif normalizes and deduplicates the SARIF results into findings.json.
  4. OMP traces candidates, validates each one, and records phases through security_job_step.
  5. The skill writes findings.json and report.md.
  6. security_job_finish validates both artifacts, seals the scan into history, and marks the job complete.
  7. Tern polls the job and findings while this happens.

Only one scan can run in a workspace at a time. Use /seccancel before starting another.

Local isolated scans

OMP does the reasoning. A user-provided container engine runs untrusted tools.

/secdoctor
podman pull docker.io/semgrep/semgrep:latest
/secscan

/secscan requires Podman or Docker and the configured image. /secscan --local is the explicit unisolated fallback.

Every container step gets:

  • source read-only at /src, output at /out, rules read-only at /rules;
  • --network none;
  • read-only root filesystem and a bounded /tmp tmpfs;
  • --cap-drop ALL and no-new-privileges;
  • memory, CPU, and PID limits;
  • no image pulls during the scan;
  • one ephemeral container per step.

Optional .omp/security/config.json:

{
  "engine": "auto",
  "image": "docker.io/semgrep/semgrep:latest",
  "cpus": 2,
  "memory": "2g",
  "timeoutSec": 300
}

engine accepts auto, podman, or docker. rulesDir can point at a custom rules directory. /secdoctor prints the exact pull command when the image is missing.

Rules and image

The baseline Semgrep rules live in plugins/codex-security-omp/container/rules/security.yml. They cover common eval/exec, shell, deserialization, XSS, and credential patterns, plus JS/TS taint rules for SQL and shell sinks and a dotenv credential rule. This is a tested baseline, not a replacement for a full SAST engine.

Build a pinned tools image if you prefer:

cd plugins/codex-security-omp
podman build -t localhost/security-omp-tools:latest -f container/Containerfile .

Then set image to localhost/security-omp-tools:latest. The base image is trusted input; the plugin never pulls it for you.

Agent tools

Tool Purpose
security_container_run Run one tool in the isolated sandbox; records a live container step
security_dependency_inventory Write app-referenced Python/Node imports, manifests, and lockfiles
security_job_step Record an agent or host phase (started, ok, failed, skipped)
security_import_sarif Merge job-output SARIF into findings.json, with dedupe
security_record_validation Record a validation verdict and evidence for one finding
security_record_repair Gate a patch on structural, semantic, executable, control, and consistency evidence
security_job_finish Validate artifacts, seal the scan, and complete the job

Container output is truncated in the live state; full context remains in the job output directory. security_container_run uses OMP exec approval, so approve the isolated tool step when prompted.

Live dashboard

The native Tern block shows:

  • job status, phase, engine, image, job ID, and update time;
  • every step with kind (agent, host, container), status, duration, and image/host;
  • the selected step's command, container name, exit code, and output tail;
  • findings stats, table, detail, and coverage.

Live security dashboard in Tern

Native block with a live Semgrep step and findings.

The block reads live.json and findings.json once per second. The terminal fallback renders the same job and findings view and refreshes every two seconds in a Tern tab. Both stay open until you close the tab.

Two packages, two machines

Tern runs each plugin half where it belongs:

Machine Package id Provides
The host whose panes run (remote Linux or this machine) security-omp Native block (1 block, 0 lenses)
The machine showing the Tern window (the Mac) security-omp-window Palette command and findings.json route

The native block needs both. Without the window package, /secdash closes any plain JSON pane and uses the terminal tab.

Install the window package from git

The repository root contains plugin.toml for the window-only package. On the machine showing the Tern window:

# Remove an older local package/link that used the host id.
tern plugin unlink security-omp 2>/dev/null || true
tern plugin remove security-omp 2>/dev/null || true

tern plugin install ssh://git@git.tni.dev/tni/codex-security-omp.git
tern plugin list

HTTPS works too when a credential helper is configured:

tern plugin install https://git.tni.dev/tni/codex-security-omp.git

The repository is private; Tern runs git with GIT_TERMINAL_PROMPT=0, so configure SSH or HTTPS credentials first. Expect:

security-omp-window 2.4.0 Security dashboard (omp window) — 0 blocks, 0 lenses, window  ready

Open a new Tern window or use Preferences → Plugins → Reload. Existing windows keep the plugin set they loaded with.

/secdash behavior

  1. Links the host package security-omp so the block exists on the pane host.
  2. Runs tern open --tab <repo>/.omp/security/findings.json.
  3. If a pane titled Security appears, the native block is open.
  4. Otherwise it closes any findings.json pane in the artifact directory, opens the terminal dashboard tab from dashboard.mjs, and focuses it.

Remote vs local host

Remote Tern window (Mac shows panes running on Linux):

  • host package security-omp on Linux: /secdash links it from the plugin cache;
  • window package security-omp-window on the Mac: install from the git URL above;
  • do not install the old host-id security-omp package on the Mac.

Local Tern window (window and panes on the same machine):

  • install or link the nested package security-omp; it has both halves;
  • native block, palette command, and route work locally;
  • the root security-omp-window package is not needed.

Development link:

tern plugin link /path/to/codex-security-omp/plugins/codex-security-omp/tern

Troubleshooting

  • Only text: window package missing or not reloaded. Check tern plugin list on the window machine for security-omp-window; reload plugins or open a new window.
  • Palette entry absent: window half failed to load. Check Preferences → Plugins for a failed badge.
  • JSON tab: older OMP extension or missing window package. Restart OMP after installing 2.4.0.
  • Native block empty: run /secscan in that repository; the block follows .omp/security/findings.json in the pane directory.
  • Remote list: security-omp should show 1 blocks, 0 lenses; window-only should show 0 blocks, 0 lenses.

Artifacts

.omp/security/findings.json is the findings record and dashboard source:

{
  "schemaVersion": 1,
  "tool": "codex-security-omp",
  "scanId": "20261126T101500Z",
  "target": ".",
  "revision": "abc1234",
  "createdAt": "2026-11-26T10:15:00Z",
  "findings": [
    {
      "id": "F1",
      "title": "Unsafe archive extraction",
      "severity": "high",
      "file": "src/extract.py",
      "line": 41,
      "evidence": "source excerpt or trace",
      "impact": "what an attacker gains",
      "fix": "minimal remediation",
      "status": "open"
    }
  ],
  "coverage": {
    "filesReviewed": ["src/extract.py"],
    "excluded": ["tests/fixtures"],
    "unresolved": []
  }
}

report.md carries the summary, per-finding trace, and coverage limits. scanId is YYYYMMDDTHHMMSSZ.

Findings also carry validation, disposition, rationale, fingerprint, and first/last-seen scan IDs. live.json is the job record: status, phase, profile, mode, target, revision, engine, image, steps, container names, commands, exit codes, output tails, findings summary, and artifact flags. Per-job copies live under .omp/security/jobs/<jobId>/; starting a scan moves the previous findings/report into that job's previous/ directory, so the guard cannot pass on stale artifacts.

Sealed scans live under .omp/security/scans/<scanId>/ with a manifest of artifact hashes, mode, parent scan, and fingerprints. The history index powers /sechistory and the dashboard's scan list. /seccompare classifies findings as introduced, resolved, changed, or unchanged by fingerprint, so moved lines do not create false "new" findings.

Repair records live under .omp/security/repairs/<id>.json; findings carry repair and repairVerdict. Improvement records live under .omp/security/improvements/<id>/ as research.md, plan.md, implementation.md, and verification.md.

Isolation and threat model

Risk Mitigation
Malicious repository content read-only source; no network; no host secrets in container
Prompt injection in code/docs findings remain artifacts; validation required; raw evidence shown
Malicious image user chooses/pulls image; no pulls during scan; document trust
Container escape rootless engine preferred; dropped caps; no-new-privileges; read-only rootfs; limits
Runaway scan timeout, /seccancel, PID/CPU/memory limits
Model hallucination static baseline + independent validation + coverage receipt
Secret leakage in reports redact evidence before writing; artifacts stay local

A container is one layer. For hostile repositories or adversarial images, run on a dedicated VM/host. Rootless Podman is preferred.

Research and design

The local design is based on:

  • OpenKritt — workflow levels/steps, disposable job containers, dedupe/ranking, exports, locks.
  • OpenAI Codex Security — standard/deep/diff workflows, post-seal validation, sealed artifacts, background scans, read-only sandbox.
  • Anthropic sandbox-runtime — OS-level filesystem/network isolation in addition to containers.
  • Agentic research — AIxCC SoK, CyberGym, RepoAudit, Vulnhuntr, and SAST false-positive filtering: decompose by entry point, combine static tools with LLM tracing, validate independently, and keep evidence.

Full design and threat model: docs/local-security.md. Paper-by-paper evidence, reported numbers, and implementation status: docs/science.md. The staged limitation workflow: docs/improvements.md. Credits and verified sources: CREDITS.md.

Bundled methodology

The skill reads its references from plugins/codex-security-omp/skills/security-scan-omp/references/:

File Contents
scan-method.md Scope, inventory, attack-surface mapping, tracing, validation
threat-model.md Assets, actors, boundaries, entry points, sensitive operations
severity-rubric.md Critical/high/medium/low plus confidence
finding-schema.md Artifact fields, evidence rules, statuses, coverage
report-format.md Report structure and coverage limits

These are independently written; they follow Codex Security's vocabulary and workflow shape without copying upstream prompt text.

Native OMP security

OMP also ships /security for OAuth-backed native scans:

  • /security — background native reviewer, project store, dispositions, cloud scans.
  • /secscan — local session model, bundled methodology, container tools, artifacts on disk.

/secexport bridges them: SARIF 2.1 for /security import (security.enabled and a Git repository required).

Development and testing

cd plugins/codex-security-omp
npm test                  # 29 tests; Podman E2E runs when podman + image exist

tern plugin link ./tern
tern plugin list          # security-omp … 1 blocks, 0 lenses, window ready
tern plugin unlink security-omp

No build step, no runtime dependencies. The extension is TypeScript loaded by OMP; Tern halves are Luau.

Useful checks:

node tern/dashboard.mjs --once /tmp/repo/.omp/security/findings.json
podman build -t localhost/security-omp-tools:latest -f container/Containerfile .

The test suite covers command/tool registration, workflow profile selection, improvement stage gates, dependency inventory, artifact guard/archive, job state, container argument isolation, SARIF dedupe, scan history/lineage/validation, repair evidence gates, cancellation, three end-to-end Semgrep scans, and a container-cancel check.

Limitations

  • The bundled rules are a baseline, not Deep Scan parity. Taint and dotenv rules are tested on a small fixture, not a corpus.
  • AI discovery quality follows the session model and context budget.
  • History, fingerprints, validation, dispositions, and compare are local only; there is no hosted store, cloud findings, or issue-tracker sync.
  • Patch verification is gated by recorded evidence, not a managed verification provider or a language-specific harness oracle.
  • The deps profile inventories app-referenced imports and lockfiles; it does not synthesize dependency harnesses or compare versions.
  • Deep mode has no budgeted SecPRBench/PrimeVul measurement.
  • Container isolation is only as good as the engine and image; use a dedicated host for hostile input.

Releases

Never hand-bump patch versions. Every push to main runs .forgejo/workflows/release.yml:

  • manifest version newer than the latest v* tag → release as-is;
  • otherwise bump patch, stamp plugin.json, package.json, the root and nested Tern manifests, and the catalog, commit chore(release): vX.Y.Z, tag, publish.

Manual major/minor: edit plugin.json and both Tern manifests, then push.

Uninstall

/marketplace uninstall codex-security-omp@codex-security-omp
tern plugin unlink security-omp
tern plugin remove security-omp-window