Skip to content

Commit 43f1295

Browse files
authored
fix(security): Resolve Command Injection vulnerabilities (#6756)
1 parent 26c5e2c commit 43f1295

File tree

1 file changed

+50
-19
lines changed

1 file changed

+50
-19
lines changed

.github/workflows/unit-test-common.yml

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ jobs:
7171
if: ${{!inputs.should_skip}}
7272
steps:
7373
- uses: actions/checkout@v5
74-
- run: ./scripts/ci-select-xcode.sh ${{inputs.xcode}}
74+
- run: ./scripts/ci-select-xcode.sh "$XCODE_VERSION"
75+
env:
76+
XCODE_VERSION: ${{inputs.xcode}}
7577

7678
- name: Install Slather
7779
run: gem install slather
@@ -81,32 +83,49 @@ jobs:
8183
# For iOS/tvOS 26.1: Beta platforms not included by default
8284
- name: Install required platforms
8385
if: ${{ inputs.install_platforms }}
84-
run: ./scripts/ci-install-platforms.sh --platforms "${{ inputs.platform }}" --os-version "${{ inputs.test-destination-os }}"
86+
env:
87+
PLATFORMS: ${{ inputs.platform }}
88+
OS_VERSION: ${{ inputs.test-destination-os }}
89+
run: ./scripts/ci-install-platforms.sh --platforms "$PLATFORMS" --os-version "$OS_VERSION"
8590

8691
# Create simulator devices for non-preinstalled simulators
8792
# Required for iOS 16.4, iOS 17.5 (on Xcode 15.4), and iOS/tvOS 26.1
8893
- name: Create simulator device
8994
if: ${{ inputs.create_device }}
90-
run: ./scripts/ci-create-simulator.sh --platform "${{ inputs.platform }}" --os-version "${{ inputs.test-destination-os }}" --device-name "${{ inputs.device }}"
95+
env:
96+
PLATFORM: ${{ inputs.platform }}
97+
OS_VERSION: ${{ inputs.test-destination-os }}
98+
DEVICE_NAME: ${{inputs.device}}
99+
run: ./scripts/ci-create-simulator.sh --platform "$PLATFORM" --os-version "$OS_VERSION" --device-name "$DEVICE_NAME"
91100

92101
# Boot created simulators to ensure they're ready before tests run
93102
# Based on CircleCI forum comment, booting is especially important for Xcode 26: https://discuss.circleci.com/t/xcode-26-rc/54066/18
94103
- name: Boot simulator
95104
if: ${{ inputs.create_device && inputs.platform == 'iOS' }}
96-
run: ./scripts/ci-boot-simulator.sh --xcode ${{ inputs.xcode }} --device "${{ inputs.device }}" --os-version "${{ inputs.test-destination-os }}"
105+
env:
106+
XCODE_VERSION: ${{ inputs.xcode }}
107+
DEVICE_NAME: ${{ inputs.device }}
108+
OS_VERSION: ${{ inputs.test-destination-os }}
109+
run: ./scripts/ci-boot-simulator.sh --xcode "$XCODE_VERSION" --device "$DEVICE_NAME" --os-version "$OS_VERSION"
97110

98111
# We split building and running tests in two steps so we know how long running the tests takes.
99112
- name: Build Tests
100113
id: build_tests
114+
env:
115+
PLATFORM: ${{ inputs.platform }}
116+
OS_VERSION: ${{ inputs.test-destination-os }}
117+
REF_NAME: ${{ github.ref_name }}
118+
DEVICE_NAME: ${{ inputs.device }}
119+
SCHEME: ${{ inputs.scheme }}
101120
run: |
102121
./scripts/sentry-xcodebuild.sh \
103-
--platform ${{inputs.platform}} \
104-
--os ${{inputs.test-destination-os}} \
105-
--ref ${{ github.ref_name }} \
122+
--platform "$PLATFORM" \
123+
--os "$OS_VERSION" \
124+
--ref "$REF_NAME" \
106125
--command build-for-testing \
107-
--device "${{inputs.device}}" \
126+
--device "$DEVICE_NAME" \
108127
--configuration TestCI \
109-
--scheme ${{inputs.scheme}}
128+
--scheme "$SCHEME"
110129
111130
# Run Flaky Tests TestPlan which has a retry mechanism on failure.
112131
# We intentionally run these before the other test plan to fail early.
@@ -115,15 +134,21 @@ jobs:
115134
- name: Run Flaky Tests
116135
# Only the Sentry Scheme has the Flaky TestPlan.
117136
if: ${{ inputs.scheme == 'Sentry' }}
137+
env:
138+
PLATFORM: ${{ inputs.platform }}
139+
OS_VERSION: ${{ inputs.test-destination-os }}
140+
REF_NAME: ${{ github.ref_name }}
141+
DEVICE_NAME: ${{ inputs.device }}
142+
SCHEME: ${{ inputs.scheme }}
118143
run: |
119144
./scripts/sentry-xcodebuild.sh \
120-
--platform ${{inputs.platform}} \
121-
--os ${{inputs.test-destination-os}} \
122-
--ref ${{ github.ref_name }} \
145+
--platform "$PLATFORM" \
146+
--os "$OS_VERSION" \
147+
--ref "$REF_NAME" \
123148
--command test-without-building \
124-
--device "${{inputs.device}}" \
149+
--device "$DEVICE_NAME" \
125150
--configuration TestCI \
126-
--scheme ${{inputs.scheme}} \
151+
--scheme "$SCHEME" \
127152
--test-plan Sentry_Flaky \
128153
--result-bundle flaky-results.xcresult
129154
@@ -132,15 +157,21 @@ jobs:
132157
# passed to xcodebuild doesn't end up in the job name,
133158
# because GitHub Actions don't provide an easy way of
134159
# manipulating string in expressions.
160+
env:
161+
PLATFORM: ${{ inputs.platform }}
162+
OS_VERSION: ${{ inputs.test-destination-os }}
163+
REF_NAME: ${{ github.ref_name }}
164+
DEVICE_NAME: ${{ inputs.device }}
165+
SCHEME: ${{ inputs.scheme }}
135166
run: |
136167
./scripts/sentry-xcodebuild.sh \
137-
--platform ${{inputs.platform}} \
138-
--os ${{inputs.test-destination-os}} \
139-
--ref ${{ github.ref_name }} \
168+
--platform "$PLATFORM" \
169+
--os "$OS_VERSION" \
170+
--ref "$REF_NAME" \
140171
--command test-without-building \
141-
--device "${{inputs.device}}" \
172+
--device "$DEVICE_NAME" \
142173
--configuration TestCI \
143-
--scheme ${{inputs.scheme}} \
174+
--scheme "$SCHEME" \
144175
--result-bundle results.xcresult
145176
146177
- name: Publish Test Report

0 commit comments

Comments
 (0)