Repository navigation
Declarative-first recipes, review signals and planner ranking - #605
Merged
Merged
Conversation
- review: detect request.json() followed by field checks and add a constant-response signal; freeze the pre-conversion recipe modules under test/fixtures/review-recipes as review inputs (#556) - recipes: contact-form, static-plus-api, cors-api and the middleware /profile route use request.body.schema and respond instead of function code; auth/admin scaffolds use `auth: true`; middleware comments stop describing guest limits on trusted routes (#555) - webhook-receiver is a trusted function verifying an HMAC-SHA256 signature with node:crypto and a secret binding, with header parameters and a body schema; the audit advisory restates the documented sandbox criteria; plan-feature names secrets and trusted crypto for signature goals (#586) - new native json-endpoint recipe; search_recipes and plan-feature rank no-code recipes first; matched and outline are populated; the request.body.schema subset is listed in get_schema and capabilities (refs #587) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # llms-full.txt
# Conflicts: # llms-full.txt
# Conflicts: # llms-full.txt
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.
Summary
Declarative-first recipes and planner. Order followed: review detector first (#556), then the recipe conversions (#555), the signed-webhook fix (#586) and the planner and recipe-search part of #587.
#556:
urlcode reviewdetectsrequest.json()validation and constant responsesmanual-body-validationnow anchors onJSON.parse(or a no-argument.json()on the incoming request (request,reqor the handler's first parameter, never a fetched response). It needs at least two field checks after the parse, and the hints now includetypeof body.x, length bounds,Array.isArray/Number.isIntegerand422.constant-responsesignal (native-alternative, capabilityrespond): one default-exported function with onereturn Response.json(…)/new Response(…), no branching,awaitor imports, and nothing read from the request/context except literal YAMLargs. Middleware and{from: …}args never qualify.test/fixtures/review-recipes/(contact-form, static-plus-api, cors-api, webhook-receiver, middleware/profile) and used as review test inputs. Before this change review reported 0 observations on them. Now each gets the expected signal.#555: recipes use the YAML that already expresses them
contact-form:request.body.schemaplusrespond {status: 202}plus the signal. The function is gone.static-plus-api/api/infoandcors-api/api/items:respond.json, with the functions gone. Because static-plus-api now runs no project code, it also activates on AWS and Vercel (derived metadata)./profile(recipe and cookbook copy):request.body.schemawithadditionalProperties: false.body.mjsnow only parses once and hands the body off throughstate.packages/authandpackages/adminscaffolds useauth: truein place ofpolicies.extensions.auth: {}, with changesets for both.auth,request-id,errorsanddebugcomments (plus the/admin/paneldescription) no longer describe guest limits on routes that run trusted.examples/cookbook/routes/code.yamlis left as is (that file demonstrates code).#586: signed webhooks
webhook-receiveris now a trusted function. It declares header parameters withpattern(X-Webhook-EventandX-Webhook-Signature: sha256=<hex>), a body schema and asecrets: {WEBHOOK_SECRET: {secret: WEBHOOK_SIGNING_SECRET}}binding. It verifies HMAC-SHA256 withnode:crypto(timingSafeEqual) and returns 401 on a mismatch.sandboxReasonrecords why the route is trusted. The fixtures are signed with the documented test keyrecipe-test-secret.auditadvisory on trusted POST routes now restates the documented criteria: untrusted input alone is not a reason to sandbox; reviewed code stays trusted, and the filesystem,node:crypto,fetchand npm are available only there;sandbox: trueis for unreviewed or contributed code, or for code that must not be able to leak a secret.plan-featureadds a "Signature verification" application-code boundary that names secret bindings and trustednode:crypto. It no longer reads "signed" in "HMAC-signed" as sign-in (auth).#587 (planner and recipe search only)
json-endpoint: a POST whose fieldsrequest.body.schemavalidates (includingadditionalProperties: falseandenum), answered withrespond, plus a fixedrespond.jsonGET. It has no project code and activates on every server target.search_recipes: at an equal score, recipes that run no project code rank first.plan-featureranks them first, then by matched terms.matchedis filled from planner terms, tags, capabilities and id, and every listed recipe has anoutlineentry.get_schema request.body.schemadescription and in therequest.bodycapability constraints. The constraints are built from a newbodySchemaSubsetexport, and a drift test checks them against the validator.Refs #587.Also
Test plan
npm run typecheck,npm run check,npm run verify,npm run test:packageurlcode validate/test/audit/reviewon each converted recipe (contact-form and webhook-receiver with a generated--policy; webhook withWEBHOOK_SIGNING_SECRET=recipe-test-secret). All fixtures pass and review reports 0 observations on the converted recipes..json()negative), readiness advisory wording, recipes (signed webhook 202/401 with a different key, grant required, native-first search), feature-plan (JSON endpoint and HMAC webhook goals), capability-query (subset drift).Closes #556
Closes #555
Closes #586
Refs #587
Not an independent security review: the HMAC recipe is an example of the documented trust model, not an audited verifier. It does not reject replays, and the README says so.
🤖 Generated with Claude Code