Security: harden CI workflows + pin SDK (APS-19440 chain, 9 findings)#21
Open
Rohannagariya1 wants to merge 1 commit into
Open
Security: harden CI workflows + pin SDK (APS-19440 chain, 9 findings)#21Rohannagariya1 wants to merge 1 commit into
Rohannagariya1 wants to merge 1 commit into
Conversation
- Pin actions/checkout@v3 and actions/setup-java@v3 to full commit SHAs - Validate workflow_dispatch commit_sha as 40-hex before checkout ref / check creation - Move BrowserStack secrets from job-level env to only the mvn test steps - Add least-privilege top-level permissions (contents: read, checks: write) - Pin browserstack-java-sdk to exact version 1.60.2 (was LATEST) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Hardens the GitHub Actions CI of this sample repo and pins the BrowserStack SDK to resolve a chain of 9 pentest findings (APS-19440 chain). Staging/Jenkins deploys are N/A — this repo only ships sample CI config. Local validation: workflow YAML lint (
yaml.safe_load) + pom.xml XML validity check, both pass.Ticket -> change:
actions/checkout@v3andactions/setup-java@v3to full 40-char commit SHAs (kept# v3comments). The twoactions/github-scriptsteps and Semgrep.yml were already SHA-pinned.browserstack-java-sdkto exact version1.60.2(wasLATEST) via abrowserstack-java-sdk.versionproperty in pom.xml. The-javaagentargLine resolves from this pinned dependency, so the agent is pinned too.^[0-9a-fA-F]{40}$, so the value reachingactions/checkoutref:is constrained.commit_shais never interpolated directly into arun:shell line (passed viaenv:and the validation reads"$COMMIT_SHA").checks.createsteps, so an attacker can no longer sethead_shato an arbitrary value to spoof check status.commit_shacontinues to be passed to github-script viaenv:(no shell interpolation).BROWSERSTACK_USERNAME/BROWSERSTACK_ACCESS_KEYoff the job-levelenv:and down to only the threemvn teststeps that need them, so they no longer leak into checkout / setup-java / github-script steps.commit_shaRCE collapses: input is validated (F-003), not shell-interpolated, and actions are SHA-pinned (F-001).1.60.2(F-002).actions/checkout@v3substitution collapses: now SHA-pinned (F-001).head_shavalidated (F-004) and added a least-privilege top-levelpermissions:block (contents: read;checks: writeonly because the job genuinely creates check runs).