Repository navigation
fix(operator-queue): normalize reserved-prefix guard against lookalikes (#1631 follow-up) - #1688
Merged
Merged
Conversation
…es (#1631 follow-up) Fast-follow to PR #1684 (merged): the /cso --diff audit of the #1631 change found one LOW — the reserved-prefix hijack guard was exact-match, so an agent could author a lookalike (` Poison-x`, uppercase/padded) platform-styled operator alert. Not a hijack (an independent refutation proved collision/ suppression is impossible — the only colliding string necessarily matches the prefix and is rejected), but an operator-phishing surface. Normalize (strip + lower) before the prefix check so a lookalike can't slip past — the platform mints these prefixes lowercase and unpadded, so a normalized match can only be impersonation. Covered by a new fold-case test. Also lands the CSO audit report under docs/security-reports/. This stranded on the #1684 branch when that PR squash-merged mid-audit; landing it here on its own. Refs #1631.
vybe
approved these changes
Jul 18, 2026
vybe
left a comment
Contributor
There was a problem hiding this comment.
Validated via /validate-pr: focused hardening follow-up to #1684 — normalize-before-check on the reserved-prefix guard, with the named lookalike regression test (test_reserved_prefix_guard_folds_case_and_whitespace). Ran tests/unit/test_1631_operator_queue_agent_scoped_ids.py locally on the PR head merged with dev: 6 passed. No security/packaging concerns (diff strictly tightens an existing guard; no new env vars, modules, or endpoints). Note: body uses bare Refs #1631, so bumping the issue to status-in-dev manually.
4 tasks done
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
Fast-follow to #1684 (merged). The
/cso --diffaudit of the #1631 change found one LOW: the reserved-prefix hijack guard (operator_queue_service.py) was exact-match (req_id.startswith(_RESERVED_ID_PREFIXES)), so a prompt-injected agent could author an item with a lookalike id (Poison-x, uppercase/leading-space) that evaded the filter and appeared as a platform-styled operator alert with attacker text.poison-{execution_id}slot necessarily starts withpoison-and is rejected. Every evasion produces a different, non-colliding row. So this is operator-phishing polish, not a new capability (an agent can already author arbitrary queue items).strip().lower()) before the prefix check. The platform mints these prefixes lowercase and unpadded, so a normalized match can only be impersonation.This hardening was committed during the audit but stranded when #1684 squash-merged mid-
/cso; landing it on its own branch.Changes
src/backend/services/operator_queue_service.py—strip().lower().startswith(...)in the reserved-prefix guard.tests/unit/test_1631_operator_queue_agent_scoped_ids.py— newtest_reserved_prefix_guard_folds_case_and_whitespace(rejectsPoison-x,SYNC-FAILING-x,\tgit-bloat-x).docs/security-reports/cso-2026-07-18.md— the audit report.Test Plan
tests/unit/test_1631_operator_queue_agent_scoped_ids.py→6 passed(5 original + fold-case).Refs #1631. Hardening follow-up to #1684.
Generated with Claude Code