Repository navigation
Carry trust-by-default into the CLI, the recipes and the checker - #170
Merged
Merged
Conversation
An audit across every URLCode repository found the 0.4.0-alpha.2 reversal
landed carefully in the runtime's descriptive surfaces and then stopped:
src/capabilities.ts, src/context.ts, src/types.ts and the schema are all
correct, while the CLI strings, the recipe catalog and the packaging still
describe the previous default.
Shipped output, not documentation:
- `urlcode doctor` reported `functionSandbox: 'quickjs-wasm', network: false,
filesystem: false, guestNetwork: false` as unconditional environment facts.
For any route without `sandbox: true` the last three are simply wrong —
trusted routes have full filesystem and network. It now reports
`functionDefault`, `sandboxEngine`, and the trusted/sandboxed capabilities
separately, because the honest answer is per-route and one boolean cannot
carry it. This changes `doctor`'s output shape; the Homebrew formula test
asserted the old field and is updated with it.
- `urlcode --help` said "Functions run in WASM isolation".
- The Homebrew formula's caveats warned about a SQLite WAL build requirement
for "live short-link storage" — a feature core does not have.
Agent-facing text, which re-emits into every generated project:
- The generator and all four skill copies gave "untrusted input" as a reason
to add `sandbox: true`. That is the trusted-code/trusted-data conflation:
request data is untrusted in both modes. The criteria are now about code
authorship, and say so explicitly.
- Nine of eleven recipes described their functions as sandboxed while only
`webhook-receiver` declares it. Two were wrong about security, not just
vocabulary: `recipes/middleware` told readers the guest has no crypto (a
trusted route has all of `node:crypto`, so the advice blocked correct
signature verification), and `recipes/authenticated-json-api` credited the
sandbox for withholding `Authorization`/`Cookie` when the host does it in
both modes.
- `scripts/generate-claude-plugin.ts` published a `short-links` keyword.
The checker is widened to the surfaces that let all of this through. It now
scans `src/`, `recipes/`, `scripts/` and `benchmarks/` comments, and the
`description`/`tags`/`behavior` values in `recipe.yaml`/`example.yaml`/
`urlcode.yaml` — those reach agents verbatim through `explain`, `context`,
the manifest and MCP `search_recipes`, and were previously invisible. A new
`outside-the-sandbox` rule covers the phrasing that had been fixed by hand
twice with no rule behind it; it immediately found a third instance in
docs/policies/security.md that two manual sweeps had missed. Coverage goes
from 185 files to 414.
Also: docs/PRERENDER.md still linked to urlcode-docs as a live showcase, and
docs/NEXT-STEPS.md still taught `auth: { required: true, roles: [admin] }` —
`roles` plural, which `routeAuth`'s `additionalProperties: false` rejects
(issue #168).
Verified: npm run verify — 512 tests, 510 pass, 2 skipped, 0 fail. Both new
checker capabilities regression-tested by reintroducing a defect and
confirming it fails with the right file and line.
Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Closes #169. Addresses the core half of #168.
A fan-out audit across all nine URLCode repositories found the same pattern everywhere: the
0.4.0-alpha.2trust reversal landed carefully in the runtime's descriptive surfaces —src/capabilities.ts,src/context.ts,src/types.tsand the JSON schema are all correct and precise — and then stopped. The CLI strings, the recipe catalog and the packaging still describe the previous default.Shipped output, not documentation
urlcode doctorfunctionSandbox:"quickjs-wasm", network:false, filesystem:false, guestNetwork:falsesandbox: true— trusted routes have full fs and network. An operator or CI job can gate on this.urlcode --helpbrew install, for a feature core does not have.doctornow reportsfunctionDefault,sandboxEngine, and the trusted/sandboxed capabilities as separate fields, because the honest answer is per-route and a single boolean cannot carry it:This is a breaking change to
doctor's output shape. It is deliberate: the field namefunctionSandboxencodes the assumption that there is one answer. The Homebrew formula test asserted the old field — it passed because of the bug — and is updated in the same commit.Agent-facing text, which re-emits into every generated project
src/agents-guide.tsand all four skill copies gave "untrusted input" as a reason to addsandbox: true. That is precisely the trusted-code/trusted-data conflation: request data is untrusted in both modes, and this taught agents to sandbox any public endpoint reflexively. The criteria are now about code authorship and say so explicitly.webhook-receiverdeclares it. Two were wrong about security, not just vocabulary:recipes/middlewaretold readers "The guest exposes no crypto, so none of these modules can verify signatures or hash passwords." A trusted route has all ofnode:crypto— the advice actively blocked correct signature verification.recipes/authenticated-json-apicredited "the sandbox" for withholdingAuthorization/Cookie. The host does that before dispatch, identically in both modes; attributing it to the sandbox teaches that the protection is a sandbox property.recipes/cors-apigave the wrong reason for the serverless refusal — middleware needs the self-hosted Node lifecycle, not a sandbox.scripts/generate-claude-plugin.tspublished ashort-linkskeyword for a retired capability.The checker is widened to the surfaces that let this through
check-trust-model-prose.tsscanned Markdown only, sosrc/andrecipes/were entirely invisible — which is exactly where the cluster was. It now also scans:src/,recipes/,scripts/,benchmarks/description/tags/behaviorvalues inrecipe.yaml,example.yamlandurlcode.yaml— these are emitted verbatim byexplain,context, the manifest,urlcode recipes showand MCPsearch_recipes, making them among the most agent-facing strings in the repo, and they were completely unguardedA new
outside-the-sandboxrule covers a phrasing that had been corrected by hand twice with no rule behind it. It immediately found a third instance, indocs/policies/security.md:3, that two manual sweeps (including #165, which claimed those were "the last two occurrences") had missed. That is the argument for the rule in one line.Coverage: 185 files → 414.
Verification
npm run verify— lint, typecheck, check, build, 512 tests: 510 pass, 2 skipped, 0 failsandboxed functiondescription inrecipes/json-api/recipe.yaml→ caught atrecipe.yaml:2node src/cli.ts doctoroutput inspected directlyTwo things worth reviewing closely
doctoroutput shape change is breaking, as described above.AGENTS.mdhas a hard 80-line budget (test/cli.test.ts:28). Fitting the corrected criterion required rewording the surrounding sentence to stay net-zero on lines rather than raising the budget. Worth a look that nothing valuable was squeezed out — the trade I made was dropping "and say why indescription" in favour of the more precisesandboxReason.Compatibility and security
No runtime behavior change. The only executable change is
doctor's report fields. No schema or API change.🤖 Generated with Claude Code