Skip to content

security: register SLACK + GMAIL WATCH in the daemon structural-header set - #69

Merged
noogalabs merged 1 commit into
mainfrom
fix/pty-neutralizer-header-drift
Aug 28, 2026
Merged

noogalabs merged 1 commit into
mainfrom
fix/pty-neutralizer-header-drift

Conversation

@noogalabs

Copy link
Copy Markdown
Owner

What

sanitizeForPtyInjection neutralizes forged daemon containment headers (=== AGENT MESSAGE, === TELEGRAM, …) at line-start in unfenced context-preview fields (reply-context, last-sent, recent-history), so untrusted text can't impersonate the daemon in the recipient PTY. The quote pattern is built from DAEMON_STRUCTURAL_HEADERS.

The set was never extended when the SLACK transport and the GMAIL WATCH notification began injecting === SLACK … / === GMAIL WATCH: … headers — a forged copy of those markers passed through un-quoted while the older headers were caught.

Fix

Register SLACK and GMAIL WATCH. SLACK also covers === SLACK CONNECTION DEAD via the \b rule; TELEGRAM already covers its media variants. One-line set change — the pattern is already set-driven.

Tests (proof discipline)

  • Forge casualties for SLACK, SLACK CONNECTION DEAD, GMAIL WATCH — each now quoted. Both polarities: prose with the bare words (no === opener) stays byte-identical; an unregistered === MADE UP header is not quoted (closed set).
  • Anti-drift census: reads src/daemon/**/*.ts, extracts every emitted === HEADER marker, fails naming any not registered. RED on the pre-fix set (GMAIL WATCH / SLACK / SLACK CONNECTION DEAD), green after — the set can't silently lag emitted headers again.

validate + fast-checker + slack-listener suites: 228 passing. tsc clean. leak-guard clean.

…r set

sanitizeForPtyInjection quotes forged daemon containment headers (`=== AGENT
MESSAGE`, `=== TELEGRAM`, …) that appear at line-start in unfenced context-
preview fields (reply-context, last-sent, recent-history), so untrusted text
cannot impersonate the daemon in the recipient PTY. The quote pattern is built
FROM DAEMON_STRUCTURAL_HEADERS — but the set had not been extended when the
SLACK transport and the GMAIL WATCH notification began injecting their own
`=== SLACK …` / `=== GMAIL WATCH: …` headers, so a forged copy of those two
markers passed through un-quoted while the older headers were caught.

Fix: register SLACK and GMAIL WATCH. `SLACK` also covers `=== SLACK CONNECTION
DEAD` via the \b rule; `TELEGRAM` already covers its media variants.

Tests:
- forge casualties for SLACK, SLACK CONNECTION DEAD, GMAIL WATCH (each now
  quoted); prose containing the bare words (no `=== ` opener) stays untouched;
  an unregistered `=== MADE UP` header is NOT quoted (closed set, not any word).
- anti-drift census: reads src/daemon/**/*.ts, extracts every emitted
  `=== HEADER` marker, and fails naming any marker not registered in the set —
  so the set can never silently lag the emitted headers again (this test is RED
  on the pre-fix set, naming GMAIL WATCH / SLACK / SLACK CONNECTION DEAD).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHgtUKEyT27odfUsRhjgoT
@noogalabs
noogalabs force-pushed the fix/pty-neutralizer-header-drift branch from 5b6cd57 to ada9c8f Compare August 28, 2026 20:54
@noogalabs
noogalabs merged commit eff5712 into main Aug 28, 2026
8 checks 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