You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ActiveStorage::Filename.new(foo).sanitized is an official Rails way to sanitize a file name
to_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
The text was updated successfully, but these errors were encountered:
I just found about #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?!
Background
This is a follow-up to #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 impossibleThe text was updated successfully, but these errors were encountered: