fix(security): harden replaceMarkers() to catch space/underscore boundary marker variants#35983
Conversation
Greptile SummaryThis PR hardens Key changes and observations:
Confidence Score: 4/5
Last reviewed commit: 49cd807 |
965a8d2 to
acffbb9
Compare
…dary marker variants The sanitization regex only matched EXTERNAL_UNTRUSTED_CONTENT (underscore) but not EXTERNAL UNTRUSTED_CONTENT (space). The LLM interprets both as valid boundary markers, enabling a tag-escape sandwich bypass. - Add [\s_]+ between words in marker match regexes and early-exit check - Add \s* after <<< to handle whitespace padding - Add missing Unicode homoglyphs U+02C2 and U+02C3 to ANGLE_BRACKET_MAP and foldMarkerText() regex
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2e51ea1a58
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const CronFailoverReasonSchema = Type.Union([ | ||
| Type.Literal("auth"), | ||
| Type.Literal("format"), | ||
| Type.Literal("rate_limit"), | ||
| Type.Literal("billing"), |
There was a problem hiding this comment.
Expand cron failover enum to include all emitted reasons
applyJobResult now persists state.lastErrorReason via resolveFailoverReasonFromError, which can classify errors as overloaded, auth_permanent, or session_expired in addition to the values listed here, so this schema can become invalid after real provider failures (for example 529 overload responses). Any client or boundary that validates cron payloads against CronJobStateSchema will then reject cron.list/cron.status data, so the enum needs to include the full failover-reason set used by the classifier.
Useful? React with 👍 / 👎.
2e51ea1 to
ff07dc4
Compare
|
Merged via squash.
Thanks @urianpaul94! |
…dary marker variants (openclaw#35983) Merged via squash. Prepared head SHA: ff07dc4 Co-authored-by: urianpaul94 <33277984+urianpaul94@users.noreply.github.com> Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com> Reviewed-by: @frankekn
* main: (43 commits) docs: add openclaw#42173 to CHANGELOG — strip leaked model control tokens (openclaw#42216) Agents: align onPayload callback and OAuth imports docs: add Tengji (George) Zhang to maintainer table (openclaw#42190) fix: strip leaked model control tokens from user-facing text (openclaw#42173) Changelog: add unreleased March 9 entries chore: add .dev-state to .gitignore (openclaw#41848) fix(agents): avoid duplicate same-provider cooldown probes in fallback runs (openclaw#41711) fix(mattermost): preserve markdown formatting and native tables (openclaw#18655) feat(acp): add resumeSessionId to sessions_spawn for ACP session resume (openclaw#41847) ACPX: bump bundled acpx to 0.1.16 (openclaw#41975) mattermost: fix DM media upload for unprefixed user IDs (openclaw#29925) fix(msteams): use General channel conversation ID as team key for Bot Framework compatibility (openclaw#41838) fix(mattermost): read replyTo param in plugin handleAction send (openclaw#41176) fix(sandbox): pass real workspace to sessions_spawn when workspaceAccess is ro (openclaw#40757) fix(ui): replace Manual RPC text input with sorted method dropdown (openclaw#14967) CI: select Swift 6.2 toolchain for CodeQL (openclaw#41787) fix(agents): forward memory flush write path (openclaw#41761) fix(telegram): move network fallback to resolver-scoped dispatchers (openclaw#40740) fix(security): harden replaceMarkers() to catch space/underscore boundary marker variants (openclaw#35983) fix(web-search): recover OpenRouter Perplexity citations from message annotations (openclaw#40881) ...
…dary marker variants (openclaw#35983) Merged via squash. Prepared head SHA: ff07dc4 Co-authored-by: urianpaul94 <33277984+urianpaul94@users.noreply.github.com> Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com> Reviewed-by: @frankekn
…dary marker variants (openclaw#35983) Merged via squash. Prepared head SHA: ff07dc4 Co-authored-by: urianpaul94 <33277984+urianpaul94@users.noreply.github.com> Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com> Reviewed-by: @frankekn
…dary marker variants (openclaw#35983) Merged via squash. Prepared head SHA: ff07dc4 Co-authored-by: urianpaul94 <33277984+urianpaul94@users.noreply.github.com> Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com> Reviewed-by: @frankekn
…dary marker variants (openclaw#35983) Merged via squash. Prepared head SHA: ff07dc4 Co-authored-by: urianpaul94 <33277984+urianpaul94@users.noreply.github.com> Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com> Reviewed-by: @frankekn
…dary marker variants (openclaw#35983) Merged via squash. Prepared head SHA: ff07dc4 Co-authored-by: urianpaul94 <33277984+urianpaul94@users.noreply.github.com> Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com> Reviewed-by: @frankekn
…dary marker variants (openclaw#35983) Merged via squash. Prepared head SHA: ff07dc4 Co-authored-by: urianpaul94 <33277984+urianpaul94@users.noreply.github.com> Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com> Reviewed-by: @frankekn
…dary marker variants (openclaw#35983) Merged via squash. Prepared head SHA: ff07dc4 Co-authored-by: urianpaul94 <33277984+urianpaul94@users.noreply.github.com> Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com> Reviewed-by: @frankekn
…dary marker variants (openclaw#35983) Merged via squash. Prepared head SHA: ff07dc4 Co-authored-by: urianpaul94 <33277984+urianpaul94@users.noreply.github.com> Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com> Reviewed-by: @frankekn
Summary
enabling tool invocation from untrusted email.
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
None
User-visible / Behavior Changes
None. Marker sanitization is internal — legitimate emails and webhook content are unaffected.
Security Impact (required)
Repro + Verification
Environment
Steps
Expected
Fake markers should be replaced with [[MARKER_SANITIZED]] / [[END_MARKER_SANITIZED]]
Actual
Fake markers pass through unsanitized. LLM executes tool calls from the attacker's injected "trusted" section. Confirmed: memory_search invoked on Opus 4.6 (session 10611111), full RCE on Gemini 2.5 Flash (session
93b7df6c).
Evidence
Human Verification (required)
Compatibility / Migration
Failure Recovery (if this breaks)
Risks and Mitigations
Credits
Reported by CrowdStrike (Donato Onofri & Paul Urian) via responsible disclosure