Files

Custom validation demo

Run a local HTTP test against a synthetic invoice API, then use the same test to validate a finding in a scan. The app contains a deliberate authorization flaw. Use it on loopback with the supplied test data only.

Run the HTTP test

This path uses Node.js and the SDK's TypeScript compiler. From the repository root, install the SDK dependencies, compile the fixture, and run its test:

pnpm --dir sdk/typescript install --frozen-lockfile
pnpm --dir sdk/typescript run build:examples
node examples/custom-validation/validate.mjs --output reports/http-proof.json
node examples/custom-validation/validate.mjs --mode repaired --output reports/repaired-proof.json

Both proofs record the mode, a 401 for an anonymous request, a 200 for each owner reading their own invoice, and server_stopped: true. Compare Alice's request for Bob's invoice with Bob's successful request for the same record. The vulnerable server returns 200 and records cross_account_read: true, which supports reporting the finding. The repaired server returns 403 and records cross_account_read: false, which supports suppression. Both runs use a loopback server and work without model access or sign-in.

Run the scan with custom validation

Use a supported Node.js version and your configured Codex Security sign-in or API key. Building the local CLI bundle requires the source-matched native payloads for all supported platforms under plugins/codex-security/native/prebuilt. Obtain them as described in the native build guide.

From the repository root, with the SDK dependencies installed, run:

pnpm --dir plugins/codex-security/mcp-app install --frozen-lockfile
pnpm --dir sdk/typescript run build:plugin
pnpm --dir sdk/typescript run build
node examples/custom-validation/run.mjs

The runner copies the API into a temporary directory, compiles it, then starts a model-backed scan of the default vulnerable mode. Open report.md in the scan output directory it prints. In artifacts/custom-validation/, candidates.json lists the findings passed to validation, http-proof.json contains the HTTP observations, and results.json records each decision. A confirmed cross-account read is reportable. If custom validation cannot complete, the scan fails.

Adapt it to another app

The runner passes scan.md to discovery and validation.md to validation. Set the scan path and discovery instructions to the code you want reviewed. Replace the validation command, the authorized test target, and the expected responses with those for your app. Keep the per-candidate decisions, scan-local evidence path, and cleanup checks so readers can verify the result.