Repository navigation
refactor(html): move the sanitiser into crates/core/html - #300
Merged
Merged
Conversation
The use-cases have to clean a work item's description (issue #48: one path for compat and v1), and scripts/check-layout.sh rule 4 forbids crates/core from depending on thrust-editor-doc. So the sanitiser becomes its own crate inside core/: thrust-html, on ammonia only (floor 4.2.5, the RUSTSEC-2026-0533 fix and the 4.1+ D-019 needs). No behaviour change. - git mv crates/editor/doc/src/sanitize.rs crates/core/html/src/lib.rs, so history follows the file. - thrust-editor-doc keeps `thrust_editor_doc::sanitize` as a re-export behind its `sanitize` feature. - thrust-compat-plane and thrust-api-v1 depend on thrust-html directly; they used nothing else of thrust-editor-doc. - The file opts into the workspace panic lints, as the other core crates do: the indexing and the one unwrap in strip_once, tag_end, url_ok and validate_binary_data become get/first/bytes().enumerate(). - The two tests that need no editor schema move with the code; the ones that parse with it, or compare with nh3, stay in thrust-editor-doc. - Wiring: workspace member and dependency, release-plz (member entry, changelog_include, first-release tag pattern), check-deps CLEAN_CRATES, core and editor READMEs, crates.md, features.md, and the ammonia-400 probe's include path. Shown unchanged: examples/sanitize_check over the 431 corpus inputs writes byte-identical output (clean, stripped and hardened) before and after; with the closing-tag test of strip_once mutated, the same comparison differs at byte 1291. Refs: #48 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
aRustyDev
temporarily deployed
to
preview-control-plane
November 18, 2026 05:06 — with
GitHub Actions
Inactive
Merged
This was referenced Nov 18, 2026
Merged
This branch was previously deployed
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.
Part 1 of 3 for #48 (the work-item half). This one moves code and changes no behaviour; the hardened default is PR 2, and storing
description_strippedthrough the use-cases is PR 3.Why
#48 wants one sanitise path for compat and
/api/v1, in the use-case layer.crates/coremay not depend onthrust-editor-doc:scripts/check-layout.shrule 4 refuses any normal or build dependency fromcore/on a crate outside it. So the sanitiser has to live insidecore/before the use-cases can call it.What changes
thrust-htmlatcrates/core/html/, depending onammonia = "4.2.5"only. The floor is the release that patches RUSTSEC-2026-0533 (the lockfile moved there in fix(deps): bump ammonia to 4.2.5 for RUSTSEC-2026-0533 #147; the manifest still allowed4, so a fresh resolve could have picked 4.0.0, which D-019 rules out).git mvofsanitize.rstocrates/core/html/src/lib.rs, so history follows the file.thrust_editor_doc::sanitizestill resolves: it is nowpub use thrust_html as sanitize, behind the samesanitizefeature.thrust-compat-planeandthrust-api-v1depend onthrust-htmldirectly. They used nothing else ofthrust-editor-doc, and the three call sites change by their path only.[lints] workspace = true, likethrust-portsandthrust-core). Nine sites indexed or unwrapped (strip_once,tag_end,url_ok,validate_binary_data); they are nowget,first,is_some_andandbytes().enumerate(), with the same results on every input that was reachable.validate_html_content_semantics,unsanitised_payload_is_caught) because they need no editor schema. The tests that parse with the schema or compare with nh3 stay inthrust-editor-doc.release-plz.toml(member entry,changelog_include, the first-release tag pattern thedepsjob requires for a crate not in v0.2.0),CLEAN_CRATESincheck-deps.sh, thecore/andeditor/READMEs,crates.md,features.md, and theprobes/ammonia-400include path.Checked
examples/sanitize_checkover the 431 corpus inputs (the 169 entries of the XSS corpus plus the editor documents), before and after, all three forms (clean,stripped,hardened)cmp)strip_oncemutated (</p>no longer read as a tag)cargo nextest runonthrust-html,thrust-editor-doc,thrust-compat-plane,thrust-api-v1oracle_tests); both moved tests ran inthrust-html, andallow_list_preservation_of_editor_htmlstill runs inthrust-editor-doccargo clippywith-D warnings: workspace (every target),thrust-workerandthrust-edgeon wasm32,thrust-api-v1withopenapi; each with--lockedaslint.ymlhas itcargo fmt --all --check,cargo deny --locked checkcheck-deps.shthrust-htmlinCLEAN_CRATES, no forbidden cratecheck-layout.shand--self-testcheck-cargo-lock.shand--self-testcheck-release-plz.py --first-release requiredcheck-plane-500.sh,cargo test --docon the four cratesNot shown
oracle_v1_write_with_sanitiser_matches_python_plus_jswas not run (it needs the generated spike-0006 output); PR 2 pinsplane_builder()in it.thrust-html's own tests are two, and the real coverage ofstrip_tagsand the filters is what PR 2 adds (a generated test and the nine-class test). A run now would only measure what is missing.depsjob steps that read nothing I changed (topology, edge config, placement, migration lint, flagship, workflow lint, actionlint, OpenAPI diff) were not run locally.Left alone
clippyprints cargo manifest warnings that were there before (missing[lints]in other crates;base64is unused bythrust-editor-doc's library, as it was before, since the moved file never used it).docs/src/testing/status.md's inventory is a dated snapshot (it says 12 default-profile tests; the run is 1646), so I did not touch it. PR 2 adds its entries.Refs #48
🤖 Generated with Claude Code