Skip to content

Commit 21d2af6

Browse files
Potential fix for code scanning alert no. 74: Unsafe shell command constructed from library input
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Derek Hower <[email protected]>
1 parent 683c7e9 commit 21d2af6

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tools/gems/udb/lib/udb/resolver.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ def any_newer?(target, deps)
7777
end
7878

7979
# run command in the shell. raise if exit is not zero
80-
sig { params(cmd: String).void }
80+
sig { params(cmd: T::Array[String]).void }
8181
def run(cmd)
82-
puts cmd
83-
system cmd
82+
puts cmd.join(" ")
83+
system(*cmd)
8484
raise unless $?.success?
8585
end
8686

@@ -149,7 +149,14 @@ def merge_arch(
149149

150150
if any_newer?(gen_path / "arch" / config_name / ".stamp", deps)
151151
udb_gem_path = Bundler.definition.specs.find { |s| s.name == "udb" }.full_gem_path
152-
run "#{python_path} #{udb_gem_path}/python/yaml_resolver.py merge #{arch_path} #{config_yaml["arch_overlay"]} #{gen_path}/arch/#{config_name}"
152+
run [
153+
python_path.to_s,
154+
"#{udb_gem_path}/python/yaml_resolver.py",
155+
"merge",
156+
arch_path.to_s,
157+
config_yaml["arch_overlay"].to_s,
158+
"#{gen_path}/arch/#{config_name}"
159+
]
153160
FileUtils.touch(gen_path / "arch" / config_name / ".stamp")
154161
end
155162
end

0 commit comments

Comments
 (0)