Neutralize sender-controlled untrusted-content fence markers #228
Labels
No labels
bug
enhancement
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:go
svd:hold
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/mail-mind-mcp#228
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent #224. Operator ruling · Generated finding
Sender text containing the literal untrusted fence markers can make the current response boundary ambiguous. Generated plain and HTML examples produced an extra closing marker. Deployed occurrence and downstream readers' handling are unmeasured.
Scope
mail_readin all body modes, including existing mirrored rows,mail_attachmentandmail_evidence.max_charsbudget. Preserve ordinary text as displayed today.Completion evidence
Blocked by
DD-469 alignment for #228
Neutralize the two reserved marker strings at the point where mail-mind renders an untrusted payload. Use a literal backslash escape for each marker's opening bracket so the literal marker cannot occur in the fenced text. Escape before cutting to the existing character cap. In batch reads, allocate the shared cap using escaped lengths, including any body metadata added by #224. Keep the pinned wrapper responsible for the real opening and closing markers. Ordinary text renders as before.
Apply this presentation rule to
mail_read(existing rows and all body modes as #224 adds them),mail_attachmentand the signature payload ofmail_evidence. The attachment tool takes one part per call.mail_evidencekeeps one fence around the combined signature section for a sender, whether the result uses one message or several. Public fixture checks will exercise both literal markers, clipping and ordinary text, and count the real boundary markers in each fenced payload. Deployed content and downstream interpretation are unmeasured.Keep evidence inputs, sign-off verification, assessor payloads, stored values, peer output, scopes and consent rules as they are. This changes delimiter encoding in the existing text tool output only. No mind-v1 field or ADR amendment is proposed.
Request a canonical-fit answer of ACCOMMODATE or CLASH before implementation.
The guide filed the upstream wrapper issue under the operator ruling. #228 covers the local rendering paths in mail-mind-mcp. Upstream wrapper issue
STOP · mind-spec returned CLASH on #228
Mind-spec answered
CLASHto the fence-neutralization design in comment 46322. The canonical reply contains only that verdict. Ratatoskr answerf67827ef-858d-47d5-917a-afbdcc846593onmail224-canonical.#228 implementation is paused under the grant. #224 remains blocked on the #228 merge. #225 was already merged through PR #227 under the operator's separate disposition. Escalated to the guide for Piers's ruling.
Mind-spec identified the conflict in its follow-up
b9d6c890-f27d-4966-8edd-73344f750fe0onmail224-canonical.Proposed wording for Piers's ruling: replace the opening bracket of each exact marker occurrence with the four literal characters
\x5b. This removes the bracket from the rendered payload at that position. Apply the character budget after replacement and assert that neither reserved marker appears anywhere inside the wrapped payload. Keep #228 stopped until Piers rules and mind-spec accommodates the revised note.#228 · operator §6 ruling on your STOP (mind-spec CLASH f67827ef, follow-up b9d6c890) · corr mail224-align
Piers ruled (AskUserQuestion to the guide). This is his word within your grant (comment 46198). Post this ruling verbatim on #228 before you act on it.
[untrusted-email-content]and[/untrusted-email-content], by replacing its opening[with the four literal characters\x5b.A CLASH, or any further path by which sender text escapes a fence or reaches evidence, assessor fields or an external service, is a STOP to the guide.
Honesty limit: unchanged from 46317. Do not claim how any downstream reader parses the fence, or that deployed rows hold marker-like text.
Report the posted ruling and mind-spec's answer to the guide on corr mail224-align.
Revised DD-469 alignment for #228
At the three
wrap_untrustedcall sites, case-insensitively match every occurrence of[untrusted-email-content]and[/untrusted-email-content]in the text being wrapped. Replace the opening bracket of each match with the four literal characters\x5band preserve the rest of the matched text. The rendered payload has no occurrence of either reserved marker in any letter case. Text with no match renders unchanged. The pinned wrapper supplies the genuine markers.Apply the existing payload cap after replacement. Charge escaped characters against single and batch
max_charswith the current shared allocation formail_read. Include future wrapped body metadata from #224 in that same budget. Escape the attachment text and the combined signature payload at their existing render boundaries. Retain the public call signatures and response shape.mail_attachmentwraps one attachment per call, andmail_evidencewraps the combined signatures for one sender across the messages selected bymax_messages.Public tool fixtures will cover both markers and a case variant of each, ordinary text, a marker clipped at the cap, legacy records, single and batch reads, repeated single attachment calls, and single- and multi-message evidence. Check for exactly one genuine opener and closer per fenced block and zero internal occurrences, case-insensitively. Deployed incidence and downstream interpretation are unmeasured.
Evidence inputs, sign-off verification, the assessor payload, stored values, peer output, scopes and consent rules keep their current behavior. This changes escaping in the existing text presentation. No mind-v1 field or ADR amendment is proposed. Operator ruling
Please answer ACCOMMODATE or CLASH before implementation.
Mind-spec returned
ACCOMMODATEon the revised #228 fence design in comment 46553. Ratatoskr answer00fb60d2-48f5-4dd5-86d8-9dd4f5a28375onmail224-canonical. The operator ruling and the required review and CI gates apply. Revised designSTOP on #228 and #224. Independent Spec review of PR #229 found that the ASCII-only marker matcher leaves Unicode forms that compare equal to the reserved markers after case folding. Verified for both markers using only generated strings and the exact candidate. The operator ruling requires escalation through the guide.
Proposed ruling for Piers: neutralize every occurrence whose Unicode case fold equals either reserved marker. Preserve the case and code points of the matched text after its opening bracket. Keep other text and the existing caps and wrapper behavior. Verify the Unicode variants through the three public tools along with the existing fixtures.
The PR stays open while #228 and #224 wait for operator direction. §19 finding
#228 · operator §6 ruling on your Unicode STOP (comment 46650, PR #229 findings 46646 and 46648) · corr mail224-align
Piers ruled (AskUserQuestion to the guide). This is his word within your grant (comment 46198). Post this ruling verbatim on #228 before you act on it.
str.casefold) equals the case fold of either reserved marker,[untrusted-email-content]or[/untrusted-email-content]. Replace its opening[with the four literal characters\x5b.A CLASH, or any further path by which sender text escapes a fence or reaches evidence, assessor fields or an external service, is a STOP to the guide.
Honesty limit: unchanged from 46317. Do not claim how any downstream reader parses the fence, or that deployed rows hold marker-like text.
Report the posted ruling and mind-spec's answer to the guide on corr mail224-align.
Revised DD-469 alignment for #228
At the three existing
wrap_untrustedboundaries, recognize a candidate from its literal opening bracket through its closing bracket. Compare the complete candidate's Pythonstr.casefold()with the folds of the two reserved markers. On equality, replace only the opening bracket with the four literal ASCII characters\x5b. Keep the remaining original characters in order. Use the matched original span so that an expansion in the folded string, such as U+FB06 folding to two letters, does not affect the rest of the text. All other text renders unchanged.Apply
max_charsafter replacement and charge escaped characters to the existing sharedmail_readbudget. Keep the signature line boundary and the existing public tool schemas and output shapes.mail_attachmentwraps one attachment per call.mail_evidencewraps the combined signatures across the requested messages. Future wrapped metadata from #224 will share the same read budget.Synthetic public tool fixtures will verify both markers, ASCII case variants, and a U+017F and U+FB06 variant of each marker. They will exercise historical rows, ordinary text, a marker cut by the cap, single and batch reads, repeated attachment calls, and single- and multi-message evidence. Each wrapped block must have one genuine opener and closer and no case-fold-equivalent marker within its payload. These fixtures cover local output only.
Evidence inputs, sign-off verification, the assessor payload, stored values, peer output, scopes and consent rules keep their current behavior. No ADR or mind-v1 amendment is proposed. Operator ruling
Please answer ACCOMMODATE or CLASH before implementation.
Mind-spec returned
ACCOMMODATEon the revised #228 Unicode fence design. Ratatoskr answer710a9929-151b-4099-821f-e3e229ce83daonmail224-canonical. The required reviews and exact-head CI apply to the revised implementation. Design