Skip to content

Restore server-side GitHub App signing - #17801

Merged
missymessa merged 7 commits into
dotnet:mainfrom
missymessa:users/mjanecke/12467-restore-keyvault-signing
Nov 18, 2026
Merged

missymessa merged 7 commits into
dotnet:mainfrom
missymessa:users/mjanecke/12467-restore-keyvault-signing

Conversation

@missymessa

@missymessa missymessa commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Intent

Correct the GitHub App migration without moving private keys onto build agents. Keep WIF and short-lived installation tokens, read the configured App-ID secret projection for the JWT issuer, and sign only the SHA-256 digest through Azure Key Vault's RSA Sign operation.

The identifier contract is appIdSecretName / AppIdSecretName (GitHubAppIdSecretName for OneLoc), not a hardcoded App/Client ID in YAML. Only the App-ID projection is read. keyName selects the RSA signing resource; the private-key secret is never retrieved and there is no PEM/local-signing or PAT fallback.

Scope and decisions

Updates the authoritative helper, token step, OneLoc job defaults and authentication docs. Promotion callers on main/release11 use their configured projection too. Retains the release/8 localization no-op. Generated downstream copies must receive this through normal Arcade dependency flow.

App-ID retrieval uses authenticated Key Vault REST and reads the response value directly. This avoids Azure CLI's Windows deserialization failure on the existing year-9999 secret expiry metadata; that workaround does not require exporting a private key.

The WIF identity requires read access to the configured App-ID projection and Sign on the selected RSA key, not read access to private-key secrets. This PR does not change live credentials, keys, RBAC, production pipeline definitions or deployments. For the protected canary, the Promotion WIF identity was granted Key Vault Crypto User on its validation key; temporary canary pipeline and resource authorizations were restored afterward.

Validation

  • Protected CI canary 3140008 passed against PR head 4c765904c0d948c1a56963f709043870aeb58887. OneLoc and Promotion used WIF, read their App-ID projections, signed via Key Vault, and verified read-only repository access; both installation tokens were revoked. This does not validate a full publishing workflow.
  • 105/105 mocked tests passed in the canary: seven against the current PR head and 98 across four older Arcade and three VS Code helper implementations, including the actual main VS Code inline YAML helper.
  • Public arcade-pr CI 1688456 passed.
  • Tests cover configured Client-ID/numeric-ID values, JWT signature/issuer/lifetime, denied/empty ID projections, Azure token/signing failures, installation paging/selection, GitHub failures and masking. Signing failure tests explicitly reject private-key retrieval/fallback.
  • Both configured-ID success cases fail against the previous direct-ID helper for the intended hardcoded-issuer mismatch.
  • 21 changed YAML files parsed; 24 PowerShell scripts/embedded scripts AST-parsed; all eleven worktrees passed git diff --check. Template expressions are substituted only in validation artifacts; this is not Azure DevOps template compilation.

Gates before merging

Obtain the required review and keep required CI and policy checks green.

Downstream prerequisites

  • Before enabling remote signing for release-tags, Roslyn tagger and VMR artifact-reader, verify key provisioning and GitHub registration, WIF App-ID-read and Sign permissions, and installation access. Their proposed RSA keys were not returned by a prior key-list read; current provisioning has not been rechecked here.
  • Flow the corrected Arcade dependency to Monitor, Roslyn and VMR before merging their caller changes.
  • Establish coordinated signing-key rotation before retiring any in-use key; Secret Manager PEM rotation does not synchronize RSA signing keys.

Tracking: https://dev.azure.com/dnceng/internal/_workitems/edit/12467
Authoritative Arcade correction: #17801

Co-authored-by: Copilot <[email protected]>
Copilot-Session: e6793769-8620-4b12-9a94-206a0db5e467

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The protected canary has not run, leaving Azure CLI signing, GitHub App/key correspondence, promotion-key provisioning, and Sign permissions for each actual WIF identity awaiting human validation that mocks cannot provide.

No open issues 🎉

What changed in this PR

Restores server-side GitHub App signing in Arcade’s shared authentication tooling for OneLoc and promotion validation. Agents submit JWT digests to Key Vault, keeping private keys off agents and preserving short-lived installation tokens without a PAT fallback.

Changes:

  • Restores the KeyName/AppClientId contract across the helper, shared templates, and promotion caller.
  • Adds nine mocked Pester regression cases covering signing, installation lookup, failure handling, and token masking.
  • Updates migration and key-rotation documentation and corrects the signing-key retention comment.

Protected internal canary validation remains pending.

File Description
eng/​validation/​Get-GitHubAppToken.Tests.ps1 Adds regression coverage for digest-only signing and token handling.
eng/​validate-promotion.yml Configures promotion authentication with an App issuer and RSA key name.
eng/​common/​Get-GitHubAppToken.ps1 Replaces local PEM signing with Key Vault signing and rejects empty tokens.
eng/​common/​core-templates/​steps/​get-github-app-token.yml Exposes and forwards the restored signing parameters.
eng/​common/​core-templates/​job/​onelocbuild.yml Restores OneLoc’s App client ID and signing-key defaults.
Documentation/​OneLocBuildGitHubApp.md Documents remote signing, migration, permissions, rotation, and canary requirements.
Documentation/​OneLocBuild.md Updates OneLoc authentication parameters and migration guidance.
.vault-config/​product-builds-engkeyvault.yaml Corrects the retention and rotation comment; key declarations remain unchanged.

Review effort: Balanced

Co-authored-by: Copilot <[email protected]>
Copilot-Session: e6793769-8620-4b12-9a94-206a0db5e467

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Protected canaries have not run, leaving WIF permissions, GitHub key registration and installation access, and promotion signing-key provisioning dependent on human validation.

No open issues 🎉

Review effort: Balanced

Comment thread eng/common/Get-GitHubAppToken.ps1 Outdated
$escapedSecretName = [Uri]::EscapeDataString($AppIdSecretName)
try {
# Read only the ID value: CLI secret deserialization fails on year-9999 expiry metadata.
$appIdResponse = Invoke-RestMethod `

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

az keyvault instead of REST api?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do this, then you dont' even need the original account token generation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed az account get-access-token. az rest obtains the Key Vault token through Azure CLI using --resource https://vault.azure.net.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested az keyvault secret show against the configured App-ID projection; it fails with [Errno 22] Invalid argument. I switched to az rest with --resource https://vault.azure.net. This keeps authentication in Azure CLI and successfully reads the value without logging it; the direct secret-show command is not viable for this projection in the tested environment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove before checkin

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the temporary Get-GitHubAppToken.Tests.ps1 file as requested.

Copilot AI balanced review requested due to automatic review settings November 13, 2026 21:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Protected end-to-end canaries have not exercised the remote-signing path, leaving WIF permissions, actual CLI signing, GitHub key registration and installation access, and promotion-key provisioning dependent on human validation.

No open issues 🎉

Review effort: Balanced

Use Azure CLI REST to read the App ID projection without explicit token handling. Remove the temporary validation tests per review feedback.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 08592ccd-79d8-4bfe-86df-effc4ae76483
Copilot AI balanced review requested due to automatic review settings November 16, 2026 20:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Protected canaries have not run, and human validation is still needed for WIF App-ID read/Sign permissions, GitHub key registration and installation access, and promotion signing-key provisioning.

No open issues 🎉

Review effort: Balanced

@missymessa
missymessa marked this pull request as ready for review November 17, 2026 17:47
@missymessa
missymessa requested review from mmitche and a balanced review from Copilot November 17, 2026 17:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Protected canaries have not run, so live WIF permissions, GitHub key registration and installation access, and promotion signing-key provisioning still require human validation.

No open issues 🎉

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 18, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Protected canaries have not exercised the corrected authentication path, leaving WIF read/sign permissions, promotion-key provisioning, and GitHub App registration and installation access requiring human validation before merge.

No open issues 🎉

Review effort: Balanced

@missymessa
missymessa merged commit 851c138 into dotnet:main Nov 18, 2026
12 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 19, 2026
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.

3 participants