Always the latest release.
First of all, please immediately contact us via email so we can work on a fix. PGP key
Also, you probably qualify for a bug bounty! The fine folks over at Fastmail use DOMPurify for their services and added our library to their bug bounty scope. So, if you find a way to bypass or weaken DOMPurify, please also have a look at their website and the bug bounty info.
To set expectations for reporters and to help us triage quickly, the first question we ask of any report is what does the attacker control?
sanitize(). This is a genuine bypass and the kind of report we most want to receive.ALLOWED_URI_REGEXP, allowing event handlers through a custom-element predicate, and so on). We treat these as hardening bugs: worth fixing when an advertised guarantee has a hole, but they are not a default-configuration bypass, and severity is judged accordingly.Some features are best effort by design. We fix what we can there, but a finding is a hardening bug and not a bypass of a guarantee:
SAFE_FOR_TEMPLATES with DOM node input or IN_PLACE. The mode is guaranteed for string input. A tree the HTML parser did not build can change shape when it is parsed again, and text can join into a template expression at that point.SAFE_FOR_TEMPLATES and anything but {{ }}, ${ } and <% %>. Other template syntaxes and framework directives are not scrubbed.IN_PLACE with hooks or custom elements that keep changing the tree. DOMPurify fails closed where it can, see the README for the two cases it cannot follow.The dividing line is about who supplies the dangerous element, not how severe the consequence sounds. A report framed as “stored XSS” that requires the application to allow onerror via a hook is still a hardening bug, because the application allowed onerror. Configuration patterns that are safe by default but become dangerous when enabled are documented in the wiki's threat-model and attack-class pages.
DOMPurify is downloaded by hundreds of millions of CI runs and dependent applications every month. We treat its supply chain accordingly.
3.x branch..sigstore.json bundles are attached to each GitHub release..intoto.jsonl file on the release page from 3.4.3 onward.git tag -v <version>.DOMPurify is published to npm manually from the maintainer's laptop, not from a GitHub Actions workflow. This is a deliberate choice:
If you find an issue or pull request suggesting we automate npm publish or adopt npm “trusted publishers,” please be aware that this is a deliberate policy decision and not an oversight. We will not adopt either.
@v4, @main) are not used anywhere in this repository.step-security/harden-runner for egress monitoring.actions/checkout uses persist-credentials: false everywhere, so the Git credential is not left available for later steps.npm ci is invoked with --ignore-scripts in every CI workflow. Dependency install scripts are the exfiltration path used by Shai-Hulud-class attacks; blocking them removes the most common compromise vector.permissions defaults to contents: read, with elevated permissions scoped to the specific jobs that need them (signing, attestations).SCORECARD_TOKEN, a fine-grained, repo-scoped, time-bounded PAT used by the daily OpenSSF Scorecard run.To verify a published artifact yourself:
# Verify the git tag signature git tag -v <version> # Verify a release artifact against its Sigstore bundle cosign verify-blob \ --bundle <version>.tar.gz.sigstore.json \ --certificate-identity-regexp 'https://github.com/cure53/DOMPurify/' \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ <version>.tar.gz
The maintainer's GPG public key fingerprint is referenced above.
If you spot a workflow, dependency, or release-process issue that you believe weakens the supply chain, please report it via the same channel as a vulnerability report (email above). Issues that touch the release infrastructure are treated with the same urgency as sanitization bypasses.