security: fail-closed gate when ML classifiers are inactive#1155
Open
garagon wants to merge 1 commit intogarrytan:mainfrom
Open
security: fail-closed gate when ML classifiers are inactive#1155garagon wants to merge 1 commit intogarrytan:mainfrom
garagon wants to merge 1 commit intogarrytan:mainfrom
Conversation
When both TestSavantAI and Haiku transcript classifiers fail to load, preSpawnSecurityCheck silently returns safe and the agent spawns with zero ML prompt injection defense. This adds a fail-closed gate that blocks agent spawn when all classifiers are inactive, with an explicit opt-out via GSTACK_SECURITY_ALLOW_INACTIVE=1.
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
The sidebar agent's ML prompt injection defense (TestSavantAI + Haiku transcript classifier) degrades silently to zero coverage when both classifiers fail to load.
preSpawnSecurityCheckreturnsfalse(safe) and the agent spawns without any ML protection — the user sees "inactive" on the shield icon but gets no blocking gate.An attacker who can cause model download failure (DNS poisoning on huggingface.co, disk full, proxy blocking the 112MB ONNX download) permanently removes all ML protection while the agent keeps running as if everything is fine.
What this PR does
Adds a fail-closed gate at the top of
preSpawnSecurityCheck:isClassifierInactive(status)— pure function that returnstrueonly when ALL classifiers (testsavant, transcript, and deberta if enabled) report'off'security_event(verdict=block, reason=classifiers_inactive) +agent_errorto the sidepanel so the user sees exactly why the session was refusedGSTACK_SECURITY_OFF=1— that's an explicit operator kill switch, they already know'degraded'or'ok', the remaining coverage is enough to proceedGSTACK_SECURITY_ALLOW_INACTIVE=1for operators who knowingly run without ML (CI, air-gapped environments)Files changed
browse/src/security-classifier.tsisClassifierInactive()pure functionbrowse/src/sidebar-agent.tspreSpawnSecurityCheckbrowse/test/security-classifier.test.tsTest plan
bun test browse/test/security-classifier.test.ts— 16/16 pass (7 new + 9 existing)GSTACK_SECURITY_ALLOW_INACTIVE=1, verify agent spawns despite inactive classifiers