NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · npm

CVE-2026-65903: DOMPurify's ADD_TAGS function form bypasses FORBID_TAGS due to short-circuit evaluation

mediumCVSS 4.0 5.3GHSA-39q2-94rc-95cp

Summary In src/purify.ts:1117-1123, ADDTAGS as a function (via EXTRAELEMENTHANDLING.tagCheck) bypasses FORBIDTAGS due to short-circuit evaluation. The condition: When tagCheck(tagName) returns true, the entire condition is false and the element is kept — FORBIDTAGS[tagName] is never evaluated.

Published Apr 16, 2026 · Updated Jul 23, 2026

Affected packages

dompurify

Ecosystem
npm
Affected
<= 3.3.3
Fixed in
3.4.0
Check
npm ls dompurify

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

Summary

In src/purify.ts:1117-1123, ADD_TAGS as a function (via EXTRA_ELEMENT_HANDLING.tagCheck) bypasses FORBID_TAGS due to short-circuit evaluation.

The condition:

!(tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])

When tagCheck(tagName) returns true, the entire condition is false and the element is kept — FORBID_TAGS[tagName] is never evaluated.

Inconsistency

This contradicts the attribute-side pattern at line 1214 where FORBID_ATTR explicitly wins first:

if (FORBID_ATTR[lcName]) { continue; }

For tags, FORBID should also take precedence over ADD.

Impact

Applications using both ADD_TAGS as a function and FORBID_TAGS simultaneously get unexpected behavior — forbidden tags are allowed through. Config-dependent but a genuine logic inconsistency.

Suggested Fix

Check FORBID_TAGS before tagCheck:

if (FORBID_TAGS[tagName]) { /* remove */ }
else if (tagCheck(tagName) || ALLOWED_TAGS[tagName]) { /* keep */ }

Affected Version

v3.3.3 (commit 883ac15)

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology

More npm vulnerabilities

All npm entries