Commit 88b3a53
committed
[APS-19078] fix CI: replace regex HTML strip with sanitize-html (CodeQL)
CodeQL flagged the `<script|iframe|object|embed>` regex in sanitizeCss as
"incomplete multi-character sanitization" (high severity x2 — src + dist).
A single-pass replace is bypassable by nested patterns like `<scr<script>ipt>`,
which collapse to `<script>` after one substitution.
Fix: strip ALL HTML tags from the rich-CSS payload via sanitize-html with
allowedTags: [] (the library iterates internally and is not bypassable).
The CSS-function regexes for `expression(...)` and `url(javascript:...)`
remain — they target CSS syntax, not HTML, and CodeQL did not flag them.
Verified:
- 18/18 unit tests pass (no regression)
- Sanity script confirms `<scr<script>ipt>` no longer leaves a `<script`
substring in the output
- Flagged regex literal absent from rebuilt dist/index.js
- Lint clean
Resolves: CodeQL failure on PR #851 parent 67f66ea commit 88b3a53
2 files changed
Lines changed: 16 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51127 | 51127 | | |
51128 | 51128 | | |
51129 | 51129 | | |
51130 | | - | |
| 51130 | + | |
| 51131 | + | |
| 51132 | + | |
| 51133 | + | |
| 51134 | + | |
51131 | 51135 | | |
51132 | 51136 | | |
51133 | | - | |
| 51137 | + | |
| 51138 | + | |
51134 | 51139 | | |
51135 | | - | |
51136 | | - | |
| 51140 | + | |
51137 | 51141 | | |
51138 | 51142 | | |
51139 | 51143 | | |
| |||
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
33 | 37 | | |
34 | 38 | | |
35 | | - | |
| 39 | + | |
| 40 | + | |
36 | 41 | | |
37 | | - | |
38 | | - | |
| 42 | + | |
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| |||
0 commit comments