Skip to content

Security audits: AI scans for deploys and a scan-before-public gate - #886

Open
Brooooooklyn wants to merge 53 commits into
mainfrom
feat/security-audits
Open

Brooooooklyn wants to merge 53 commits into
mainfrom
feat/security-audits

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

What this adds

Security audits for the self-hosted platform: each go-live deploy gets an AI security scan, and an admin can require a clean scan before a project goes public (Zero Trust turned off). Off by default (securityAudits capability). Design doc: platform/meta/design-docs/0095-security-audits.md.

void deploy ──► go-live ──► scan row (pending_input) ──► SecurityScanScheduler DO
                                                              │  caps, round-robin
                                                              ▼
              scan input (T1 GitHub diff / T2 built diff / T3 full)
                                                              │
                                                              ▼
       scanner container (no internet) ── model calls ──► model proxy ──► @cf / AI Gateway
         Engine B (Void loop, default @cf deepseek-v4.1-flash-1017)        budget meter
         Engine A (Claude Code) · Engine C (Codex)
                                                              │
                                                              ▼
              ingest (one transaction, attempt fence) ──► findings ──► email / webhook / GitHub check
                                                              │
                                                              ▼
                      public gate: Zero Trust stays on until no open urgent findings

Phases

Phase Milestones What users get
1 M1–M24 capability, policy, tables (migration 0065), scheduler, input builder, Engine B, ingest, project + operator APIs, emails, public gate + bypass, admin pages, read-only page, void project security … CLI, deploy notice, docs
2 M13b, M25–M31 Engines A/C wiring, rescan/backfill/sweeps, @cf fallback, digest + webhooks, per-plan caps, GitHub check, page/dashboard forms, runtime checks on a throwaway copy, secret findings, SARIF
3 M32–M36 void project security check (local tree), BYOK keys, per-project rule, severity edits, docs

Public gate rules

  • Only urgent (critical/high) findings block.
  • fixed needs a rescan of a new deploy; false_positive / accepted_risk unlock at once.
  • An admin can bypass the scan with a reason. The bypass is recorded and the platform admin gets an email. A bypass never skips open urgent findings (409).
  • The policy can't be turned on while platform Zero Trust is off.

Spikes (live on Cloudflare, cleaned up)

Spike Result
S1 network lock, S1b image copy pass
S4 Engine B quality deepseek 10/10 bugs, 8/8 valid, $0.18 median → default; glm-5.3 4/10, fails
S5 static confirm 20/20 planted bugs confirmed with a trace
S7 inputs 100% server files readable (React/Vue/Svelte/Solid)
S8 cost/time under $3 median, p95 under 20 min
S9 refusal mapping 24/24 (after fixes)
S10 gateway no stored bodies, no cache
S11 red team 160/160 (after fixes, incl. a Glob/Grep path escape)
S13 throwaway copy ready in ~9 s, outbound blocked, not reachable from the internet
S2/S3/S6 Engines A/C quality blocked: no AI Gateway credits on the test account

Open before release

  • Engine A/C image digests are null until the images are published to ghcr at release, so Engines A/C can't be picked yet.
  • S2/S3/S6 need AI Gateway credits for real quality/cost numbers.
  • S12 legal questions (Anthropic/OpenAI terms, shipping the Claude Code binary in an image, naming) are listed in the design doc.

Checks

  • vp check: clean
  • vp test run: see CI

🤖 Generated with Claude Code

Brooooooklyn and others added 30 commits November 18, 2026 13:02
…ler stub

Adds the securityAudits capability (deployment schema 7, missing reads as off)
and the SecurityScanScheduler Durable Object stub with its migration tag.
Binds the scheduler only for runtimes that ship it, and blocks a CLI rollback
to a runtime from before this release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge source

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the hard-coded security model list with prices, badges, engines and
reserves, plus the installation policy type, defaults, limit ranges and
error codes. Writes use a strict parser; the stored row is read with a
lenient reader so a retired or newly added model does not turn audits off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the 11 security audit tables (settings, scans, findings, events,
public requests, bypasses, spend, rejections, notifications) in 0065.
Mode, engine and max-cap lists are checked against the M2 policy; the
month check ignores the session time zone; bypasses only from D50 states.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds /operator/v1/security/{policy,status} with revision checks under a lock,
a plan preview, a fresh-probe check to turn on, and Off canceling queued scans.
The preview says where projects go when a model is blocked under a third-party
default. Operator audit records known ids only. Design doc lists the M6/M8/M9 follow-ups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runner reads task.json and the input tar on stdin, runs hunt and verify
sessions through the model proxy, and writes findings.json then status.json.
Pax xattrs are skipped as bytes, SIGTERM during the tar read writes timed_out,
paths with control characters are refused, and any non-stop failure retries once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tainer

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tlement probe

Controller Worker with one Durable Object per scan attempt or probe, egress lock,
and result files read as the scanner user without following symlinks.
Per-installation provisioning (controller, container app, owned gate) and probe
checks 1-6; turning the policy on checks the request first, then re-runs the probe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scan model proxy checks the fence, model, call and token caps, holds the
worst case on both spend rows, and settles to tokens x list price.
It refuses provider-run tools, filters anthropic-beta, stops on tokens below
the provider minimum, and keeps the worst case for unreadable answers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each live deploy writes its scan row in the go-live transaction, then copies
inline Worker modules, queues the row and pokes the scheduler after `done`.
Compensation finishes the row with the modules when a deploy is still live.
Staged input stays while a waiting scan points at it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scheduler claims queued scans round-robin by owner, reserves budget,
starts them through the controller and retries a failed start once.
Hourly jobs reap, re-poke, skip backlog, sweep, keep retention and probe.
Ends, requeues and cancels give the reserve back in the same transaction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
T2/T3 input builder: source maps, filters, third-party, redaction, phrase check,
memory and backlog, streamed to the runner as a tar.
Changed files the input cannot hold go to the backlog, never counted as seen.
Modules are read one at a time and the tar is encoded as it is read.
Builder and runner share one set of input limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
T1 reads the head tarball (equal 8 MiB R2 parts, one key per call) after
the same GitHub authority check a managed build runs. Only changed unread
files cap a scan; unchanged ones are dropped, so big repos stay complete.
The bundle is parsed once, and skipped tar entries count toward the limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
S2/S3 gain --local-gateway: the engines run in local Docker behind a model-proxy
stand-in that holds the token and calls the gateway REST route. S10 checks what the
gateway keeps (no bodies, no cache). Third-party calls hit the credits 402.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Take the runner result in one transaction: findings, events, reopen and
stale-scan rules, not-seen hint, fix check, ledger and the no-changes path.
The cap limits new keys only, server leads have their own key space, and a
diff scan keeps the base ledger.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…an caps; fix controller PATH

A bad verify session now leaves the candidate a lead and the scan
incomplete instead of dropping every finding. Engine B repairs harmless
report slips and takes JSON sent as text. The controller PATH gains
/usr/sbin:/sbin so useradd works. Default token caps go to 1.2M in and
120k out after spikes S4/S8.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… scanner images

Engine A runs the Claude Agent SDK with three read tools; Engine C runs the
Codex SDK with only the void-scan MCP server. Both ask the model proxy why a
session ended without a report. The SDKs live in two images with exact pins,
lockfiles and a drift test. The proxy takes the gateway model name and never
passes an upstream 401 to an engine. Spike lessons: is_error with a 402 is
credits, Codex retry caps are 0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
After the runner and cap changes deepseek-v4.1-flash-1017 meets every S4
bar (10/10 bugs, 8/8 valid runs, no false crit/high) and glm-5.3 does not
(4/10 bugs, 4/8 valid runs). The default model is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
S4 rerun on VoidZero: deepseek 10/10 bugs, 8/8 valid, median $0.18, p95 15.7 min
(pass); glm-5.3 4/10, 4/8 valid (fail). glm-5.3 stays selectable.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add the per-project security status, findings, comment, resolve, reopen,
scans, model and page-link routes, with reader and CI views that hide detail.
Scans and model writes answer 501 while the capability is off; the page link
uses `?t=` for M19 to redeem.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ate and bypass

Adds the outbox, recipients, copy and senders, queued with the change and sent by the
scheduler alarm. Types email finding severity, pins the raise-to-critical rule with a test,
and covers the hourly poke. Tests that expected the old default model now name the new one.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e catch-up)

Public requests are judged at ask, ingest, resolve, cutover, rollback, bypass and hourly.
Review fixes: one exposure scan per deployment, the hourly backstop rotates and shares the
run's routing budget, gate-off cancel writes its event and email, and held copy names the cause.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds operator routes for the security budget, findings, scans, public requests and bypass.
The budget write needs the capability, the bypass preview shares the real refusal rules,
and the month totals use a UTC month start and stay installation-wide.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds the Security pages, banner and nav badge, plus project Security and bypass controls.
Mark all as seen posts the newest bypass time the page showed, clamped to the real newest row.
The admin bypass route stays open with the capability off, like the operator route.
Adds a test per write route, each asserting its audit row.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Bypass races (#72, #89, #93, #94) and gate vs Zero Trust (#64, #90).
Strict policy reader answers 503 on disable.
Deploy and rollback keep working while a request is open.
Operator 202 and dry-run shapes, project 202 reply.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A signed CLI link opens a path-scoped cookie page at /security/projects/:slug.
Urgent findings load apart from the capped open list, headings use real totals,
and a cut list points to the CLI. The route uses the same gate as the project
API (member, owner not suspended). Tests cover suspended and deleted accounts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds status, list, show, comment, resolve, reopen, scans, model, budget and open.
The status route now returns the open public request.
Tests cover every command path, the public request view by role, and the capability-off read.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…tatus

Add 'void project zero-trust bypass' with a reason and a confirm prompt.
Show the held public request and its urgent finding ids in status.
Help, the no-args hint and docs/reference/cli.md are updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Managed deploys print the scan state and open urgent findings after the deploy is live.
One read with a 5 s limit; any error, 404 or timeout prints nothing and keeps the exit code.
A deploy with unpublished routing still gets the notice. Rows sort critical first, then oldest.
The caller-role "Fixed?" line is a documented gap in the plan.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Brooooooklyn and others added 21 commits November 19, 2026 20:02
…ninstall

Add `void platform security ...`; `budget` shows caps with no flags and sets them with any cap flag (spec 13.4).
Add --security-audits to install, upgrade and repair, and remove the scanner on uninstall.
Uninstall treats a refused or missing container application list as nothing to remove when no controller exists.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add the security audits admin guide and link it from the platform docs.
Update the project, deploy and platform Zero Trust CLI references and the skill.
Name the platform administrator bypass command next to the project one.
Record the M24 notes in the design doc.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d run

Copy the pinned engine images into the operator registry and run each engine in its own class.
A failed probe step no longer changes what is deployed; concurrent probes converge.
Copy is bounded by the probe deadline; hosts with all models blocked get no copy.
Uninstall image cleanup fails loudly and can be retried; recorded run is opt-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add void project security scan, operator backfill and policy sweeps run hourly.
Leave out projects with no stored code so they never block a batch.
A sweep replaced by a deploy or canceled by policy Off is due again.
Standard hunts keep the strongest record per fingerprint and fit report limits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d webhook

Opt-in @cf fallback after a refused, bad-output or timed-out third-party scan;
a rescan, sweep or gate fallback keeps its full scan and gate rule.
Streak emails once per streak, weekly digest, and a signed ids-only webhook
that posts every event kind and holds its rows after a failed POST.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plans can set a monthly scan cap (amount, none, or inherit) from the
operator CLI and the admin Plans page; scans, model calls, the budget view
and cap emails all use it. Budget writers read the plan cap in their
locked select, and messages name the plan when its cap is the limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Neutral check run (counts and landing link) on the build's commit at ingest.
One counts-only PR comment per project; a failed or partial read skips the PR.
Only our App's comment is edited; platform failure reasons stay private.
Re-run queues a project rescan for a sender with settings on the project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dget and bypass

Resolve, comment, model, budget and bypass forms on the API page and the dashboard.
The page sends Referrer-Policy same-origin so its own posts keep their Origin.
A bypass whose Access update fails says it is recorded (502); the picker keeps the saved model.
Form text uses small shared parsers from @void/platform/security-policy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ment

Engine B verify can send requests to a per-attempt copy with empty stores and fake secrets.
Only an app request the copy answered is runtime proof; setup routes never are.
No copy when the bundle, kept vars or schema hold a stored secret value.
The copy is deleted from its own bindings, or at once if its attempt already ended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stored secret values in the deployed output become server findings, one per
secret and side, kept across hashed bundle names; built code and big assets
are searched too. Opt-in client asset pass reads client sources from maps
within the input budget. SARIF export for project and operator findings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y S9/S11

- Codex "cyber policy: <msg>" text now ends refused (cyber_policy).
- The model proxy passes a provider cyber_policy / trusted_access_for_cyber
  400 on with its code and records last failure `refused`.
- Engine A reads the refusal category from the assistant message.
- Engine A path hook checks every Glob pattern (.., ~, braces, relative
  under the search path) and refuses ~ paths for all tools.
- A session that read no file cannot clear code: an empty or all-rejected
  report from it is bad_output (nothing_read), so a silent decline (S9 B5)
  never passes the public gate.
- S9 now 21/21 (B5 counted as unsignalled), S11 150/150.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Engine A path hook refuses a Glob/Grep path with whitespace at either
  end (Claude Code trims it, so " /" searched /) and any non-string path.
- stats.reads counts only reads that returned code under /scan/input:
  Engine B via FsTools, Engine C via the void-scan server's <out>.reads,
  Engine A via a PostToolUse hook on Read. Reading the memory index,
  listing or searching and then declining no longer clears the gate.
- Engine A: a refused turn with no report ends refused whatever the
  result says; CLAUDE_CODE_REFUSAL_FALLBACK_CATCH_ALL=0 is pinned.
- classifyCodexRun matches the policy code on letters and digits only.
- The proxy finds a policy code in any code/type field at any depth,
  keeps 8000 chars, and drops the dead 402 refusal mapping (credits wins).
- S9 24/24 (new B6, A6, C9), S11 160/160.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add void project security check: upload git-tracked files, scan, print a
separate 30-day result that never touches project findings.
Result is written before the row ends; a lost upload reply or start recovers.
Local checks stay out of fallback, retention, streaks, sweeps and rescans.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keys are saved encrypted after a 1-token test call; the proxy adds them server-side.
A probe that ran while a key changed keeps the value the key write stored.
The proxy reads the key before the policy; a malformed entry fails the call.
Operator CLI: void platform security models --provider <host> --key-stdin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Admins set a project's rule from the CLI, operator API or admin UI.
never skips deploy scans, rescans, sweeps and local checks; the scan
before a project goes public still runs. always scans a protected
project under public. Preview counts follow the rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owners and admins can set a finding's severity, with a comment, or
clear it to go back to the scan value. Later scans keep the human value.
The gate, counts, digest, checks and webhooks use the shown severity.
A stale-revision reply now names who made a severity edit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Plan cap changes apply at once, including to running scans.
GitHub checks cover connected builds with either executor; PR comments cap at five.
Only owners and admins resolve, bypass, set model and budget.
I6 names its tests; I2/I3 mark S1 as not recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	packages/void/src/cli/deploy-managed-events.ts
@Brooooooklyn
Brooooooklyn requested a review from a team as a code owner November 20, 2026 11:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T11:30:17.834641Z 7b698e8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@socket-security

socket-security Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​anthropic-ai/​sdk@​1.10.06610092100100
Added@​anthropic-ai/​claude-agent-sdk@​0.3.3241001009310070
Added@​openai/​codex@​0.169.010010093100100
Added@​modelcontextprotocol/​sdk@​1.32.29910010096100
Added@​openai/​codex-sdk@​0.169.099100100100100

View full report

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://feat-security-audits-void-cloud.voidzero-docs.workers.dev (commit de390f6)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://5680f064-void-cloud.voidzero-docs.workers.dev de390f6 2026-11-20T11:39:31.192Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://bbb1bdae-void-cloud.voidzero-docs.workers.dev 7b698e8 2026-11-20T11:27:53.348Z Visit the dashboard ↗

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b698e8caa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Brooooooklyn and others added 2 commits November 20, 2026 19:38
CI forces colour, so each box border sits between escape codes and the
flattened text kept them between words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ored key

Ingest hashes the reported fingerprint with the project and sink, so a
model that reused the hashed key from memory made a new finding and lost
the old one's severity edit and resolve history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant