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 negative: eval(params[:code]).to_s is not detected #1590

Closed
Becojo opened this issue May 12, 2021 · 0 comments · Fixed by #1592
Closed

False negative: eval(params[:code]).to_s is not detected #1590

Becojo opened this issue May 12, 2021 · 0 comments · Fixed by #1592

Comments

@Becojo
Copy link
Contributor

Becojo commented May 12, 2021

Background

Brakeman version: 5.0.1
Rails version: 6.1.3.2
Ruby version: 2.7.2

Link to Rails application code: https://github.com/Becojo/rails-eval-to-s

Issue

Brakeman should report both eval in this code as dangerous but doesn't:


class ApplicationController < ActionController::Base
  def dangerous_eval
    # reported by Brakeman
    eval(params[:code])
  end

  def also_dangerous_eval
    # not reported by Brakeman
    eval(params[:code]).to_s
  end
end

https://github.com/Becojo/rails-eval-to-s/blob/e983dd26f19ec14bedc1c22eb3afd377e098433e/app/controllers/application_controller.rb#L1-L11

Repository owner locked and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant