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.
Affected Version
v3.3.3 (commit 883ac15)
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.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Check FORBID_TAGS before tagCheck:
if (FORBID_TAGS[tagName]) { /* remove */ }
else if (tagCheck(tagName) || ALLOWED_TAGS[tagName]) { /* keep */ }
Frequently Asked Questions
- What is GHSA-39Q2-94RC-95CP? GHSA-39Q2-94RC-95CP is a medium-severity security vulnerability in dompurify (npm), affecting versions <= 3.3.3. It is fixed in 3.4.0.
- Which versions of dompurify are affected by GHSA-39Q2-94RC-95CP? dompurify (npm) versions <= 3.3.3 is affected.
- Is there a fix for GHSA-39Q2-94RC-95CP? Yes. GHSA-39Q2-94RC-95CP is fixed in 3.4.0. Upgrade to this version or later.
- Is GHSA-39Q2-94RC-95CP exploitable, and should I be worried? Whether GHSA-39Q2-94RC-95CP is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-39Q2-94RC-95CP is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-39Q2-94RC-95CP? Upgrade
dompurifyto 3.4.0 or later.