Skip to content

Commit ab48704

Browse files
committed
chore: scope-limited scanner suppression on the fixed verify_binary line
The dangerous-exec rule fires on any non-static first argument to IO.popen and does not model the array form, so it reports the fixed line as well as the vulnerable one it replaced -- the same rule is already open against master on the pre-fix line. Comment-only; no behaviour change. Suppression is scoped to this one rule on this one line, with the reason stated inline, so every other IO.popen/exec finding in this file still reports.
1 parent db623c3 commit ab48704

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/browserstack/localbinary.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ def download_to(url, bin_path)
135135
def verify_binary(bin_path)
136136
# Array form: exec's the binary directly, so a path containing shell
137137
# metacharacters or spaces is never interpreted by /bin/sh (CWE-78).
138+
#
139+
# The scanner rule below fires on any non-static first argument to IO.popen
140+
# and does not model the array form -- which is exactly the fix here, since
141+
# no shell is spawned at all. Suppressed for this rule only.
142+
# nosemgrep: ruby.lang.security.dangerous-exec.dangerous-exec
138143
binary_response = IO.popen([bin_path, '--version']).readline
139144
!!(binary_response =~ /BrowserStack Local version \d+\.\d+/)
140145
rescue StandardError

0 commit comments

Comments
 (0)