Repository navigation
[NO-TICKET] Give the agent one recipe for wiring any Node.js app - #448
Merged
Merged
Conversation
Setup wires the frameworks it recognises and leaves a generic guard for everything else. The guide described the procedure in general terms, and agents filled the gap by writing their own createProtection guard, which has no read-only rules credential and cannot fetch rule updates. AGENT-INSTALL.md now has a short recipe under "Completing guard wiring": use the guard file setup wrote (never write your own or copy the .patchstack cache), wrap the app's one request entry with the export that fits its shape (Fetch handler, Node (req, res), Express/Connect, Fastify), run setup again so the guard's rules file gets the site's rules and the credential, then check with protect --check and --runtime. Also corrects the refresh interval it states: 5 minutes, plus a background re-check every 30 seconds while serving, not 45 minutes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
🎯 Elite quality (96%) — Adds a clear, decision-table-driven recipe for wiring unrecognized Node.js apps, with explicit guardrails. 📦 Small |
Contributor
Author
|
/review |
patchstackdave
approved these changes
Oct 28, 2026
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.
What changed
AGENT-INSTALL.mdgets a short "Wiring any Node.js app" recipe under "Completing guard wiring".Setup wires the frameworks it recognises by itself. For everything else it writes a generic guard and lists the wiring as a
To do. The guide described that step only in general terms, and agents filled the gap by writing their owncreateProtectionguard. A hand-written guard has no read-only rules credential, so it cannot fetch rule updates and its warning sends the agent to ask for the site key.The recipe:
protect --checknames it). Do not callcreateProtectionyourself, copy the.patchstack/cache, or move the guard's rules file.fetch(request, …)entries (Workers, Bun, Deno, Hono,export default { fetch }) useprotectFetch;(req, res)(including Koa'sapp.callback()) usespatchstackMiddleware, before anything reads the body;app.use(patchstackMiddleware)first;protectwrites.setupagain, so the guard's rules file gets the site's current rules and the read-only credential. Thenprotect --checkmust exit 0.protect --check --runtimeor a local request test.It also corrects the refresh interval the guide states. It is 5 minutes, plus a background re-check every 30 seconds while serving (#435, #443), not 45 minutes.
How it was verified
On a plain Node
httpserver, which no adapter recognises:protectwrotepatchstack/guard.js, andprotect --checknamed it as unwired.protect --checkreported the guard wired.protect --check --runtimeconfirmed a request reached the guard.?file=../../etc/passwdrequest got 403 and/got 200.The disclosure, capability and install-prompt checks pass, and the full
npm testpasses (4622).Rollout
Docs only, in
AGENT-INSTALL.md, which agents read from the published tarball. So the hostile field test is owed after the release that carries this, plusstandardfor doc accuracy.🤖 Generated with Claude Code