labml icon indicating copy to clipboard operation
labml copied to clipboard

False positive(?)

Open tbhockey opened this issue 11 years ago • 2 comments

I'm getting a number of, what I think are, false positives like such as:

Brakeman error:

High       | SystemsController | index  | SQL Injection        | Possible SQL injection near line 12: System.order("#{(+System::SORTS[params[:sort]]+ or "created_at DESC")}")          

Line from code:

System.order("#{System::SORTS[params[:sort]] || 'created_at DESC'}")

Because this is being passed into an order and the param itself is only being used to find a particular value from a predetermined Hash I don't believe this could actually be subject to SQL injection. But do correct me if I'm wrong.

tbhockey avatar Oct 21 '15 19:10 tbhockey

Hi Tony,

You are correct. Unfortunately, unless this code is inside the same class where System::SORTS is defined, I can't think of a way to prevent this warning at the moment.

presidentbeef avatar Oct 21 '15 22:10 presidentbeef

@presidentbeef ok I see. Thanks for confirming anyway.

tbhockey avatar Oct 21 '15 23:10 tbhockey