Skip to content

docs: document runtime DOM mutation breaking verification#2

Merged
jt55401 merged 1 commit into
mainfrom
docs/runtime-dom-mutation-known-issue
May 14, 2026
Merged

docs: document runtime DOM mutation breaking verification#2
jt55401 merged 1 commit into
mainfrom
docs/runtime-dom-mutation-known-issue

Conversation

@jt55401
Copy link
Copy Markdown
Contributor

@jt55401 jt55401 commented May 14, 2026

Summary

Adds a Known Issue section to the spec README documenting a real, general challenge for any content-signing protocol that targets browser-side verification:

  • HTMLTrust signs the static HTML
  • Browser verifiers read the live DOM (post-JS)
  • If anything mutates content inside a <signed-section> between page load and verification, the recomputed hash won't match → invalid

We hit this on the project website itself: the Hugo Blox docs theme injects a copy button into every <pre> block at runtime. The signer never saw the button; the verifier did.

Documents:

  • Concrete cases observed
  • Mitigations available today
  • Open spec design question (likely a data-htmltrust-ignore mutation-skip marker)

Also referenced from the website FAQ (separate PR).

🤖 Generated with Claude Code

HTMLTrust signs the static HTML that leaves the publishing pipeline.
Browser verifiers, however, read the live DOM — i.e. after every
script on the page has finished running. If a script mutates content
inside a <signed-section> at runtime (theme-injected copy buttons,
client-side syntax highlighters, lazy-loaders, share widgets), the
verifier's recomputed content-hash will not match the signed one,
and the signature is reported as invalid even though it is
cryptographically correct.

Adds a "Known Issue: Runtime DOM Mutation Breaks Verification"
section to the spec README documenting:

  - Concrete cases observed (most recently: Hugo Blox docs theme
    injecting <button class="copy-button">Copy</button> into every
    <pre> block, which the signer never saw)
  - Mitigations available today (don't inject into signed regions,
    pre-render decoration server-side, move decoration outside the
    signed region, or verify against pristine HTML rather than DOM)
  - Open spec question: Stage 1 canonicalization likely needs an
    explicit "skip-on-mutation-marker" mechanism (e.g.,
    data-htmltrust-ignore="true" on a subtree) plus authoring and
    verifier guidance.

This is tracked as an active open design question.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jt55401 jt55401 force-pushed the docs/runtime-dom-mutation-known-issue branch from 837eff5 to 6759527 Compare May 14, 2026 01:53
@jt55401 jt55401 merged commit d078b8c into main May 14, 2026
1 check passed
@jt55401 jt55401 deleted the docs/runtime-dom-mutation-known-issue branch May 14, 2026 01:56
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