From 4b8f4ef60f7db2e0e48d54233a14568059a8151a Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Thu, 26 Nov 2026 12:59:53 -0800 Subject: [PATCH 1/3] ci: harden Actions and Dependabot supply chain - Pin every action in the hand-written workflows to a full commit SHA with a version comment (incl. reproducible-containers/buildkit-cache-dance v3.4.0 = 5422eac0), so sha_pinning_required can be enabled. - Dependabot auto-merge: require the PR author, actor and triggering actor to be dependabot[bot]; refuse if the live head moved; approve with commit_id and enable auto-merge with --match-head-commit for the triggering SHA; drop unused GITHUB_TOKEN write scopes. - Dependabot: 3-day cooldown (7 for majors) on nuget, npm and github-actions; ContentFeedNuget and EssentialCSharp.Shared.Models exempt. - Private feed: optional Entra OIDC auth (azure/login + Azure DevOps access token) when vars.AZURE_DEVOPS_FEED_CLIENT_ID is set on BuildAndUploadImage; AZURE_DEVOPS_PAT stays as the fallback. Setup in docs/nuget-feed-oidc.md. - Caches: credentialed builds use *-feed- keys, PR/CodeQL builds use *-public- keys with no fallback, so main's private-feed NuGet and BuildKit caches are no longer restored into PR builds. - Promotion: deploy-development records the pushed manifest digest (and checks the dev tag matches), deploys dev by digest, and deploy-production imports dev@digest and fails unless prod holds that exact manifest. Co-Authored-By: Claude Opus 5.5 --- .github/dependabot.yml | 16 ++ .../workflows/Automerge-ContentNugetFeed.yml | 59 +++-- .github/workflows/Build-Test-And-Deploy.yml | 212 +++++++++++++----- .github/workflows/Build-Vector-DB.yml | 4 +- .../Scheduled-Smoke-Test-Development.yml | 6 +- .github/workflows/codeql.yml | 24 +- .github/workflows/copilot-setup-steps.yml | 16 +- docs/nuget-feed-oidc.md | 51 +++++ scripts/nuget/get-feed-token.sh | 35 +++ 9 files changed, 321 insertions(+), 102 deletions(-) create mode 100644 docs/nuget-feed-oidc.md create mode 100644 scripts/nuget/get-feed-token.sh diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ae9dd054..a92a3109 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -20,6 +20,16 @@ updates: interval: "daily" time: "04:00" timezone: "America/Los_Angeles" + # Hold public-registry version updates for a few days so a malicious or yanked release is + # likely to be caught upstream before it is auto-merged. Security updates ignore cooldown. + # Our own packages are exempt so book content still ships the next day: ContentFeedNuget (private + # feed) and EssentialCSharp.Shared.Models (nuget.org) share $(ToolingPackagesVersion) and move together. + cooldown: + default-days: 3 + semver-major-days: 7 + exclude: + - "ContentFeedNuget" + - "EssentialCSharp.Shared.Models" groups: tooling-dependencies: applies-to: version-updates @@ -36,6 +46,9 @@ updates: directory: "/" # Location of package manifests schedule: interval: "weekly" + cooldown: + default-days: 3 + semver-major-days: 7 ignore: # gh-aw action pins are compiler-managed and updated with workflow source updates/recompilation. - dependency-name: "github/gh-aw-actions/*" @@ -44,6 +57,9 @@ updates: directory: "/EssentialCSharp.Web/" schedule: interval: "weekly" + cooldown: + default-days: 3 + semver-major-days: 7 - package-ecosystem: "docker" # Look for a `Dockerfile` in the `root` directory diff --git a/.github/workflows/Automerge-ContentNugetFeed.yml b/.github/workflows/Automerge-ContentNugetFeed.yml index cd2f68fb..db5b731b 100644 --- a/.github/workflows/Automerge-ContentNugetFeed.yml +++ b/.github/workflows/Automerge-ContentNugetFeed.yml @@ -1,33 +1,62 @@ name: Dependabot auto-merge on: pull_request +# Every privileged call below uses BOT_PAT; the workflow token needs nothing beyond read. permissions: - contents: write - pull-requests: write + contents: read jobs: dependabot: runs-on: ubuntu-latest - if: ${{ github.actor == 'dependabot[bot]' }} + # Act only when Dependabot opened the PR, Dependabot's own push started this run, and a re-run + # by anyone else (github.triggering_actor) cannot reuse Dependabot's actor identity. + if: >- + github.event.pull_request.user.login == 'dependabot[bot]' && + github.actor == 'dependabot[bot]' && + github.triggering_actor == 'dependabot[bot]' && + github.event.pull_request.head.repo.full_name == github.repository steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v3 + uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 with: github-token: ${{ secrets.BOT_PAT }} + + # Approve and merge only the commit this run was triggered for. If anything was pushed to the + # branch after Dependabot's commit, stop instead of approving someone else's code. + - name: Verify the PR head is still the triggering commit + env: + GH_TOKEN: ${{ secrets.BOT_PAT }} + PR_URL: ${{ github.event.pull_request.html_url }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + live_head="$(gh pr view "$PR_URL" --json headRefOid --jq .headRefOid)" + if [ "$live_head" != "$HEAD_SHA" ]; then + echo "::error::PR head is $live_head, but this run was triggered for $HEAD_SHA. Not approving." + exit 1 + fi + - name: Add a label for content updates - if: ${{contains(steps.metadata.outputs.dependency-names, 'ContentFeedNuget')}} + if: ${{ contains(steps.metadata.outputs.dependency-names, 'ContentFeedNuget') }} run: gh pr edit "$PR_URL" --add-label "content update" env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{ secrets.BOT_PAT }} - - name: Approve a PR - run: gh pr review --approve "$PR_URL" + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.BOT_PAT }} + + - name: Approve the triggering commit env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.BOT_PAT}} - - name: Enable auto-merge for Dependabot PRs - run: gh pr merge --auto --squash --delete-branch "$PR_URL" + GH_TOKEN: ${{ secrets.BOT_PAT }} + PR_NUMBER: ${{ github.event.pull_request.number }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + gh api --method POST "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/reviews" \ + -f commit_id="$HEAD_SHA" \ + -f event=APPROVE \ + -f body="Auto-approved Dependabot update at ${HEAD_SHA}." + + - name: Enable auto-merge for the triggering commit env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.BOT_PAT}} + GH_TOKEN: ${{ secrets.BOT_PAT }} + PR_URL: ${{ github.event.pull_request.html_url }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: gh pr merge --auto --squash --delete-branch --match-head-commit "$HEAD_SHA" "$PR_URL" diff --git a/.github/workflows/Build-Test-And-Deploy.yml b/.github/workflows/Build-Test-And-Deploy.yml index cc8f514b..62cd4d52 100644 --- a/.github/workflows/Build-Test-And-Deploy.yml +++ b/.github/workflows/Build-Test-And-Deploy.yml @@ -29,7 +29,7 @@ jobs: - windows-latest steps: - - uses: actions/checkout@v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Verify Node version matches the Docker build shell: bash @@ -42,7 +42,7 @@ jobs: fi - name: Set up Node.js - uses: actions/setup-node@v7.1.0 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version-file: EssentialCSharp.Web/.nvmrc cache: npm @@ -59,7 +59,7 @@ jobs: # The .NET jobs build with SkipFrontendBuild; the browser journey tests need the compiled frontend. - name: Upload frontend build if: matrix.runner == 'ubuntu-latest' - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: frontend-dist path: EssentialCSharp.Web/wwwroot/dist @@ -73,35 +73,66 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 45 environment: "BuildAndUploadImage" + permissions: + contents: read + id-token: write # OIDC sign-in for the private NuGet feed; unused until AZURE_DEVOPS_FEED_CLIENT_ID is set + env: + # Private-feed auth: an Entra workload identity (OIDC) once the BuildAndUploadImage environment + # variable AZURE_DEVOPS_FEED_CLIENT_ID is set, otherwise the legacy AZURE_DEVOPS_PAT. + # See docs/nuget-feed-oidc.md. Remove the PAT fallback once OIDC has worked on main. + FEED_AUTH_MODE: ${{ vars.AZURE_DEVOPS_FEED_CLIENT_ID != '' && 'oidc' || 'pat' }} steps: - - uses: actions/checkout@v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up .NET Core - uses: actions/setup-dotnet@v6 + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: global-json-file: global.json - source-url: https://pkgs.dev.azure.com/intelliTect/_packaging/EssentialCSharp/nuget/v3/index.json - env: - NUGET_AUTH_TOKEN: ${{ secrets.AZURE_DEVOPS_PAT }} + # Distinct prefix: this cache holds private-feed packages, so PR jobs (prefix *-nuget-public-) + # must never restore it by prefix fallback. - name: Set up dependency caching for faster builds - uses: actions/cache@v6 + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 id: nuget-cache with: path: | ~/.nuget/packages ${{ github.workspace }}/**/obj/project.assets.json - key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + key: ${{ runner.os }}-nuget-feed-${{ hashFiles('**/packages.lock.json') }} restore-keys: | - ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - ${{ runner.os }}-nuget- + ${{ runner.os }}-nuget-feed- + + - name: Azure login for the private NuGet feed (restore) + if: env.FEED_AUTH_MODE == 'oidc' + uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0 + with: + client-id: ${{ vars.AZURE_DEVOPS_FEED_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + allow-no-subscriptions: true + + # Credentials-only user-level NuGet.Config; the repo nuget.config supplies the sources. + # It sits outside the Docker build context and is deleted right after restore. + - name: Write NuGet feed credentials + env: + AZURE_DEVOPS_PAT: ${{ env.FEED_AUTH_MODE == 'pat' && secrets.AZURE_DEVOPS_PAT || '' }} + run: | + NUGET_FEED_TOKEN="$(bash scripts/nuget/get-feed-token.sh)" + export NUGET_FEED_TOKEN + mkdir -p ~/.nuget/NuGet + bash scripts/nuget/emit-creds-config.sh > ~/.nuget/NuGet/NuGet.Config + chmod 600 ~/.nuget/NuGet/NuGet.Config + echo "Private feed auth mode: ${FEED_AUTH_MODE}" - name: Restore with dotnet run: dotnet restore + - name: Remove NuGet feed credentials + if: always() + run: rm -f ~/.nuget/NuGet/NuGet.Config + - name: Download frontend build - uses: actions/download-artifact@v8 + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: frontend-dist path: EssentialCSharp.Web/wwwroot/dist @@ -113,7 +144,7 @@ jobs: run: pwsh dev/EssentialCSharp.Web.AppHost.Tests/bin/Release/net10.0/playwright.ps1 install --with-deps chromium - name: Expose GitHub Actions Runtime - uses: actions/github-script@v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN']); @@ -124,7 +155,7 @@ jobs: - name: Upload Playwright failure captures if: failure() - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: playwright-captures-${{ github.run_attempt }} path: dev/EssentialCSharp.Web.AppHost.Tests/bin/Release/net10.0/playwright-artifacts @@ -132,29 +163,42 @@ jobs: retention-days: 7 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 id: buildx + # Credentialed build: its NuGet cache mount holds private-feed packages, so it uses the + # buildkit-cache-feed- prefix. PR builds use buildkit-cache-public- and never fall back to it. - name: Restore BuildKit cache mounts - uses: actions/cache@v6 + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 id: buildkit-cache with: path: buildkit-cache - key: buildkit-cache-${{ hashFiles('EssentialCSharp.Web/Dockerfile', 'Directory.Packages.props', '**/*.csproj', 'EssentialCSharp.Web/package-lock.json') }} - restore-keys: buildkit-cache- + key: buildkit-cache-feed-${{ hashFiles('EssentialCSharp.Web/Dockerfile', 'Directory.Packages.props', '**/*.csproj', 'EssentialCSharp.Web/package-lock.json') }} + restore-keys: buildkit-cache-feed- - name: Inject BuildKit cache mounts - uses: reproducible-containers/buildkit-cache-dance@v3 + uses: reproducible-containers/buildkit-cache-dance@5422eac04292c961a382e0f584ea0f03ad9da723 # v3.4.0 with: builder: ${{ steps.buildx.outputs.name }} dockerfile: EssentialCSharp.Web/Dockerfile cache-dir: buildkit-cache skip-extraction: false + # Sign in again: the GitHub OIDC assertion from the first login may have expired by now. + - name: Azure login for the private NuGet feed (container build) + if: env.FEED_AUTH_MODE == 'oidc' + uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0 + with: + client-id: ${{ vars.AZURE_DEVOPS_FEED_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + allow-no-subscriptions: true + - name: Generate Docker NuGet credentials config env: - NUGET_FEED_TOKEN: ${{ secrets.AZURE_DEVOPS_PAT }} + AZURE_DEVOPS_PAT: ${{ env.FEED_AUTH_MODE == 'pat' && secrets.AZURE_DEVOPS_PAT || '' }} run: | + NUGET_FEED_TOKEN="$(bash scripts/nuget/get-feed-token.sh)" + export NUGET_FEED_TOKEN mkdir -p "${RUNNER_TEMP}/nuget" bash scripts/nuget/emit-creds-config.sh > "${RUNNER_TEMP}/nuget/NuGet.Config" chmod 600 "${RUNNER_TEMP}/nuget/NuGet.Config" @@ -162,7 +206,7 @@ jobs: # Only build for dev registry — prod gets the image via az acr import in deploy-production - name: Build Container Image if: github.event_name != 'pull_request_target' && github.event_name != 'pull_request' - uses: docker/build-push-action@v7 + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 with: tags: ${{ vars.DEVCONTAINER_REGISTRY }}/essentialcsharpweb:${{ github.sha }},${{ vars.DEVCONTAINER_REGISTRY }}/essentialcsharpweb:latest file: ./EssentialCSharp.Web/Dockerfile @@ -178,8 +222,14 @@ jobs: if: always() run: rm -f "${RUNNER_TEMP}/nuget/NuGet.Config" + - name: Sign out of Azure + if: always() && env.FEED_AUTH_MODE == 'oidc' + run: | + az logout || true + az account clear || true + - name: Upload artifact - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: essentialcsharpwebimage path: ${{ github.workspace }}/essentialcsharpwebimage.tar @@ -202,23 +252,23 @@ jobs: collect_coverage: false steps: - - uses: actions/checkout@v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up .NET - uses: actions/setup-dotnet@v6 + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: global-json-file: global.json - name: Set up NuGet cache - uses: actions/cache@v6 + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: | ~/.nuget/packages ${{ github.workspace }}/**/obj/project.assets.json - key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + # No private-feed packages here; *-nuget-public- never matches the credentialed *-nuget-feed- caches. + key: ${{ runner.os }}-nuget-public-${{ hashFiles('**/packages.lock.json') }} restore-keys: | - ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - ${{ runner.os }}-nuget- + ${{ runner.os }}-nuget-public- - name: Restore .NET dependencies run: dotnet restore /p:AccessToNugetFeed=false @@ -226,7 +276,7 @@ jobs: # Browser journey tests need Linux containers, so they only run on the Ubuntu leg (skipped elsewhere). - name: Download frontend build if: matrix.collect_coverage - uses: actions/download-artifact@v8 + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: frontend-dist path: EssentialCSharp.Web/wwwroot/dist @@ -250,7 +300,7 @@ jobs: - name: Expose GitHub Actions Runtime if: matrix.collect_coverage - uses: actions/github-script@v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN']); @@ -266,7 +316,7 @@ jobs: - name: Upload Playwright failure captures if: ${{ failure() && matrix.collect_coverage }} - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: playwright-captures-${{ github.run_attempt }} path: dev/EssentialCSharp.Web.AppHost.Tests/bin/Release/net10.0/playwright-artifacts @@ -275,7 +325,7 @@ jobs: - name: Convert TRX to VS Playlist if: ${{ failure() && matrix.collect_coverage }} - uses: BenjaminMichaelis/trx-to-vsplaylist@v5 + uses: BenjaminMichaelis/trx-to-vsplaylist@e8d6bf4721d96b95a5de0a4c0b302c09be97abaa # v5 with: trx-file-path: '${{ runner.temp }}/*.trx' output-directory: '${{ runner.temp }}/vsplaylists' @@ -288,22 +338,24 @@ jobs: timeout-minutes: 30 steps: - - uses: actions/checkout@v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 id: buildx + # Uncredentialed build: only ever restore buildkit-cache-public- entries (this PR's own), never + # main's credentialed buildkit-cache-feed- entries or the legacy buildkit-cache- ones. - name: Restore BuildKit cache mounts - uses: actions/cache@v6 + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 id: buildkit-cache with: path: buildkit-cache - key: buildkit-cache-${{ hashFiles('EssentialCSharp.Web/Dockerfile', 'Directory.Packages.props', '**/*.csproj', 'EssentialCSharp.Web/package-lock.json') }} - restore-keys: buildkit-cache- + key: buildkit-cache-public-${{ hashFiles('EssentialCSharp.Web/Dockerfile', 'Directory.Packages.props', '**/*.csproj', 'EssentialCSharp.Web/package-lock.json') }} + restore-keys: buildkit-cache-public- - name: Inject BuildKit cache mounts - uses: reproducible-containers/buildkit-cache-dance@v3 + uses: reproducible-containers/buildkit-cache-dance@5422eac04292c961a382e0f584ea0f03ad9da723 # v3.4.0 with: builder: ${{ steps.buildx.outputs.name }} dockerfile: EssentialCSharp.Web/Dockerfile @@ -311,7 +363,7 @@ jobs: skip-extraction: ${{ steps.buildkit-cache.outputs.cache-hit }} - name: Build container image - uses: docker/build-push-action@v7 + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 with: file: ./EssentialCSharp.Web/Dockerfile context: . @@ -337,19 +389,22 @@ jobs: permissions: id-token: write contents: read + outputs: + # Registry manifest digest of the image this run built and pushed; production promotes exactly this. + image-digest: ${{ steps.push.outputs.digest }} steps: - - uses: actions/checkout@v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Azure Login - uses: azure/login@v3 + uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0 with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - name: Download artifact - uses: actions/download-artifact@v8 + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: name: essentialcsharpwebimage path: ${{ github.workspace }} @@ -365,11 +420,35 @@ jobs: az acr login --name "${REGISTRY%.azurecr.io}" - name: Push Image to Dev Container Registry - run: docker push --all-tags ${{ vars.DEVCONTAINER_REGISTRY }}/essentialcsharpweb + id: push + env: + DEV_ACR: ${{ vars.DEVCONTAINER_REGISTRY }} + IMAGE_TAG: ${{ github.sha }} + run: | + REPO="${DEV_ACR}/essentialcsharpweb" + docker push --all-tags "$REPO" + + # Digest of what this job just pushed, from the local image (not re-read through a mutable tag). + DIGEST="$(docker image inspect --format '{{range .RepoDigests}}{{println .}}{{end}}' "${REPO}:${IMAGE_TAG}" \ + | sed -n "s|^${REPO}@||p" | sort -u)" + if ! [[ "$DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]; then + echo "::error::Could not determine a single pushed digest for ${REPO}:${IMAGE_TAG} (got '${DIGEST}')" + exit 1 + fi + + # The registry's tag must point at the same manifest; anything else means it moved underneath us. + REGISTRY_DIGEST="$(az acr repository show --name "${DEV_ACR%.azurecr.io}" \ + --image "essentialcsharpweb:${IMAGE_TAG}" --query digest --output tsv)" + if [ "$REGISTRY_DIGEST" != "$DIGEST" ]; then + echo "::error::Dev ACR tag ${IMAGE_TAG} points to ${REGISTRY_DIGEST}, but this job pushed ${DIGEST}" + exit 1 + fi + echo "Pushed ${REPO}@${DIGEST}" + echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT" - name: Run database migrations env: - MIGRATION_IMAGE: ${{ vars.DEVCONTAINER_REGISTRY }}/essentialcsharpweb:${{ github.sha }} + MIGRATION_IMAGE: ${{ vars.DEVCONTAINER_REGISTRY }}/essentialcsharpweb@${{ steps.push.outputs.digest }} MIGRATION_JOB_NAME: ${{ vars.MIGRATION_JOB_NAME }} RESOURCEGROUP: ${{ vars.RESOURCEGROUP }} run: bash scripts/run-ef-migration-job.sh @@ -382,13 +461,13 @@ jobs: az containerapp update \ --name "$CONTAINER_APP_NAME" \ --resource-group "$RESOURCEGROUP" \ - --image "${{ vars.DEVCONTAINER_REGISTRY }}/essentialcsharpweb:${{ github.sha }}" + --image "${{ vars.DEVCONTAINER_REGISTRY }}/essentialcsharpweb@${{ steps.push.outputs.digest }}" # Smoke tests stay in this job so it holds the deploy-development concurrency group (no image swap mid-test); # deploy-production needs this job, so a failure blocks promotion. # Prep runs before the revision wait so it overlaps with the new revision starting up. - name: Set up .NET - uses: actions/setup-dotnet@v6 + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: global-json-file: global.json @@ -430,7 +509,7 @@ jobs: - name: Upload smoke test results if: failure() - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: smoke-test-results path: | @@ -440,7 +519,7 @@ jobs: - name: Logout of Azure CLI if: always() - uses: azure/CLI@v3 + uses: azure/CLI@9eb25b8360668fb0ecbafa808d40e2197b2f5f52 # v3.0.0 with: inlineScript: | az logout @@ -463,39 +542,48 @@ jobs: actions: write steps: - - uses: actions/checkout@v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 - name: Azure Login - uses: azure/login@v3 + uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0 with: client-id: ${{ secrets.AZURE_CLIENT_ID }} tenant-id: ${{ secrets.AZURE_TENANT_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} # Server-side copy from dev ACR to prod ACR — no artifact download needed. + # Promotes by the digest deploy-development pushed (dev tags are mutable) and fails unless prod + # ends up with that exact manifest. Later steps deploy and verify against this built digest. # PREREQUISITE: prod OIDC identity must have AcrPull on the dev ACR (Terraform RBAC). - name: Import image from dev ACR to prod ACR id: import + env: + DEV_ACR: ${{ vars.DEVCONTAINER_REGISTRY }} + PROD_ACR: ${{ vars.PRODCONTAINER_REGISTRY }} + IMAGE_TAG: ${{ github.sha }} + BUILT_DIGEST: ${{ needs.deploy-development.outputs.image-digest }} run: | - DEV_ACR="${{ vars.DEVCONTAINER_REGISTRY }}" - PROD_ACR="${{ vars.PRODCONTAINER_REGISTRY }}" + if ! [[ "$BUILT_DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]; then + echo "::error::deploy-development did not provide a valid image digest (got '${BUILT_DIGEST}')" + exit 1 + fi az acr import \ --name "${PROD_ACR%.azurecr.io}" \ - --source "${DEV_ACR}/essentialcsharpweb:${{ github.sha }}" \ - --image "essentialcsharpweb:${{ github.sha }}" \ + --source "${DEV_ACR}/essentialcsharpweb@${BUILT_DIGEST}" \ + --image "essentialcsharpweb:${IMAGE_TAG}" \ --image "essentialcsharpweb:latest" \ --force - DIGEST=$(az acr repository show \ + PROD_DIGEST=$(az acr repository show \ --name "${PROD_ACR%.azurecr.io}" \ - --image "essentialcsharpweb:${{ github.sha }}" \ + --image "essentialcsharpweb:${IMAGE_TAG}" \ --query "digest" -o tsv) - if [ -z "$DIGEST" ]; then - echo "::error::Failed to capture image digest from prod ACR after import" + if [ "$PROD_DIGEST" != "$BUILT_DIGEST" ]; then + echo "::error::Prod ACR tag ${IMAGE_TAG} points to '${PROD_DIGEST}', expected the built digest ${BUILT_DIGEST}" exit 1 fi - echo "digest=$DIGEST" >> $GITHUB_OUTPUT + echo "digest=${BUILT_DIGEST}" >> "$GITHUB_OUTPUT" - name: Run database migrations env: @@ -543,7 +631,7 @@ jobs: curl --fail --retry 10 --retry-delay 15 --retry-all-errors --max-time 30 "https://$FQDN/health" - name: Cancel pending deployment workflow runs - uses: actions/github-script@v9 + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 with: script: | // Cancel pending workflow runs queued from earlier commits. @@ -609,7 +697,7 @@ jobs: - name: Logout of Azure CLI if: always() - uses: azure/CLI@v3 + uses: azure/CLI@9eb25b8360668fb0ecbafa808d40e2197b2f5f52 # v3.0.0 with: inlineScript: | az logout diff --git a/.github/workflows/Build-Vector-DB.yml b/.github/workflows/Build-Vector-DB.yml index 45c71c31..eb98c6fa 100644 --- a/.github/workflows/Build-Vector-DB.yml +++ b/.github/workflows/Build-Vector-DB.yml @@ -10,9 +10,9 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up Python 3.8 - uses: actions/setup-python@v7 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: 3.8 - name: Install dependencies diff --git a/.github/workflows/Scheduled-Smoke-Test-Development.yml b/.github/workflows/Scheduled-Smoke-Test-Development.yml index 575d0e54..cddbfd01 100644 --- a/.github/workflows/Scheduled-Smoke-Test-Development.yml +++ b/.github/workflows/Scheduled-Smoke-Test-Development.yml @@ -28,10 +28,10 @@ jobs: actions: read steps: - - uses: actions/checkout@v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up .NET - uses: actions/setup-dotnet@v6 + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: global-json-file: global.json @@ -56,7 +56,7 @@ jobs: - name: Upload smoke test results if: failure() - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: smoke-test-results path: | diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index e0a399ff..f624d9bf 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -30,32 +30,32 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v4 + uses: github/codeql-action/init@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5 with: languages: ${{ matrix.language }} build-mode: none queries: security-and-quality - name: Set up .NET Core - uses: actions/setup-dotnet@v6 + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: global-json-file: global.json - name: Set up dependency caching for faster builds - uses: actions/cache@v6 + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 id: nuget-cache with: path: | ~/.nuget/packages ${{ github.workspace }}/**/obj/project.assets.json - key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + # No private-feed packages here; *-nuget-public- never matches the credentialed *-nuget-feed- caches. + key: ${{ runner.os }}-nuget-public-${{ hashFiles('**/packages.lock.json') }} restore-keys: | - ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - ${{ runner.os }}-nuget- + ${{ runner.os }}-nuget-public- - name: Restore with dotnet run: | @@ -63,7 +63,7 @@ jobs: dotnet build --configuration Release --no-restore --no-incremental /p:AccessToNugetFeed=false /p:SkipFrontendBuild=true - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 + uses: github/codeql-action/analyze@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5 with: category: "/language:${{matrix.language}}" @@ -83,19 +83,19 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v4 + uses: github/codeql-action/init@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5 with: languages: ${{ matrix.language }} queries: security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@v4 + uses: github/codeql-action/autobuild@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 + uses: github/codeql-action/analyze@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index afa4a73a..0a4015c0 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -19,10 +19,10 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@v7.0.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up .NET Core - uses: actions/setup-dotnet@v6 + uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: global-json-file: global.json source-url: https://pkgs.dev.azure.com/intelliTect/_packaging/EssentialCSharp/nuget/v3/index.json @@ -30,26 +30,26 @@ jobs: NUGET_AUTH_TOKEN: ${{ secrets.AZURE_DEVOPS_PAT }} - name: Set up Node.js for frontend development - uses: actions/setup-node@v7.1.0 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version-file: EssentialCSharp.Web/.nvmrc cache: npm cache-dependency-path: EssentialCSharp.Web/package-lock.json - name: Set up dependency caching for faster builds - uses: actions/cache@v6 + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 id: nuget-cache with: path: | ~/.nuget/packages ${{ github.workspace }}/**/obj/project.assets.json - key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + # Restored with private-feed credentials: keep it apart from the *-nuget-public- caches PR jobs use. + key: ${{ runner.os }}-nuget-feed-${{ hashFiles('**/packages.lock.json') }} restore-keys: | - ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - ${{ runner.os }}-nuget- + ${{ runner.os }}-nuget-feed- - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 - name: Install additional development tools shell: bash diff --git a/docs/nuget-feed-oidc.md b/docs/nuget-feed-oidc.md new file mode 100644 index 00000000..a250675f --- /dev/null +++ b/docs/nuget-feed-oidc.md @@ -0,0 +1,51 @@ +# Private NuGet feed access with OIDC instead of a PAT + +The main build (`build-and-test` in `.github/workflows/Build-Test-And-Deploy.yml`) restores +`ContentFeedNuget` from the private Azure Artifacts feed +`https://pkgs.dev.azure.com/intelliTect/_packaging/EssentialCSharp/nuget/v3/index.json`. + +It can authenticate two ways: + +| Mode | When | Credential | +|---|---|---| +| `oidc` | The `BuildAndUploadImage` environment has a variable `AZURE_DEVOPS_FEED_CLIENT_ID` | GitHub OIDC → `azure/login` → Entra access token for Azure DevOps (resource `499b84ac-1321-427f-aa17-267ca6975798`), valid about an hour | +| `pat` (fallback) | That variable is not set | The long-lived `AZURE_DEVOPS_PAT` repository secret | + +The job logs `Private feed auth mode: oidc` or `pat` in the **Write NuGet feed credentials** step. +`scripts/nuget/get-feed-token.sh` returns the token and `scripts/nuget/emit-creds-config.sh` writes it +into a credentials-only `NuGet.Config` (for the host restore and the Docker `nuget_config` secret). + +## One-time setup (owner, by hand) + +1. **Create an identity** in the Entra tenant your Azure DevOps organization `intelliTect` is connected to + (Azure DevOps → Organization settings → Microsoft Entra). Use a user-assigned managed identity or an + app registration, for example `ecs-web-feed-reader`. Give it **no Azure RBAC roles**: it only reads the feed. + Don't reuse `ecs-web-deploy-dev-identity` or `ecs-web-deploy-prod-identity`, which can push to ACR. +2. **Add a federated credential** to that identity: + - Issuer: `https://token.actions.githubusercontent.com` + - Subject: `repo:IntelliTect/EssentialCSharp.Web:environment:BuildAndUploadImage` + - Audience: `api://AzureADTokenExchange` +3. **Add the identity to Azure DevOps**: Organization settings → Users → Add users → pick the service + principal or managed identity. Basic access is the safe choice; Stakeholder access may not be enough to + read Artifacts feeds. +4. **Grant feed read**: Artifacts → `EssentialCSharp` feed → Feed settings → Permissions → Add users/groups → + the identity, role **Feed Reader**. Nothing higher. +5. **Turn it on**: GitHub → Settings → Environments → `BuildAndUploadImage` → Environment variables → + add `AZURE_DEVOPS_FEED_CLIENT_ID` = the identity's client (application) ID. The job reuses the existing + `AZURE_TENANT_ID` secret; if the Azure DevOps organization is in a different tenant, change the workflow's + `tenant-id` to that tenant. + +## Prove it, then retire the PAT + +1. Merge to `main` (or wait for the next merge) and check that `Build and test (Ubuntu)` logs + `Private feed auth mode: oidc`, restores `ContentFeedNuget`, and that the container build succeeds. +2. If it fails, delete the `AZURE_DEVOPS_FEED_CLIENT_ID` variable: the next run falls back to the PAT. +3. Once it has worked on `main`: + - Remove the PAT fallback (the `pat` branch of `get-feed-token.sh` and the `AZURE_DEVOPS_PAT` env lines + in `build-and-test`). + - Move the other PAT users first, or keep a PAT just for them: + - `.github/dependabot.yml` registry `nuget-azure-artifacts`. Dependabot supports Azure OIDC for + private registries (`tenant-id` and `client-id` instead of `username`/`password`); follow GitHub's + Dependabot OIDC docs for the federated-credential subject it uses. + - `.github/workflows/copilot-setup-steps.yml` and the `copilot` environment's own `AZURE_DEVOPS_PAT`. + - Delete the `AZURE_DEVOPS_PAT` secrets and revoke the PAT in Azure DevOps. diff --git a/scripts/nuget/get-feed-token.sh b/scripts/nuget/get-feed-token.sh new file mode 100644 index 00000000..a9e713f4 --- /dev/null +++ b/scripts/nuget/get-feed-token.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# Prints a token that can read the private Azure Artifacts feed, masked for GitHub Actions logs. +# +# FEED_AUTH_MODE=oidc: an Entra access token for Azure DevOps from the current `az login` +# (azure/login with OIDC must have run in an earlier step of the same job). +# FEED_AUTH_MODE=pat (default): the legacy personal access token in AZURE_DEVOPS_PAT. +set -euo pipefail + +# Azure DevOps resource (application) ID; the same for every organization. +readonly AZURE_DEVOPS_RESOURCE="499b84ac-1321-427f-aa17-267ca6975798" + +mode="${FEED_AUTH_MODE:-pat}" +case "${mode}" in + oidc) + token="$(az account get-access-token --resource "${AZURE_DEVOPS_RESOURCE}" --query accessToken --output tsv)" + ;; + pat) + token="${AZURE_DEVOPS_PAT:-}" + ;; + *) + echo "get-feed-token.sh: unknown FEED_AUTH_MODE '${mode}' (expected oidc or pat)" >&2 + exit 1 + ;; +esac + +if [[ -z "${token}" ]]; then + echo "get-feed-token.sh: no feed token available for FEED_AUTH_MODE=${mode}" >&2 + exit 1 +fi + +if [[ -n "${GITHUB_ACTIONS:-}" ]]; then + # Stderr, so the mask command never ends up in a captured token. + echo "::add-mask::${token}" >&2 +fi +printf '%s' "${token}" From 41cb6c94e3bddb5c2444373ef85b4b746042a40f Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Thu, 26 Nov 2026 13:01:00 -0800 Subject: [PATCH 2/3] ci: drop semver-major-days from github-actions cooldown (unsupported) Co-Authored-By: Claude Opus 5.5 --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a92a3109..e8e2c963 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -46,9 +46,9 @@ updates: directory: "/" # Location of package manifests schedule: interval: "weekly" + # github-actions supports only default-days (no semver-*-days). cooldown: default-days: 3 - semver-major-days: 7 ignore: # gh-aw action pins are compiler-managed and updated with workflow source updates/recompilation. - dependency-name: "github/gh-aw-actions/*" From f7d2dac538afed4254d35d4207328f06f7d6ecd3 Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Thu, 26 Nov 2026 13:52:47 -0800 Subject: [PATCH 3/3] ci: drop the OIDC setup doc; steps live in the PR description Co-Authored-By: Claude Opus 5.5 --- .github/workflows/Build-Test-And-Deploy.yml | 5 +- docs/nuget-feed-oidc.md | 51 --------------------- 2 files changed, 2 insertions(+), 54 deletions(-) delete mode 100644 docs/nuget-feed-oidc.md diff --git a/.github/workflows/Build-Test-And-Deploy.yml b/.github/workflows/Build-Test-And-Deploy.yml index 62cd4d52..a6771b69 100644 --- a/.github/workflows/Build-Test-And-Deploy.yml +++ b/.github/workflows/Build-Test-And-Deploy.yml @@ -77,9 +77,8 @@ jobs: contents: read id-token: write # OIDC sign-in for the private NuGet feed; unused until AZURE_DEVOPS_FEED_CLIENT_ID is set env: - # Private-feed auth: an Entra workload identity (OIDC) once the BuildAndUploadImage environment - # variable AZURE_DEVOPS_FEED_CLIENT_ID is set, otherwise the legacy AZURE_DEVOPS_PAT. - # See docs/nuget-feed-oidc.md. Remove the PAT fallback once OIDC has worked on main. + # Private-feed auth: OIDC when vars.AZURE_DEVOPS_FEED_CLIENT_ID is set, else AZURE_DEVOPS_PAT. + # Remove the PAT fallback once OIDC has worked on main. FEED_AUTH_MODE: ${{ vars.AZURE_DEVOPS_FEED_CLIENT_ID != '' && 'oidc' || 'pat' }} steps: diff --git a/docs/nuget-feed-oidc.md b/docs/nuget-feed-oidc.md deleted file mode 100644 index a250675f..00000000 --- a/docs/nuget-feed-oidc.md +++ /dev/null @@ -1,51 +0,0 @@ -# Private NuGet feed access with OIDC instead of a PAT - -The main build (`build-and-test` in `.github/workflows/Build-Test-And-Deploy.yml`) restores -`ContentFeedNuget` from the private Azure Artifacts feed -`https://pkgs.dev.azure.com/intelliTect/_packaging/EssentialCSharp/nuget/v3/index.json`. - -It can authenticate two ways: - -| Mode | When | Credential | -|---|---|---| -| `oidc` | The `BuildAndUploadImage` environment has a variable `AZURE_DEVOPS_FEED_CLIENT_ID` | GitHub OIDC → `azure/login` → Entra access token for Azure DevOps (resource `499b84ac-1321-427f-aa17-267ca6975798`), valid about an hour | -| `pat` (fallback) | That variable is not set | The long-lived `AZURE_DEVOPS_PAT` repository secret | - -The job logs `Private feed auth mode: oidc` or `pat` in the **Write NuGet feed credentials** step. -`scripts/nuget/get-feed-token.sh` returns the token and `scripts/nuget/emit-creds-config.sh` writes it -into a credentials-only `NuGet.Config` (for the host restore and the Docker `nuget_config` secret). - -## One-time setup (owner, by hand) - -1. **Create an identity** in the Entra tenant your Azure DevOps organization `intelliTect` is connected to - (Azure DevOps → Organization settings → Microsoft Entra). Use a user-assigned managed identity or an - app registration, for example `ecs-web-feed-reader`. Give it **no Azure RBAC roles**: it only reads the feed. - Don't reuse `ecs-web-deploy-dev-identity` or `ecs-web-deploy-prod-identity`, which can push to ACR. -2. **Add a federated credential** to that identity: - - Issuer: `https://token.actions.githubusercontent.com` - - Subject: `repo:IntelliTect/EssentialCSharp.Web:environment:BuildAndUploadImage` - - Audience: `api://AzureADTokenExchange` -3. **Add the identity to Azure DevOps**: Organization settings → Users → Add users → pick the service - principal or managed identity. Basic access is the safe choice; Stakeholder access may not be enough to - read Artifacts feeds. -4. **Grant feed read**: Artifacts → `EssentialCSharp` feed → Feed settings → Permissions → Add users/groups → - the identity, role **Feed Reader**. Nothing higher. -5. **Turn it on**: GitHub → Settings → Environments → `BuildAndUploadImage` → Environment variables → - add `AZURE_DEVOPS_FEED_CLIENT_ID` = the identity's client (application) ID. The job reuses the existing - `AZURE_TENANT_ID` secret; if the Azure DevOps organization is in a different tenant, change the workflow's - `tenant-id` to that tenant. - -## Prove it, then retire the PAT - -1. Merge to `main` (or wait for the next merge) and check that `Build and test (Ubuntu)` logs - `Private feed auth mode: oidc`, restores `ContentFeedNuget`, and that the container build succeeds. -2. If it fails, delete the `AZURE_DEVOPS_FEED_CLIENT_ID` variable: the next run falls back to the PAT. -3. Once it has worked on `main`: - - Remove the PAT fallback (the `pat` branch of `get-feed-token.sh` and the `AZURE_DEVOPS_PAT` env lines - in `build-and-test`). - - Move the other PAT users first, or keep a PAT just for them: - - `.github/dependabot.yml` registry `nuget-azure-artifacts`. Dependabot supports Azure OIDC for - private registries (`tenant-id` and `client-id` instead of `username`/`password`); follow GitHub's - Dependabot OIDC docs for the federated-credential subject it uses. - - `.github/workflows/copilot-setup-steps.yml` and the `copilot` environment's own `AZURE_DEVOPS_PAT`. - - Delete the `AZURE_DEVOPS_PAT` secrets and revoke the PAT in Azure DevOps.