Skip to content

fix: rule bodies cannot forge domain headings in the rendered block - #535

Merged
REPPL merged 3 commits into
mainfrom
fix/rules-render-sanitize
Aug 27, 2026
Merged

fix: rule bodies cannot forge domain headings in the rendered block#535
REPPL merged 3 commits into
mainfrom
fix/rules-render-sanitize

Conversation

@REPPL

@REPPL REPPL commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

sanitizeRuleBody strips control characters (keeping newline and tab) and space-indents any '#'-leading line at the one rule-body render site, so a hostile rules.json cannot forge '## DOMAIN' headings or smuggle ANSI/control sequences into the injected context block — the rendered headings stay the injection contract host-side parsers rely on. Test written first and watched fail against the unpatched tree; the forgery corpus (newline, CRLF, U+2028/2029, ANSI, NUL, hash-at-start) is the regression suite. Ported from the tested adaptor-lab fix; the only change in transit was the post-org-rename module path.

Resolves iss-2608261550394120 in the same diff with fixing-commit provenance (--impact fix).

Assisted-by: Claude:claude-fable-5

REPPL added 3 commits August 27, 2026 18:15
renderDomain emitted rule bodies verbatim under the trusted '## NAME'
heading, so a hostile rules.json rule could start a line with '#' to
forge a domain heading, or smuggle control characters and ANSI escapes
into the injected context block. sanitizeRuleBody strips control
characters (keeping newline and tab) and indents any '#'-leading line
one space, so the rendered '## NAME' lines stay the only headings —
the injection contract host-side parsers rely on.

Ported from the tested fix developed in the adaptor-lab checkout
(2026-08-24/26 red-team rounds); the only change in transit is the
post-org-rename module path on the termsafe import. Test written
first and watched fail against the unpatched tree.

Assisted-by: Claude:claude-fable-5
Resolves: iss-2608261550394120
Assisted-by: Claude:claude-fable-5
@REPPL
REPPL enabled auto-merge August 27, 2026 18:50
@REPPL
REPPL added this pull request to the merge queue Aug 27, 2026
Merged via the queue into main with commit 312f20f Aug 27, 2026
11 checks passed
@REPPL
REPPL deleted the fix/rules-render-sanitize branch August 27, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant