Skip to content

fix: add output encoding in inject.js (CWE-79) - #1295

Open
anupamme wants to merge 1 commit into
Patternslib:masterfrom
anupamme:fix-repo-patterns-cwe-79-inject-dompurify-sanitize
Open

anupamme wants to merge 1 commit into
Patternslib:masterfrom
anupamme:fix-repo-patterns-cwe-79-inject-dompurify-sanitize

Conversation

@anupamme

Copy link
Copy Markdown

The inject pattern fetches HTML content from URLs and injects it directly into the DOM without sanitization. The _performInjection method sets wrapper.innerHTML = sources_string without any sanitization. The _inject method directly injects DOM nodes via targetmethod. Error page content is also injected via innerHTML assignment. DOMPurify is listed as a dependency but is never imported or used in inject.js. The affected code is src/pat/inject/inject.js:530. This change is the fix I would apply.

Reference: CWE-79

What changed

  • src/pat/inject/inject.js

Verification

No automated check could be run against this repository, so this change is unverified beyond review. Please treat it as a suggestion.


Automated security fix by OrbisAI Security

Automated security fix generated by OrbisAI Security
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant