fix(docs): sanitize the HTML the schema-driven tables inject - #12304
Conversation
Contributor
Author
|
This pull request is part of a Mergify stack:
|
Contributor
Merge Protections🔴 3 of 7 protections blocking · waiting on 👀 reviews and ⛓️ dependency
🔴 ⛓️ Depends-On RequirementsWaiting for
This rule is failing.Requirement based on the presence of
🔴 👀 Review RequirementsWaiting for
This rule is failing.
🔴 🔎 ReviewsWaiting for
This rule is failing.
Show 4 satisfied protections🟢 🤖 Continuous Integration
🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 📕 PR description
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
kozlek
force-pushed
the
devs/kozlek/devs/kozlek/batch-status-data-type/read-documented-enum-values-one-shared-reader--e539de06
branch
from
August 5, 2026 13:05
3c3d836 to
f747840
Compare
kozlek
force-pushed
the
devs/kozlek/devs/kozlek/batch-status-data-type/sanitize-html-schema-driven-tables-inject--ce1642f8
branch
from
August 5, 2026 13:05
4455148 to
87b0bd3
Compare
Contributor
Author
Revision history
|
kozlek
marked this pull request as ready for review
August 5, 2026 13:40
kozlek
force-pushed
the
devs/kozlek/devs/kozlek/batch-status-data-type/read-documented-enum-values-one-shared-reader--e539de06
branch
from
August 5, 2026 13:52
f747840 to
4b1ec1f
Compare
kozlek
force-pushed
the
devs/kozlek/devs/kozlek/batch-status-data-type/sanitize-html-schema-driven-tables-inject--ce1642f8
branch
from
August 5, 2026 13:52
87b0bd3 to
08912d8
Compare
`renderMarkdown` output goes straight into `dangerouslySetInnerHTML` in six tables, and it did not filter URL protocols: `remark-rehype` emits an `<a>` for any link target whatever its scheme, so a `javascript:` link in a synced description would have rendered as a live link. Raw HTML was never a way in — `remark-rehype` runs without `allowDangerousHtml`, so it is discarded before becoming a node — which makes URL filtering the whole of what `rehype-sanitize` adds here. It sits after `rehype-raw` so that if a caller ever does enable `allowDangerousHtml`, the embedded markup is parsed and then sanitized rather than passed through opaque. Every input today is first-party: descriptions generated by our own engine and delivered by our own sync bot. So this is defence in depth rather than a live exposure — but "the input is trustworthy" is a property of the six current callers, not of the function, and the output lands somewhere that makes the distinction expensive to get wrong later. The tests separate the two guarantees on purpose. Asserting all four cases together would have been misleading: three of them pass with the sanitizer removed, because they test the markdown pipeline discarding raw HTML rather than anything the sanitizer does. Only the URL-protocol cases fail if it goes. Output is unchanged across every description the two schemas publish. Part of MRGFY-8330 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Change-Id: Ice1642f855d6698b65a034e398affbce16f822a6
kozlek
force-pushed
the
devs/kozlek/devs/kozlek/batch-status-data-type/read-documented-enum-values-one-shared-reader--e539de06
branch
from
August 5, 2026 14:01
4b1ec1f to
b5e84ba
Compare
kozlek
force-pushed
the
devs/kozlek/devs/kozlek/batch-status-data-type/sanitize-html-schema-driven-tables-inject--ce1642f8
branch
from
August 5, 2026 14:01
08912d8 to
452a467
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
renderMarkdownoutput goes straight intodangerouslySetInnerHTMLinsix tables, and it did not filter URL protocols:
remark-rehypeemits an<a>for any link target whatever its scheme, so ajavascript:link ina synced description would have rendered as a live link.
Raw HTML was never a way in —
remark-rehyperuns withoutallowDangerousHtml, so it is discarded before becoming a node — whichmakes URL filtering the whole of what
rehype-sanitizeadds here. Itsits after
rehype-rawso that if a caller ever does enableallowDangerousHtml, the embedded markup is parsed and then sanitizedrather than passed through opaque.
Every input today is first-party: descriptions generated by our own
engine and delivered by our own sync bot. So this is defence in depth
rather than a live exposure — but "the input is trustworthy" is a
property of the six current callers, not of the function, and the output
lands somewhere that makes the distinction expensive to get wrong later.
The tests separate the two guarantees on purpose. Asserting all four
cases together would have been misleading: three of them pass with the
sanitizer removed, because they test the markdown pipeline discarding raw
HTML rather than anything the sanitizer does. Only the URL-protocol cases
fail if it goes.
Output is unchanged across every description the two schemas publish.
Part of MRGFY-8330
Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com
Depends-On: #12293