Skip to content

[Request]: surface the sandbox trust decision in audit/explain, not just prose comments #135

Closed

Description

@jimhoyd

Problem or use case

With trusted-by-default function/middleware execution (#127, docs/SPIKE-DEFAULT-TRUST-MODEL.md), whether a route correctly opts into sandbox: true is a per-route judgment call the runtime deliberately can't verify — docs/AI-AUTHORING.md's own "Deciding when a route needs sandbox: true" section says so directly: "This is a judgment call the project (or the person/agent authoring it) makes per route; urlcode audit/validate cannot infer it from the code." The current guidance is "say explicitly why a generated route does or does not declare sandbox: true" — which today means a source comment (see recipes/webhook-receiver/urlcode.yaml's sandbox: true with an inline justification comment). That's good authoring guidance, but it's prose: nothing in urlcode audit, validate, or explain reads it, surfaces it, or makes its absence visible.

For a real project with many routes (the kind this came up discussing — ports with dozens of webhook receivers, OAuth callbacks, admin-command handlers), that means the single highest-stakes decision in the new trust model has no reviewable trail anywhere a human or a CI check can see it in one place. A reviewer has to go read every route's source file and hope the comment convention was followed consistently.

Proposed behavior and alternatives

Not proposing that URLCode infer trust intent from code — the docs are right that it can't, and pretending otherwise would be worse than the status quo. Two more modest, achievable pieces instead:

  1. A structured, machine-visible trust-decision field, e.g. an optional sandboxReason/trustReason string alongside sandbox, so the justification the authoring guidance already asks for lives in YAML (parsed, length-bounded, part of the compiled route) rather than only as a source comment tooling can't see. urlcode explain/manifest could then surface it per route the same way it already surfaces policies and capabilities.

  2. An advisory (non-blocking) heuristic in urlcode audit: flag routes that look plausibly webhook/callback/third-party-input-shaped (e.g. POST routes with a declared request.body policy, no sandbox: true, and no sandboxReason) as "consider whether this route needs sandbox: true" — explicitly advisory, never a hard failure, since it genuinely can't know intent. This is the same spirit as the existing agent_gap reporting: give a human/agent a nudge to look, not an automated verdict.

Alternatives considered: leave this purely as authoring-doc guidance (the status quo). Reasonable if the project judges the comment convention sufficient, but it means the accountability trail for the one un-automatable trust decision in the whole model lives nowhere audit/explain/CI can see, which seems like a gap worth closing given how central this decision now is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions