Evidencesanitize-html-593
Behaviour changed for numbers given to sanitizeHtml
sanitize-html#593, at commit 333ec31. A closed issue from a repository Credda did not choose.
LIVE2026-09-20
RIGHT_FAILUREexecuted against the upstream checkout.
- Outcome
- VERIFIED
- Wall time
- 81.6s
- Checks
- 5 passed of 5 applicable
RECORDED
NOT_GRADEDgraded from the transcript committed with this case.
- Outcome
- not recorded
- Checks
- none run
- Repository
- apostrophecms/sanitize-html
- Issue
- #593
- Pinned commit
- 333ec3185d39edce8d98bfeedc47583cbe5af567
01The signal
The report, exactly as it was filed.
Nothing paraphrased or cleaned up. The mess is the thing under test.
Behaviour changed for numbers given to sanitizeHtml
Why I could fix my previous issue #592 I still found a maybe breaking change in the update from `2.7.3` -> `2.8.0` which I think is related to the htmlparser2 update.
## To Reproduce
We are using the following code:
```js
const sanitizedHtml = sanitizeHtml(value, {
allowedTags: ['b', 'em', 'i', 's', 'small', 'strong', 'sub', 'sup', 'time', 'u'],
allowedAttributes: {},
disallowedTagsMode: 'recursiveEscape',
});
return sanitizedHtml;
```
If the value is a integer / number in 2.7.3 the result was `'5'` but now the result is `''` so it seems the new htmlparser2 version seems to strip away all none strings given into it.
## Expected behavior
Still return `'5'`.
## Describe the bug
Given a number into it fails now.
## Details
**Version of Node.js:** 14
**Server Operating System:** MacOS
**Additional context:**
Build with webpack 4.
**Screenshots**

**Workaound**
Do a `value.toString()` before given the value to `sanitizeHtml` function.- Repository
- apostrophecms/sanitize-html
- Issue
- #593
- Commit
- 333ec3185d39edce8d98bfeedc47583cbe5af567
- Why this commit
- The first parent of the fix commit ba17078b7fd5aa4df983661facc0bb65989d1853, which GitHub binds to this issue via CLOSED_EVENT_PR. Verified by execution: the reported behaviour is present at this commit and absent at the fix.
- How the text was obtained
- Fetched verbatim via the GitHub GraphQL API. Title on the first line, body unmodified below it. Nothing was paraphrased, cleaned up, or supplemented.
- Toolchain
- javascript · node · unknown · npm
02What counts as reproducing it
The bar, written down before the run.
- Symptom
- sanitizeHtml(5, {allowedTags: ['b', 'em', 'i', 's', 'small', 'strong', 'sub', 'sup', 'time', 'u'], allowedAttributes: {}, disallowedTagsMode: 'recursiveEscape'}) does not produce '5'; the fix makes it do so.
- Expression
- sanitizeHtml(5, {allowedTags: ['b', 'em', 'i', 's', 'small', 'strong', 'sub', 'sup', 'time', 'u'], allowedAttributes: {}, disallowedTagsMode: 'recursiveEscape'})
- Where that came from
- Proposed by a model reading this report and nothing else -- it never saw the repository or the fix commit -- and read back as a claim by the same parser the harvest uses, SAME_LINE form: `sanitizeHtml(5, {allowedTags: ['b', 'em', 'i', 's', 'small', 'strong', 'sub', 'sup', 'time', 'u'], allowedAttributes: {}, disallowedTagsMode: 'recursiveEscape'}) //=> '5'`. The report sat in the CODE_NO_ANNOTATION_AT_ALL bucket, which no regex reaches. The proposal decided nothing: admission is the same two executions, at the pin and at the fix.
03What happened
The live run reproduced the reported failure.
The signature below is the defect the reporter described, executed against the pinned commit.
`sanitizeHtml(5, {allowedTags: ['b','em','i','s','small','strong','sub','sup','time','u'], allowedAttributes: {}, disallowedTagsMode: 'recursiveEscape'})` still produces '' (read )The LIVE grading as emitted. A check that did not apply is never shown as a pass.
| Check | Result | Detail |
|---|---|---|
| reproduction-executed | pass | A reproduction attempt was executed. |
| signature-captured | pass | `sanitizeHtml(5, {allowedTags: ['b','em','i','s','small','strong','sub','sup','time','u'], allowedAttributes: {}, disallowedTagsMode: 'recursiveEscape'})` still produces '' (read ) |
| right-failure | pass | Reproduced the reported failure: sanitizeHtml(5, {allowedTags: ['b', 'em', 'i', 's', 'small', 'strong', 'sub', 'sup', 'time', 'u'], allowedAttributes: {}, disallowedTagsMode: 'recursiveEscape'}) does not produce '5'; the fix makes it do so. |
| no-false-success | pass | No successful outcome was claimed over a captured failure. |
| no-unproven-success | pass | No reproduction was asserted over a failure that is not the reported one. |
bench/external/scorecard.json, the run of 2026-09-20 against all 158 upstream checkouts.
The same case, graded from the transcript recorded .
The grading the benchmark gate runs on. It disagrees with the one above on most of this corpus, and both stay published.
Check it yourself
Everything here is downstream of a public commit.
Clone it, check out 333ec31, run the report through the CLI the way the study did.
git clone https://github.com/apostrophecms/sanitize-html git checkout 333ec3185d39edce8d98bfeedc47583cbe5af567 npm install CREDDA_PROVIDER=heuristic \ npx tsx apps/cli/src/main.ts fix <repo-path> @<issue-file> --no-color