Open bb opened 3 hours ago
I just found about https://github.com/presidentbeef/brakeman/pull/1375 so I guess this might be because I'm only calling sanitized on the local part and adding a static path outside of the sanitization?!
Yes, see my comment on that PR 😄
Background
This is a follow-up to https://github.com/presidentbeef/brakeman/issues/337.
Brakeman version: 6.2.2 Rails version: 7.1.5 Ruby version: 3.3.4
Link to Rails application code: ?
False Positive
Full warning from Brakeman:
Relevant code:
Why might this be a false positive?
ActiveStorage::Filename.new(foo).sanitized
is an official Rails way to sanitize a file nameto_i
makes sure it's only numeric, so even without ActiveStorage sanitizing, a path traversal is not possible using only an integer number which can neither contain.
nor/
making a directory traversal impossible