Skip to content

Add PATCHSTACK_MODE=off to switch the guard off without a deploy - #523

Closed
mariojgt wants to merge 1 commit into
mainfrom
guard-off-switch
Closed

mariojgt wants to merge 1 commit into
mainfrom
guard-off-switch

Conversation

@mariojgt

Copy link
Copy Markdown
Contributor

PATCHSTACK_MODE knew block and dry-run. An app that needed the guard out of the way during an incident had to edit a file and deploy, which is the slowest route at the moment speed matters.

What changed

PATCHSTACK_MODE=off switches the guard off:

  • requests reach the app as they came, responses leave as the app made them, and fetch and node:http are left unpatched;
  • no rules are fetched and nothing is reported, so the guard makes no network call at all;
  • every method the guard has is still there, so the code that calls it runs unchanged;
  • the app's log says so once at start.

It is read when the guard is created, so it is set or cleared with a restart and no code change. It can only be set in the environment: mode: 'off' as an option does nothing, and the platform cannot choose it.

protection.mode reads off, ruleSource reads { ok: false, origin: 'empty' } and detectionReporting reads disabled-by-config.

Worth a look

  • Anyone who can set the app's environment can now switch protection off. They could already remove the guard by editing the app, so this is the same power, quicker to use.
  • The docs said the guard "has no switch that removes it". AGENT-INSTALL.md now describes the switch and tells an installing assistant not to set it to make a test or a check pass. README.md and the CLI help list the value.
  • Nothing tells the platform the guard was switched off. The dashboard will show the app's guard as no longer fetching rules.

Checked

  • Five new tests in tests/protect/switched-off-in-environment.test.ts, including that the same guard blocks the same request when switched on, and that no network call is made when switched off.
  • npm test passes except tests/field-test-cli-log.test.ts (a temp-path difference on my machine). typecheck and capabilities:check pass.

Outstanding

AGENT-INSTALL.md ships in the tarball. The hostile run, plus standard or lovable for document accuracy, is owed immediately after the release that carries this.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@coderbuds

coderbuds Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

🎯 Elite quality (97%) — Adds an env-only kill switch that returns an inert guard with the full API surface, backed by focused tests.

📦 Medium

🤖 Written by Claude Code — going by its own attribution. Unknown whether a person read it; agents can report that with the report-ai-usage-tool tool.

🔴 High risk — lets anyone setting environment disable all request, response and egress screening in src/protect/runtime.js, which a person should check before it ships.

🙋 Review requested by @mariojgt — the team has been asked. Needs a review.

🛑 Coderbuds triage found a problem that should stop this merge: lets anyone setting environment disable all request, response and egress screening in src/protect/runtime.js, which a person should check before it ships.

See how your team is trending →

@mariojgt

Copy link
Copy Markdown
Contributor Author

/review

@mariojgt mariojgt closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant