Ruby SDK: use array-form system() in docker test suite to prevent shell injection (KSM-1244) - #1138
Open
stas-schaller wants to merge 1 commit into
Open
Conversation
…ell injection (KSM-1244) docker_test_suite.rb interpolated dockerfile_path, image_name, and test_file into single-string system() calls, which Ruby runs through /bin/sh -c. Switching to the array form of system() passes each value as a literal argv element with no shell involved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ruby SDK: fixes a shell-injection risk in the Docker test-matrix script by switching its
system()calls to array form.test/is excluded from the packaged gem (seespec.filesin the gemspec), so this doesn't touch anything released to RubyGems and needs no version bump.Changes
Fixed
docker_test_suite.rb's threesystem()calls (build, run, cleanup) interpolateddockerfile_path,image_name, andtest_fileinto shell strings executed via/bin/sh -c. Switched to array-formsystem(), which passes each argument directly to the binary with no shell involved (KSM-1244)Testing
cd sdk/ruby ruby -c test/integration/docker_test_suite.rb ruby test/integration/docker_test_suite.rb -hSecurity Impact
Removes a shell-injection vector flagged by Datadog SAST (
ruby-security/path-injection) insdk/ruby/test/integration/docker_test_suite.rb. The script is dev/CI tooling only, not shipped in the published gem, so no runtime or customer-facing security boundary is affected.Breaking Changes
None.
Related Issues