Background
Brakeman version: ~> 4.1
Rails version: ~> 5.1
Ruby version: ~> 2.5
Link to Rails application code: No
Issue
When a variable is escaped upstream to a method, Brakeman claims that there could be command injection, even though it's escaped upstream in the initializer.
False Positive
Confidence: Medium
Category: Command Injection
Check: Execute
Message: Possible command injection
Code: `dig +short -x #{Shellwords.shellescape(ip)} @#{@mdns} -p #{@port}`
File: lib/blackhole/enumerators/mdns.rb
Line: 44
Relevant code:
class NotReadyForRelease
def initialize(one, two)
@one = Shellwords.shellescape(one)
@two = Shellwords.shellescape(two)
end
def run(ip)
ip = Shellwords.shellescape(ip)
`dig +short -x #{ip} @#{@one} -p #{@two}`
end
end
Why might this be a false positive?
Because it's escaped upstream of the method.
Background
Brakeman version: ~> 4.1
Rails version: ~> 5.1
Ruby version: ~> 2.5
Link to Rails application code: No
Issue
When a variable is escaped upstream to a method, Brakeman claims that there could be command injection, even though it's escaped upstream in the initializer.
False Positive
Relevant code:
Why might this be a false positive?
Because it's escaped upstream of the method.