Repository navigation
Conversation
Run refuses `help <cmd>` for a RemediationOnly builtin (rm, tee, truncate, logrotate, systemctl) outside remediation mode, but Check returned early for `help` without looking at its operand, so it approved scripts Run then refused. Check now applies the same remediationOnlyRefusal predicate dispatch uses and reports CheckRemediationRequired. help also checks the remediation gate before printing a command's static Help text, so a RemediationOnly builtin with static help can't print it outside remediation mode either. Found by Jacob Hayes with patina (https://github.com/JacobHayes/patina), with a Check-vs-Run oracle. Environment: Datadog workspace Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
Runrefuseshelp <cmd>for a RemediationOnly builtin (rm,tee,truncate,logrotate,systemctl) outside remediation mode, butCheckreturned early forhelpwithout looking at its operand, so it approved scriptsRunthen refused. Not an escape (Runstill enforces the gate), butCheckshould never approve whatRunrefuses.Checknow applies the sameremediationOnlyRefusalpredicate dispatch uses forhelp <name>(unless the operand is a feature topic) and reportsCheckRemediationRequiredwith the same message.helpnow checks the remediation gate before printing staticHelptext, so a RemediationOnly builtin with static help can't print it outside remediation mode. None of today's five has static help; this closes it for future ones.Not covered here:
Checkalso doesn't modelhelp <cmd>for a command outsideAllowedCommands, whichRunrefuses with exit 1.Credit
Found by Jacob Hayes with his deterministic-simulation tool patina (finding #3: Check-vs-Run oracle, about 6.3k runs). Findings thread: https://dd.slack.com/archives/D0AC8RLB21J/p1793475631273749
Tests
TestCheckHelpOfRemediationOnlyBuiltinMatchesRun(interp/check_test.go) enumerates the RemediationOnly builtins from the registry, so new ones are covered, and asserts that Check's verdict matches Run in read-only and remediation mode. It fails for all five on main.go test ./...passes exceptTestPSPentestLargePIDListDoesNotHanginbuiltins/ps, which fails the same way on clean main on this host.🤖 Generated with Claude Code