Skip to content

Commit

Permalink
Merge pull request #3 from google/fix_monkeypatch
Browse files Browse the repository at this point in the history
fix caller location check
  • Loading branch information
schcamille authored Mar 23, 2023
2 parents 44a51ac + ccd5393 commit e7a33a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/safe_active_record/active_record_monkeypatch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def self.check_arg(arg, idx, which_caller = 1)
which_caller += 1 if caller[which_caller].include?('/querying.rb')

# Early return for calls within any GEM
return arg if caller_locations[which_caller].absolute_path.start_with?(Gem.dir)
caller_location_path = caller_locations[which_caller].absolute_path || caller_locations[which_caller].path
return arg if !caller_location_path.nil? && caller_location_path.start_with?(Gem.dir)

err = "Warning: untrusted String type detected by SafeActiveRecord in argument indexed #{idx} (0-based) when " \
"calling `#{caller_locations.first.base_label}` at #{caller[which_caller]}. Please rewrite the argument " \
Expand Down

0 comments on commit e7a33a6

Please sign in to comment.