Evidencesanitize-html-176
{allowedTags:null} allows <script>
sanitize-html#176, at commit 0573fb6. A closed issue from a repository Credda did not choose.
LIVE2026-09-20
RIGHT_FAILUREexecuted against the upstream checkout.
- Outcome
- VERIFIED
- Wall time
- 85.2s
- 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
- #176
- Pinned commit
- 0573fb6c67c74e98726db0637a648961c90046cc
01The signal
The report, exactly as it was filed.
Nothing paraphrased or cleaned up. The mess is the thing under test.
{allowedTags:null} allows <script>
```js
'<script>alert(1)</script>' ==
sanitizeHtml(
'<script>alert(1)</script>',
{ allowedTags: null });
'<script>alert(1)</script>' ==
sanitizeHtml(
'<script>alert(1)</script>',
{ allowedTags: undefined });
```
The [docs](https://github.com/punkave/sanitize-html#what-if-i-want-to-allow-all-tags-or-all-attributes) say
> ### "What if I want to allow all tags or all attributes?"
>
> Simple! instead of leaving allowedTags or allowedAttributes out of the options, set either one or both to false:
>
> ```js
> allowedTags: false,
> allowedAttributes: false
> ```
The internal check checks whether `allowedTags` is falsey, not false.
Treating `null` equivalently to false is problematic since `null` is
much more likely as an output from a function that otherwise
returns an array than `false`, so treating `null` and `undefined`
as equivalent to `false` is a corner-case with very serious security consequences.
For example,
```js
const MY_POLICY = {
allowedTags: computeAllowedTags()
};
function computeAllowedTags() {
if (complexCondition) {
return INLINE_ELEMENTS;
} else if (anotherComplexCondition) {
return BLOCK_AND_INLINE_ELEMENTS;
} else if (adNauseam) {
return FORMATTING_ELEMENTS_AND_IMAGES;
}
// NOTE: Missing return at bottom implies return of undefined
}
```
Since the behavior for `undefined` and `null`, `0`, `NaN`, `""` and other falsey values is not documented, I recommend either
* changing the code that fils in blanks:
```js
options = extend(sanitizeHtml.defaults, options);
```
to first remove any properties with falsey, but non-false values.
* and/or change the falsey checks
```js
if (options.allowedTags && options.allowedTags.indexOf(name) === -1) {
```
to check for `false`:
```js
if (options.allowedTags !== false
&& (options.allowedTags || []).indexOf(name) === -1) {
```
and similarly for `allowedAttributes`.- Repository
- apostrophecms/sanitize-html
- Issue
- #176
- Commit
- 0573fb6c67c74e98726db0637a648961c90046cc
- Why this commit
- The first parent of the fix commit ba3a2f67e3fdcefb7212b8776111ad6f248b52cb, 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('<script>alert(1)</script>', { allowedTags: null }) produces '<script>alert(1)</script>'; the fix makes it produce ''.
- Expression
- sanitizeHtml('<script>alert(1)</script>', { allowedTags: null })
- Reported output
- '<script>alert(1)</script>'
- 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('<script>alert(1)</script>', { allowedTags: null }) //=> '<script>alert(1)</script>'`. The report sat in the REPL_NO_LITERAL_OUTPUT 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(
'<script>alert(1)</script>',
{ allowedTags: null })` still produces '<script>alert(1)</script>' (read <script>alert(1)</script>)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( '<script>alert(1)</script>', { allowedTags: null })` still produces '<script>alert(1)</script>' (read <script>alert(1)</script>) |
| right-failure | pass | Reproduced the reported failure: sanitizeHtml('<script>alert(1)</script>', { allowedTags: null }) produces '<script>alert(1)</script>'; the fix makes it produce ''. |
| 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 0573fb6, run the report through the CLI the way the study did.
git clone https://github.com/apostrophecms/sanitize-html git checkout 0573fb6c67c74e98726db0637a648961c90046cc npm install CREDDA_PROVIDER=heuristic \ npx tsx apps/cli/src/main.ts fix <repo-path> @<issue-file> --no-color