I am getting file access
warning for following code:
FileUtils.rm(File.join(Project.with_deleted.find_by(
:user_id => (User.find_by(:username => (params[:user_id])).id),
:name => (params[:id])
).satellitedir, params[:image_name]))
warning is:
When user-supplied input can contain ".." or similar characters that are passed through to file access APIs, causing access to files outside of an intended subdirectory.
I tried to sanitize params with:
if !params[:image_name].gsub(/\\/, '').index('../')
#my code
end
but this seem to have no effect on warning of hakiri warning.