fix(security): align cron invisible-unicode set with the install-time scanner#35077
Open
rlaope wants to merge 1 commit into
Open
fix(security): align cron invisible-unicode set with the install-time scanner#35077rlaope wants to merge 1 commit into
rlaope wants to merge 1 commit into
Conversation
… scanner tools/cronjob_tools._CRON_INVISIBLE_CHARS was a hand-copied 10-char subset of tools/threat_patterns.INVISIBLE_CHARS (17 chars), missing U+2062-U+2064 (invisible math operators) and U+2066-U+2069 (directional isolates). A directive obfuscated with one of them, e.g. "ig<U+2063>nore all previous instructions", passed the cron runtime tripwire (which runs right before non-interactive, auto-approving cron execution) while being caught by the install-time scanner. Import the canonical set so the copies can't drift apart. Adds regression tests covering each previously-missing class; legitimate emoji ZWJ sequences remain allowed. Fixes NousResearch#35075 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 does this PR do?
The cron injection tripwire used a narrower invisible-unicode set than the install-time scanner, so an obfuscated directive could pass one gate while being caught by the other.
_CRON_INVISIBLE_CHARSwas a hand-copied 10-char subset ofthreat_patterns.INVISIBLE_CHARS(17 chars), missingU+2062–U+2064(invisible math operators) andU+2066–U+2069(directional isolates). A directive obfuscated with one of them — e.g.ig<U+2063>nore all previous instructions— passed_scan_cron_prompt, the runtime tripwire that runs right before non-interactive, auto-approving cron execution, while being blocked byskills_guard/threat_patterns. Reusing the canonical set keeps the copies from drifting apart.Related Issue
Fixes #35075
Type of Change
Changes Made
tools/cronjob_tools.py— import the canonicalINVISIBLE_CHARSset instead of a local copytests/tools/test_cronjob_tools.py— regression tests for each previously-missing class; emoji ZWJ still allowedHow to Test
pytest tests/tools/test_cronjob_tools.py tests/cron -q→ 450 passed.Checklist
Code
Scope
Per SECURITY.md §2.4 scanners are heuristics, not boundaries, so this is filed as a regular issue/PR per §1 rather than the private channel.