Skip to content

Avoid render text to prevent XSS

Description

The application was found calling `render text:...` which actually sets the content-type to 'text/html'. If external data can reach here, this exposes your application to cross-site scripting (XSS) attacks. Instead, use `render plain:...` to render non-HTML text.

Examples

Insecure Code

ruby
render text: user_input

Secure Code

ruby
render plain: user_input

Remediation

Replace 'render text:' with 'render plain:'

Rule Details

FieldValue
IDCODE-0556
CategoryInjection
SeverityMEDIUM
CWECWE-79
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityEASY
Tagsxss, cross-site scripting
OWASPA7:2017-Cross-Site Scripting (XSS), A03:2021-Injection

References