Skip to content

Commit 8ade0a3

Browse files
fix(security): bundle for APS-19076 / APS-19077 / APS-19078
- APS-19076 (CVSS 9.3, env-var injection): allowlist env-var names exported from the BrowserStack rerun API in setBStackRerunEnvVars. Adds ALLOWED_RERUN_ENV_VARS (BROWSERSTACK_RERUN, BROWSERSTACK_RERUN_TESTS, BROWSERSTACK_BUILD_NAME) to setup-env/config/constants.js; filtered loop in setup-env/src/actionInput/index.js calls core.exportVariable only for allowlisted keys and core.warning for everything else. Updates existing test, adds negative-case test, rebuilds dist. - APS-19077 (CVSS 8.7, supply chain + token scope): pins actions/setup-node@v4.4.0 and actions/checkout@v4.2.2 by SHA in both .github/workflows/setup-env.yml and setup-local.yml; adds top-level permissions: { contents: read } block to give the GITHUB_TOKEN least privilege (these workflows only run unit tests). - APS-19078 (CVSS 7.6, stored XSS via report HTML): adds sanitize-html to browserstack-report-action; sanitizes basicHtml/richHtml in ReportProcessor.js with a strict allowlist (no inline event handlers, no javascript: URLs); strips JS hooks from richCss with sanitizeCss(); injects CSP meta (script-src 'none'; default-src 'none') into the artifact HTML head in UploadFileForArtifact.js as defense-in-depth; rebuilds dist. Tests: setup-env 37 passing (was 36, +1 negative-case); report-action 18 passing (no regression). Standalone XSS-strip sanity covers six payloads including <img src=x onerror=alert(1)>, <script>, javascript: URLs, <svg onload>, <iframe javascript:>; all stripped, safe HTML preserved. Resolves: APS-19076, APS-19077, APS-19078 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d6cb8ba commit 8ade0a3

11 files changed

Lines changed: 23411 additions & 6131 deletions

File tree

.github/workflows/setup-env.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,23 @@ on:
1010
- '.github/workflows/setup-env*'
1111

1212

13+
# Security (APS-19077): least-privilege token scope. These workflows only
14+
# run unit tests; they do not push, comment, or release. Read access to repo
15+
# contents is sufficient.
16+
permissions:
17+
contents: read
18+
1319
jobs:
1420
unit-tests:
1521
runs-on: ${{ matrix.operating-system }}
1622
strategy:
1723
matrix:
1824
operating-system: [ubuntu-latest, macos-latest, windows-latest]
1925
steps:
20-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2127

2228
- name: Set Node.js 24.x
23-
uses: actions/setup-node@master
29+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2430
with:
2531
node-version: 24.x
2632
cache: 'npm'

.github/workflows/setup-local.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,23 @@ on:
1010
- '.github/workflows/setup-local*'
1111

1212

13+
# Security (APS-19077): least-privilege token scope. These workflows only
14+
# run unit tests; they do not push, comment, or release. Read access to repo
15+
# contents is sufficient.
16+
permissions:
17+
contents: read
18+
1319
jobs:
1420
unit-tests:
1521
runs-on: ${{ matrix.operating-system }}
1622
strategy:
1723
matrix:
1824
operating-system: [ubuntu-latest, macos-latest, windows-latest]
1925
steps:
20-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2127

2228
- name: Set Node.js 24.x
23-
uses: actions/setup-node@master
29+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2430
with:
2531
node-version: 24.x
2632
cache: 'npm'

0 commit comments

Comments
 (0)