fix(ai): avoid shell execution for fixture tags - #9293
Open
russellwheatley wants to merge 1 commit into
Open
Conversation
russellwheatley
force-pushed
the
fix/ai-fixture-tag-shell-execution
branch
from
September 4, 2026 10:40
22c934c to
71fd059
Compare
The AI test-fixture fetcher interpolated the latest git tag from the external vertexai-sdk-test-data repository directly into an execSync shell string. A tag containing shell metacharacters (e.g. v17.0;id) would have its non-tag portion executed by the shell. Switch both git invocations to execFileSync with argument arrays and add a -- separator before positional repo/path args, so an attacker-controlled tag can never be parsed as shell syntax. Reported by Oskar Eichler, who also supplied the fix.
russellwheatley
force-pushed
the
fix/ai-fixture-tag-shell-execution
branch
from
September 4, 2026 10:50
71fd059 to
6f7acdf
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #9293 +/- ##
============================================
+ Coverage 69.45% 69.45% +0.01%
+ Complexity 2122 2121 -1
============================================
Files 443 444 +1
Lines 25537 25570 +33
Branches 4259 4264 +5
============================================
+ Hits 17733 17756 +23
- Misses 6404 6409 +5
- Partials 1400 1405 +5
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
russellwheatley
marked this pull request as ready for review
September 8, 2026 10:16
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.
The AI test-fixture fetcher (
scripts/fetch_ai_mock_responses.ts) interpolated the latest git tag from the externalvertexai-sdk-test-datarepo directly into anexecSyncshell string. A tag containing shell metacharacters (e.g.v17.0;id) would have the non-tag portion executed by the shell.ls-remote,clone) toexecFileSyncwith argument arrays--separator before positional repo/path argsfetchAiMockResponses()behind arequire.main === moduleguard so it's testableReported by Oskar Eichler, who also supplied the original patch this is based on.
Maintainer note: Fixes internal CPRN-418