Medium severityRubyCross-Site Scripting (XSS)MEDIUM confidence
XSS Sanitize Bypass
The Rails sanitize helper is configured with a dangerous tag/attribute allow-list (e.g. script/onclick), defeating its XSS protection (CWE-79).
Standards mapping
- OWASP Top 10
- A03:2021 - Injection
- OWASP ASVS
- V5.3.3 (L1)
Vulnerable vs. safe
Flagged by this check
view.sanitize(comment, tags: ["b", "i", "script"])Passes - the safe pattern
view.sanitize(comment, tags: ["b", "i", "em"])Why it matters & how to fix it
The Rails sanitize helper is configured with a dangerous tag/attribute allow-list (e.g. script/onclick), defeating its XSS protection (CWE-79). Remove script and event-handler attributes from the allow-list and rely on the default sanitizer configuration.
References
Rule ID integsec-ruby-xss-sanitize-bypass - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - Cross-Site Scripting (XSS)DOM XSS Innerhtml Sink
- JavaScript / TypeScript - Cross-Site Scripting (XSS)Reflected XSS Response Tainted Input
- JavaScript / TypeScript - Cross-Site Scripting (XSS)React Dangerously Set Inner HTML
- Go - Cross-Site Scripting (XSS)Text Template For HTML
- Go - Cross-Site Scripting (XSS)XSS Response Write
- Go - Cross-Site Scripting (XSS)XSS Template HTML Bypass