Title: Pin Semgrep CI image by digest and scope security-events to the upload job (CWE-829) by 07souravkunda · Pull Request #31 · browserstack/browserstack-local-php · GitHub
Open Graph Title: Pin Semgrep CI image by digest and scope security-events to the upload job (CWE-829) by 07souravkunda · Pull Request #31 · browserstack/browserstack-local-php
X Title: Pin Semgrep CI image by digest and scope security-events to the upload job (CWE-829) by 07souravkunda · Pull Request #31 · browserstack/browserstack-local-php
Description: What CI supply-chain hardening for the Semgrep workflow (CWE-829 — Inclusion of Functionality from Untrusted Control Sphere). Pin returntocorp/semgrep by immutable digest instead of the 1.166.0 tag. Move the SARIF upload into its own job, so security-events: write is no longer held by the job that runs the third-party container. Add a Dependabot config for github-actions so the action SHA pins don't go stale. Why .github/workflows/Semgrep.yml runs a third-party container image on a 0 6 * * * cron (plus every push/PR to master), in a job that has the repository checked out and holds security-events: write. A version tag is still mutable. 1.166.0 was a real improvement over :latest, but Docker Hub tags can be re-pointed at new content upstream, and the next scheduled run would pull and execute it with no PR gate. A digest cannot be re-pointed — updating it now requires a reviewable commit, which restores the audit trail. The container did not need security-events: write. Only the SARIF upload does. As written, a compromised image could forge or suppress entries in the repository's code-scanning dashboard. Splitting the jobs means the third-party code runs with contents: read and nothing else. Changes .github/workflows/Semgrep.yml - image: returntocorp/semgrep:1.166.0 + image: returntocorp/semgrep@sha256:c180f0c93a17b420c0af5006214a29d3c747c5459c732b740191adf657dd0068 The digest is the multi-arch OCI index that returntocorp/semgrep:1.166.0 resolves to today (pushed 2026-06-11) — confirmed independently against registry-1.docker.io (Docker-Content-Digest) and the Docker Hub v2 tag API. Same image, so no behavioural change; pinning the index rather than a per-arch manifest keeps the ref architecture-agnostic. The human-readable version and the command to refresh the pin are recorded in a comment next to it. Job layout: Job Runs third-party code Permissions semgrep (unchanged name, so any required check keeps matching) yes — the Semgrep container contents: read upload-sarif (new) no — first-party actions only contents: read, security-events: write The SARIF crosses between them as a workflow artifact. Both the artifact upload and the new job use if: always(), because semgrep ci exits non-zero whenever it has blocking findings — without that, the SARIF would stop reaching the dashboard on exactly the runs that matter. .github/dependabot.yml (new) — weekly github-actions updates, with a 7-day cooldown so a version isn't proposed the day it's published. Note that Dependabot cannot bump a workflow container: digest: its docker ecosystem only parses Dockerfiles, Kubernetes manifests and Helm values (dependabot-core#5819 is still open), and github-actions only covers uses: refs. That's why the manual refresh command is in the workflow comment — adopting Renovate, which does support workflow container digests, would automate it. Testing The workflow is exercised by this PR itself — the pull_request trigger runs the modified file, so the runs on this PR are the test. Run Head semgrep/ci upload-sarif (new) Overall 31599734585 1fc44b3 ❌ exit 1 — 1 finding (see below) ✅ failure 31599955720 8b08eb9 ✅ 0 findings ✅ ✅ success Digest pin confirmed from the runner log — docker pull returntocorp/semgrep@sha256:c180f0c9… → semgrep 1.166.0 on python 3.12.13, i.e. the digest resolves to exactly the version the tag named. The permission split is confirmed by the first run, which is the more informative one: the semgrep job failed and the SARIF still reached the dashboard, because the artifact upload and the new job both carry if: always(). That preserves the one behaviour that mattered about the old upload step. The first run's finding was in this PR's own new file, and it was a fair catch. Semgrep's p/default flagged package_managers.dependabot.dependabot-missing-cooldown on .github/dependabot.yml — a Dependabot with no cooldown proposes a version the instant it's published, which is the same window a hijacked release exploits. Fixed in 8b08eb9; the re-run is clean. Also checked locally before pushing: both files parse as YAML; every third-party ref is immutable (digest or full commit SHA, no @vN remaining); and asserted programmatically that no job both runs the container and holds security-events: write. The image digest was cross-checked against two independent sources (registry Docker-Content-Digest header and the Docker Hub v2 tag API). One thing the green here does not mean: on pull_request, semgrep ci is diff-aware and scanned only the 2 changed files. master's full scan still exits 1 with 5 pre-existing findings (e.g. run 31569942332) — untouched by this PR. Not in this PR A composer.lock was considered — the repo has none, so composer install resolves phpunit/phpunit: 4.6.* and its transitives fresh against Packagist on every clone. It turns out a lockfile cannot be committed here without making things worse. Composer 2.9 refuses to resolve that constraint at all under its default block-insecure audit, and forcing it (--no-security-blocking) produces a lock that pins 4 known advisories across 2 packages: phpunit/phpunit 4.6.10 — CVE-2026-24765 (high; fixed in 8.5.52+) symfony/yaml v3.4.47 — CVE-2026-45304, CVE-2026-45305, CVE-2026-45133 (low) phpunit/phpunit-mock-objects 2.3.8 — abandoned Committing that would require an audit.ignore for a high-severity CVE and would pin the vulnerability into the dependency graph. The advisory is in any case already visible without a lockfile — Dependabot alert #1 on the default branch is exactly GHSA-vvj3-c3rp-c85p, detected from composer.json. The real fix is to move off PHPUnit 4.6 — which means migrating tests/LocalTest.php off the PHPUnit_Framework_TestCase API — and that belongs in its own PR, separate from CI pinning. Nothing here ships to consumers: both the image and PHPUnit are CI/dev-only (Composer never installs a library's require-dev for downstream consumers). Worth noting for whoever picks that up: no CI job currently runs composer install at all. .travis.yml still references it, but Travis is no longer wired to this repo — recent commits report no Travis status contexts, only semgrep/ci and Analyze (actions).
Open Graph Description: What CI supply-chain hardening for the Semgrep workflow (CWE-829 — Inclusion of Functionality from Untrusted Control Sphere). Pin returntocorp/semgrep by immutable digest instead of the 1.166.0 ta...
X Description: What CI supply-chain hardening for the Semgrep workflow (CWE-829 — Inclusion of Functionality from Untrusted Control Sphere). Pin returntocorp/semgrep by immutable digest instead of the 1.166.0 ta...
Opengraph URL: https://github.com/browserstack/browserstack-local-php/pull/31
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:da2dcd37-a448-4b66-aa36-baaa823dfd76 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D122:31EE77:CECE3:1111EA:6B04B03B |
| html-safe-nonce | ddf433758b084479f671dcd4d5bae5885aa48867f6dd6db24e0d8ba90721acd9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTIyOjMxRUU3NzpDRUNFMzoxMTExRUE6NkIwNEIwM0IiLCJ2aXNpdG9yX2lkIjoiODcwNjcyNzYyNjU5MDY5NTQ4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d64a17767fad80ff611a13496635c62513e94570e40e7b3e8418f308acd6eb6d |
| hovercard-subject-tag | pull_request:4262529762 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/browserstack/browserstack-local-php/pull/31/files |
| twitter:image | https://avatars.githubusercontent.com/u/50537259?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/50537259?s=400&v=4 |
| og:image:alt | What CI supply-chain hardening for the Semgrep workflow (CWE-829 — Inclusion of Functionality from Untrusted Control Sphere). Pin returntocorp/semgrep by immutable digest instead of the 1.166.0 ta... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | f1d110ea058a0915c1d8aa3fc2069fa15801e128f591e5762525abe77490ecb1 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/browserstack/browserstack-local-php git https://github.com/browserstack/browserstack-local-php.git |
| octolytics-dimension-user_id | 1119453 |
| octolytics-dimension-user_login | browserstack |
| octolytics-dimension-repository_id | 51923086 |
| octolytics-dimension-repository_nwo | browserstack/browserstack-local-php |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 51923086 |
| octolytics-dimension-repository_network_root_nwo | browserstack/browserstack-local-php |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ffa22a65e4c46d376940fe34b05e6a7e9c7fdb9b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width