Skip to content

harden(security): sanitize the mailbox label at the SNBT sink - #3

Merged
k33bz merged 1 commit into
mainfrom
hardening/escape-snbt
Jul 14, 2026
Merged

k33bz merged 1 commit into
mainfrom
hardening/escape-snbt

Conversation

@k33bz

@k33bz k33bz commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Sanitize the mailbox label at the SNBT sink (defense-in-depth)

escapeSnbtString (the only user string reaching postbox's op-level summon text_display) escaped " and \ but passed control characters and legacy section-sign (§) codes through. Those can't be in a username today, but the escaper shouldn't depend on upstream validation staying correct — an alternate name path, a display-name mod, or offline-mode spoofing would each make it a live injection with nothing to catch it.

Now it drops control chars + § and escapes \/", robust to any input. Mirrors the sanctuary sink hardening; grieflog/ropes already do this.

Verified: ./gradlew build green on main.

Draft — defense-in-depth hardening, opened for your review.

Defense-in-depth: escapeSnbtString now drops control characters and legacy
section-sign (U+00A7) formatting codes in addition to escaping backslash/quote,
so a mailbox owner name is safe in the op-level `summon text_display` label
regardless of whether upstream username validation blocks those characters (a
login-validation regression, an alternate name path, or offline-mode spoofing
must not turn this into a live injection). Same rationale as the sanctuary sink
hardening.

Verified: gradlew build green on main.
@k33bz
k33bz marked this pull request as ready for review July 14, 2026 13:57
@k33bz
k33bz merged commit b4c638c into main Jul 14, 2026
1 check passed
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