Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive warning when rendering a partial that has a local called text #1915

Open
strika opened this issue Jan 22, 2025 · 0 comments
Open

Comments

@strika
Copy link

strika commented Jan 22, 2025

Background

Brakeman version: 7.0.0
Rails version: 7.1.5.1
Ruby version: 3.3.7

Issue

The following code:

<%= render(
  "inventory_unit/shared/inventory_record",
  text: params.dig(:inventory_unit, :inventory_record, :comment)
) %>

Produces:

Confidence: High
Category: Cross-Site Scripting
Check: RenderInline
Message: Unescaped parameter value rendered inline
Code: render(text => params.dig(:inventory_unit, :inventory_record, :comment), {})
File: app/inventory/views/inventory_unit/new.html.erb
Line: 86

However, changing the parameter name from text to comment doesn't produce a warning:

<%= render(
  "inventory_unit/shared/inventory_record",
  comment: params.dig(:inventory_unit, :inventory_record, :comment)
) %>
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

No branches or pull requests

1 participant