Usage of --safe-methods
to silence 'Dynamic Render Path' false positives
#1791
-
Hi! I'm asking this in the Q&A section because I'm not sure if:
Here's the relevant code, in a controller (from a Rails project): render action: (allowed_partial(params[:partial]) || "show") Assume that the I am passing $ brakeman --safe-methods allowed_partial . I expected that Brakeman would not report anything for the I know I can add a Please let me know what you think I should do. I'm happy to file an issue, if you think that's appropriate. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's a mis-use of the option, but that's because of poor naming and not your fault. Some day, depending on how complicated |
Beta Was this translation helpful? Give feedback.
It's a mis-use of the option, but that's because of poor naming and not your fault.
--safe-methods
is really only for use with cross-site scripting checks. There are also--sql-safe-methods
and--url-safe-methods
, but to stop a proliferation of these options, I have adopted the policy of "use the ignore file instead". Another option is to turn off that check, if it's not useful to you.Some day, depending on how complicated
allowed_partial
is, Brakeman might be able to recognize it as an allow-listing method. But it's not there yet.