-
Notifications
You must be signed in to change notification settings - Fork 11
ci: harden release workflows (SHA-pin actions, least-privilege token, TLS timestamper) #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Keeps the commit-SHA pins in .github/workflows/ maintained. | ||
| # Pinning actions to an immutable SHA (rather than a mutable tag) is what stops a | ||
| # compromised or re-pointed action tag from executing in the release job; Dependabot | ||
| # is what stops those pins from going stale. | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| commit-message: | ||
| prefix: "ci" | ||
|
Comment on lines
+7
to
+12
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,12 @@ name: .NET package CI | |
|
|
||
| on: [workflow_dispatch] | ||
|
|
||
| # Least privilege: no step in this workflow writes to the repo, | ||
| # releases or packages via GITHUB_TOKEN (publishing uses NUGET_API_KEY, | ||
| # signing uses GCP_SA_KEY). Fail closed regardless of the org default. | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit] This comment is copied verbatim from |
||
| permissions: | ||
| contents: read | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: BrowserStackLocal | ||
|
|
@@ -11,9 +17,9 @@ jobs: | |
| runs-on: windows-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - uses: actions/checkout@0717577d45739eb3c851188b29f50ed6c0b2194e # v2 | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [for-human] No workflow run has exercised this change — a human should decide whether to dispatch I re-verified independently everything that can be checked statically, and it all holds:
What that leaves genuinely unverified: no step of either workflow has actually run. The reason given for not running one is right for A failure in checkout / setup-msbuild / setup-dotnet / upload-artifact would mean a bad pin; a One thing |
||
| - name: Add msbuild to PATH | ||
| uses: microsoft/setup-msbuild@v1.0.2 | ||
| uses: microsoft/setup-msbuild@c26a08ba26249b81327e26f6ef381897b6a8754d # v1.0.2 | ||
| - name: Build BrowserStackLocal | ||
| run: | | ||
| msbuild BrowserStackLocal -t:restore -p:Configuration=Release | ||
|
|
@@ -23,7 +29,7 @@ jobs: | |
| msbuild BrowserStackLocalIntegrationTests -t:restore -p:Configuration=Release | ||
| msbuild BrowserStackLocalIntegrationTests -t:build -p:Configuration=Release | ||
| - name: Setup .NET Core | ||
| uses: actions/setup-dotnet@v3 | ||
| uses: actions/setup-dotnet@55ec9447dda3d1cf6bd587150f3262f30ee10815 # v3 | ||
| with: | ||
| dotnet-version: 6.0.x | ||
| - name: Run Integration Tests | ||
|
|
@@ -34,7 +40,7 @@ jobs: | |
| - name: Pack NuGet Package | ||
| run: msbuild BrowserStackLocal -t:pack -p:Configuration=Release | ||
| - name: Save artifact | ||
| uses: actions/upload-artifact@v4 | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | ||
| with: | ||
| name: BrowserStackLocal.nupkg | ||
| path: .\BrowserStackLocal\BrowserStackLocal\bin\Release\*.nupkg | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] This config can't be scoped to
cd.yml/ci.yml— worth knowing what its first run will actually produce.The
github-actionsecosystem only acceptsdirectory: "/"and always scans everything under.github/workflows, so two consequences follow that the PR description doesn't anticipate:1. It will propose the major bumps this PR deliberately left out. Dependabot offers the newest version, not the newest patch of the pinned major. Current latest upstream vs. what's pinned here:
actions/checkoutmicrosoft/setup-msbuildactions/setup-dotnetactions/setup-javaactions/upload-artifactSo the first weekly run opens major-version PRs (capped at the default 5 open), which is exactly the "functional change, belongs on its own merits" work the description defers. That may well be what you want — but if the intent was only "keep the pins fresh within the pinned major", add an ignore:
2. Two of those PRs will target
Semgrep.yml, which the org-wide security-tools rollout owns (actions/checkout@v3.5.3→ v7,github/codeql-action/upload-sarif@v2.20.0→ v3+, since codeql-action v2 is retired). Bumping this repo's copy drifts it from the managed template and is liable to be reverted by the next rollout. There's no per-file scoping, so the options are anignoreongithub/codeql-actionor just closing those PRs knowingly.Also worth recording so nobody assumes otherwise later: this won't refresh
Semgrep.yml:30'simage: returntocorp/semgrep:1.166.0either. A job-levelcontainer: image:sits outside Dependabot's docker ecosystem (dependabot-core#5819), so the tag-not-digest residual noted on the chain ticket stays a manual item regardless of this file.