Skip to content

Use Secret Manager values for GitHub App tokens - #17528

Merged
missymessa merged 8 commits into
dotnet:mainfrom
missymessa:users/mjanecke/12467-github-app-secret-values
Sep 11, 2026
Merged

missymessa merged 8 commits into
dotnet:mainfrom
missymessa:users/mjanecke/12467-github-app-secret-values

Conversation

@missymessa

@missymessa missymessa commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Summary

  • replace Key Vault RSA-key signing with the App ID and PEM private key produced by Secret Manager's github-app-secret type
  • migrate OneLoc to oneloc-localization-app-app-id and oneloc-localization-app-app-private-key
  • remove the legacy signing parameters and Azure service-connection path rather than retaining compatibility
  • update OneLoc documentation for the Key Vault-backed variable-group model

Validation

  • parsed the PowerShell helper with the PowerShell AST parser
  • parsed both changed Azure Pipelines YAML templates
  • validated the unresolved-variable failure path
  • validated both OneLoc and dotnet-monitor composite credentials end-to-end against their GitHub App installations; temporary installation tokens were revoked
  • added the composite projections to dnceng/internal OneLocBuildVariables (103), DevDiv/DevDiv OneLocBuildVariables (343), and dnceng/internal Release-Pipeline (87)

The old RSA key declarations remain only as rollout safeguards. After this shared refactor merges, its Arcade dependency flow into dotnet-monitor will be combined with the dotnet-monitor consumer update. After both production paths validate, a cleanup PR will remove the declarations and the Key Vault keys will be deleted.

AB#12467

Add a PEM-backed signing path for composite github-app-secret values and migrate OneLoc defaults while retaining the legacy Key Vault-key path for staged consumer rollout.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: cb83d078-4ba7-4f9f-86e5-7840b221515c
Copilot AI lite review requested due to automatic review settings September 9, 2026 21:40

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.

🟡 Changes recommended

The legacy (Key Vault signing) branch in get-github-app-token.yml should add template-time validation to prevent empty required inputs from failing later with less actionable task errors.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates Arcade’s GitHub App installation-token minting flow to support Secret Manager–provided GitHub App credentials (App ID + PEM private key) while retaining the legacy Azure Key Vault RSA-key signing path for migration, and updates OneLocBuild defaults/documentation accordingly.

Changes:

  • Add a PEM-backed JWT signing path in Get-GitHubAppToken.ps1 driven by environment-provided App ID/private key, with guardrails for empty/unresolved pipeline variables.
  • Update the get-github-app-token.yml step template to optionally run via PowerShell@2 (Secret Manager path) or AzureCLI@2 (legacy Key Vault signing path).
  • Migrate OneLocBuild defaults and documentation to Secret Manager variable-group–backed values.
File summaries
File Description
eng/common/Get-GitHubAppToken.ps1 Adds Secret Manager (env var) PEM signing path and preserves Key Vault signing fallback.
eng/common/core-templates/steps/get-github-app-token.yml Adds parameters and conditional step selection between Secret Manager and Key Vault signing.
eng/common/core-templates/job/onelocbuild.yml Switches OneLocBuild defaults to Secret Manager-backed GitHub App credentials and passes them into the token-mint step.
Documentation/OneLocBuildGitHubApp.md Updates OneLoc GitHub App onboarding docs to the variable-group + Secret Manager model.
Documentation/OneLocBuild.md Updates template parameter documentation to the new GitHub App credential defaults.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Keep the Secret Manager signing contract fixed instead of making the environment variable names configurable.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: cb83d078-4ba7-4f9f-86e5-7840b221515c
Copilot AI review requested due to automatic review settings September 9, 2026 21:44

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.

🟡 Changes recommended

There are confirmed correctness and compatibility/documentation gaps in the new Secret Manager/legacy selection and legacy-default behavior that can lead to confusing failures or broken opt-out flows.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

Documentation/OneLocBuild.md:208

  • This row references "legacy Key Vault-key parameters" but the document no longer identifies which parameters must be supplied when UseGitHubAppSecretManagerValues=false.
    Documentation/OneLocBuildGitHubApp.md:92
  • This row mentions switching to the legacy Key Vault-key parameters, but the doc no longer states which parameters those are. As written, it’s unclear what a caller must set when UseGitHubAppSecretManagerValues=false.
  • Files reviewed: 5/5 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread eng/common/Get-GitHubAppToken.ps1 Resolved
@missymessa
missymessa marked this pull request as draft September 9, 2026 21:50
Require github-app-secret App ID and private-key values throughout the token helper and OneLoc templates. Keep only the manifest key declarations until consumer rollout validation completes.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: cb83d078-4ba7-4f9f-86e5-7840b221515c
Copilot AI review requested due to automatic review settings September 9, 2026 21:50
Comment thread eng/common/Get-GitHubAppToken.ps1 Resolved

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.

🟡 Changes recommended

There’s a small but concrete script defect (duplicate $ErrorActionPreference) and the template parameter surface change is a breaking change that should be explicitly handled/mitigated per Arcade’s breaking-change policy.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread eng/common/Get-GitHubAppToken.ps1 Resolved
Co-authored-by: Copilot <[email protected]>

Copilot-Session: cb83d078-4ba7-4f9f-86e5-7840b221515c
@missymessa

Copy link
Copy Markdown
Member Author

The removal of the legacy parameters is intentional for AB#12467: retaining them would preserve the RSA-key path this work is retiring. GitHub code search shows the legacy key names only in Arcade's temporary manifest declarations, generated OneLoc template copies, and dotnet-monitor's release pipeline. The dnceng/internal and DevDiv/DevDiv OneLocBuildVariables groups already contain the composite App ID/private-key projections; dotnet-monitor's Release-Pipeline group does as well. Rollout is staged: merge and flow this change, migrate dotnet-monitor in the dependency update PR, validate both production paths, then remove the manifest declarations and Key Vault keys. I also removed the duplicate ErrorActionPreference assignment from the latest review.

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.

🟡 Changes recommended

The updated token-minting path still appears to use a placeholder Authorization header in GitHub API calls, and the template parameter removals should provide a clearer/non-breaking migration experience per Arcade breaking-change policy.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (3)

Previously missed (2) — in code that hasn't changed since the last review.

eng/common/core-templates/job/onelocbuild.yml:101

  • If the deprecated Key Vault signing parameters are kept for compatibility, they should fail fast with an actionable error instead of being silently ignored. Add an explicit error step when any of the legacy GitHubApp* Key Vault parameters are set.
    eng/common/core-templates/steps/get-github-app-token.yml:49
  • If deprecated Key Vault parameters are reintroduced for compatibility, add a template-time guard step that fails with an actionable message when any of them are provided, so callers don’t mistakenly think Key Vault signing is still supported.

eng/common/core-templates/job/onelocbuild.yml:16

  • This removes the legacy GitHub App Key Vault signing parameters from the OneLocBuild job template surface. Any pipelines still passing the old parameters will now fail at template expansion with an "Unexpected parameter" error; Arcade policy discourages breaking changes within a major version (Documentation/Policy/ChangesPolicy.md). Consider keeping the old parameter names as deprecated placeholders (defaulting to empty) so callers get a clearer migration error at runtime instead of a compile-time failure.
  # GitHub App authentication for the OneLoc check-in PR. These values come
  # from the Key Vault-backed OneLocBuildVariables variable group.
  GitHubAppId: $(oneloc-localization-app-app-id)
  GitHubAppPrivateKey: $(oneloc-localization-app-app-private-key)

  SourcesDirectory: $(System.DefaultWorkingDirectory)
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread eng/common/Get-GitHubAppToken.ps1 Resolved
Document the required move from Key Vault RSA parameters to the github-app-secret App ID and private key without retaining the legacy signing path.

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

Copilot-Session: cb83d078-4ba7-4f9f-86e5-7840b221515c
Copilot AI review requested due to automatic review settings September 9, 2026 22:07
@missymessa
missymessa requested a review from garath September 9, 2026 22:09
@missymessa
missymessa marked this pull request as ready for review September 9, 2026 22:09

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.

🟢 Approval recommended

The functional migration to Secret Manager-provided GitHub App credentials is consistent across script/templates/docs, with only minor message-text nits noted.

Review details

Suppressed comments (3)

eng/common/Get-GitHubAppToken.ps1:41

  • Similarly, the “unresolved pipeline variable” error message hardcodes “Key Vault-backed variable group”. The script can’t know the source, so the message should refer generically to the variable group/secret variables supplying the values.
    Write-PipelineTelemetryError -Category 'Build' -Message "The GitHub App ID or private key is an unresolved pipeline variable. Verify the pipeline includes and is authorized to use its Key Vault-backed variable group."

eng/common/Get-GitHubAppToken.ps1:70

  • The host message says “Secret Manager private key”, but the script only depends on the environment variable content. Using more generic wording keeps the script reusable for other consumers and avoids implying a specific secret source.
Write-Host 'Signing JWT with the Secret Manager private key...'

eng/common/Get-GitHubAppToken.ps1:81

  • The signing failure message hardcodes “Secret Manager private key”, but the key source is just the environment variable. Consider using generic wording to match the script’s actual contract.
    Write-PipelineTelemetryError -Category 'Build' -Message "Failed to sign the GitHub App JWT with the Secret Manager private key: $_"
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread eng/common/Get-GitHubAppToken.ps1 Resolved
Describe the environment-variable contract without assuming the pipeline's secret delivery mechanism.

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

Copilot-Session: cb83d078-4ba7-4f9f-86e5-7840b221515c
Copilot AI review requested due to automatic review settings September 9, 2026 22:19

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

It changes a shared authentication mechanism and secret-handling path in core templates, which warrants final human review despite no specific defects found in this diff.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 9, 2026 22:32

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

It modifies shared pipeline authentication primitives (JWT signing/token minting) and removes legacy parameters in core templates, which warrants final human review given the broad downstream impact.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 10, 2026 19:23

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

It changes a security-sensitive authentication flow (GitHub App token minting) in shared build infrastructure, and warrants final human verification of end-to-end behavior across consuming pipelines.

Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@missymessa

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@missymessa
missymessa merged commit 14e97be into dotnet:main Sep 11, 2026
12 checks passed
@missymessa

Copy link
Copy Markdown
Member Author

Production regression confirmed after merge: arcade-official-ci builds 3072623, 3072891, and 3072937 failed because the shared OneLoc job did not import OneLocBuildVariables, leaving the new GitHub App variables unresolved. Corrective PR: #17541

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