Repository navigation
Add sandboxReason field and a non-blocking audit heuristic - #149
Merged
Merged
Conversation
Part 1: an optional `sandboxReason` string on function/middleware routes, ajv-validated (max 500 chars, schemas/urlcode.schema.json) and stored on the compiled route alongside `sandbox`. It applies regardless of whether `sandbox` is true or false, so an author can record why a route needs isolation or why it is safe to trust. Surfaced next to the existing `sandbox` boolean in `explain`'s handler output and `context`'s per-route listing, the same way #134 added `sandbox` there. recipes/webhook-receiver now declares it, replacing what was only a source comment. Part 2: a non-blocking advisory in `urlcode audit`: a route that runs project code, accepts POST with a declared `request.body` policy, and declares neither `sandbox: true` nor `sandboxReason` is flagged under a new `advisories` array on the audit report ("consider whether this route needs sandbox: true"). It never affects `ready` or the CLI's exit code — same non-blocking spirit as the rest of `audit`'s reporting. Update docs/AI-AUTHORING.md's "Deciding when a route needs sandbox: true" and regenerate docs/YAML-REFERENCE.md and llms-full.txt. Add regression tests: schema accept/reject including the length cap, explain/context surfacing, and the audit heuristic firing/staying silent without changing readiness. Claude-Session: https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr Co-Authored-By: Claude Sonnet 5 <[email protected]>
jimhoyd
force-pushed
the
feat/sandbox-reason-audit-heuristic
branch
from
September 19, 2026 13:20
c4c6e64 to
33c2445
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #135
Part 1 —
sandboxReasonAn optional
sandboxReasonstring onfunction/middlewareroutes, alongside the existingsandboxboolean:type: string, maxLength: 500(schemas/urlcode.schema.json).RouteConfig/CompiledRouteinsrc/types.ts) — a structured field, not just a source comment.sandbox's value: a route author can explain either "why this needs isolation" (sandbox: true) or "why this is safe to trust" (sandbox: false/absent).sandboxboolean inurlcode explain's handler output (src/explain.ts) andurlcode context's per-route listing (src/context.ts) — the same code path Update stale skill files and surface sandbox in explain/context #134 used to addsandboxthere, so the MCPexplain/get_contexttools pick it up automatically.recipes/webhook-receiver/urlcode.yamlnow declaressandboxReason(moving what was only a source comment into structured YAML tooling can read).Part 2 — non-blocking
urlcode auditheuristicsrc/readiness.ts'sauditProjectnow returns anadvisories: {route, message}[]array. A route is flagged when it:functionormiddleware),POST,request.bodypolicy, andsandbox: truenorsandboxReason.The message: "This route accepts POST with a declared request.body policy but declares neither sandbox: true nor sandboxReason; consider whether this route needs sandbox: true."
This is advisory only — it never affects
ready, never touches the CLI's exit code, and never infers the actual trust decision (whichdocs/AI-AUTHORING.mdis explicit tooling cannot do). Setting eithersandbox: trueorsandboxReason(withsandboxeithertrueorfalse) silences it.Docs
docs/AI-AUTHORING.md's "Deciding when a route needssandbox: true" section now describessandboxReasonand the audit heuristic.docs/YAML-REFERENCE.mdandllms-full.txtregenerated (npm run docs:reference,npm run docs:llms).Tests
test/config.test.ts: schema acceptssandboxReasonwithsandboxeithertrueorfalse, accepts exactly 500 chars, rejects 501.test/explain.test.ts:explainsurfacessandboxReasonfor both a trusted route (undefined) and the sandboxed webhook-receiver recipe (set).test/context.test.ts: same, viacontext's per-route listing.test/readiness.test.ts: the heuristic fires on a matching route, stays silent whensandbox: trueorsandboxReasonis set, stays silent when there's norequest.bodypolicy or the route isn't POST, andready/exit-code semantics are unaffected either way.Verification
npm run typecheck— greennpm run lint— greennpm run docs:reference— regenerateddocs/YAML-REFERENCE.mdnpm run docs:llms— regeneratedllms-full.txtnpm run verify— green (495 tests, 493 passed, 2 pre-existing skips, 0 failures)CI passing and these regression tests are evidence for this change's own scope; they are not an independent security review of the broader trust model, and this PR does not claim to be one.
🤖 Generated with Claude Code
https://claude.ai/code/session_018neC2tYKPxMPbzZf1wNctr
Generated by Claude Code