Skip to content

Harden CI: Artifactory OIDC, NuGet lockfiles, tightened permissions - #146

Open
MichaelGHSeg wants to merge 7 commits into
mainfrom
ci/harden-build-publish
Open

MichaelGHSeg wants to merge 7 commits into
mainfrom
ci/harden-build-publish

Conversation

@MichaelGHSeg

Copy link
Copy Markdown
Contributor

Summary

  • Add Artifactory OIDC composite action — exchanges GitHub OIDC token for short-lived Artifactory access token, configures NuGet to resolve through `virtual-nuget-thirdparty`
  • Add `ci.yml` — replaces `build.yml`, fork-aware runner selection, `dotnet restore --locked-mode`, SHA-pinned actions
  • Add `deploy.yml` — replaces `release.yml`, tag-triggered, tightened permissions (`write-all` → `contents: read + id-token: write`), `environment: nuget` gate
  • Add `Directory.Build.props` — enables NuGet lockfiles repo-wide
  • Add `packages.lock.json` for `Analytics-CSharp` and `Tests` projects
  • Update `e2e-tests.yml` — remove `E2E_TESTS_TOKEN` (sdk-e2e-tests going public), fork-aware

Notes

  • NuGet has no OIDC trusted publishing — `NUGET_API_KEY` secret remains required
  • Old `build.yml` + `release.yml` can be deleted once new workflows are validated

Test plan

  • CI runs on this PR
  • Artifactory OIDC exchange succeeds on same-repo CI
  • Before merging: set `ARTIFACTORY_URL` repository variable
  • Before merging: create `nuget` GitHub environment with protection rules

- Add Artifactory OIDC composite action (configures NuGet to use virtual-nuget-thirdparty)
- Add ci.yml: fork-aware, dotnet build/test, --locked-mode, SHA-pinned actions
- Add deploy.yml: tag-triggered, environment: nuget gate, tightened permissions
- Add Directory.Build.props to enable NuGet lockfiles repo-wide
- Add packages.lock.json for Analytics-CSharp and Tests projects
- Update e2e-tests.yml: remove E2E_TESTS_TOKEN, fork-aware
Comment thread .github/workflows/deploy.yml
didiergarcia
didiergarcia previously approved these changes Jul 10, 2026
Rewrite composite action to use single-script pattern matching
analytics-python: audience=${ARTIFACTORY_URL}, provider_name=
github-actions-segmentio, and add JWT claim logging for debugging.
Replaces the repo-local copy with the shared first-party action, pinned. Each
SDK had its own drifting copy of the same exchange; the shared one covers every
ecosystem we use, so fixes land once instead of six times.
The job declared 'nuget', which does not exist. NUGET_API_KEY is an environment
secret on 'deployment', and environment secrets are only visible to jobs using
that exact environment — so secrets.NUGET_API_KEY resolved to empty and GitHub
silently created an unprotected 'nuget' environment on first run.

Pointing at 'deployment' rather than renaming keeps the existing secret in
place; its value cannot be read back to recreate it elsewhere.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants