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

Brakeman dynamic render path error when finding records inside components #1870

Open
anthonyshchang opened this issue Sep 16, 2024 · 0 comments

Comments

@anthonyshchang
Copy link

Background

Brakeman version: 6.1.2
Rails version: 7.1.3.4
Ruby version: 3.3.2
ViewComponent version: 2.83.0

False Positive

Confidence: Weak
Category: Dynamic Render Path
Check: Render
Message: Render path contains parameter value
Code: render(action => MyComponent.new(:total_records => Thing.where("things.name LIKE :query", :query => ("%#{params[:q]}%")).count), {})
File: app/views/my_component.html.slim
Line: 1

Relevant code:

= render MyComponent.new(total_records: @total_count)  do |component|
  = render "subcomponent", component: component

Why might this be a false positive?
What is being rendered is a component.

Of note, moving @total_count to the partial subcomponent or any partial therein won't cause the reported brakeman error.

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