Skip to content

Read OneLoc GitHub App credentials through WIF - #17541

Merged
missymessa merged 7 commits into
dotnet:mainfrom
missymessa:missymessa/fix-oneloc-variable-group
Sep 11, 2026
Merged

missymessa merged 7 commits into
dotnet:mainfrom
missymessa:missymessa/fix-oneloc-variable-group

Conversation

@missymessa

@missymessa missymessa commented Sep 11, 2026 •

Copy link
Copy Markdown
Member

Fixes the production regression introduced by #17528 without restoring the legacy OneLocBuildVariables dependency.

The Secret Manager-backed GitHub App ID and PEM private key remain in EngKeyVault. The shared OneLoc job now uses the existing project-scoped WIF service connection to read those two values directly, signs the GitHub App JWT inside the authenticated Azure CLI task, and passes only the short-lived installation token to OneLocBuild.

Security boundary:

  • dnceng-oneloc-githubapp is used in dnceng/internal
  • devdiv-oneloc-githubapp is selected automatically in DevDiv/DevDiv
  • each identity has Key Vault Secrets User at only the two exact secret scopes
  • no vault-wide secret access, PAT fallback, or OneLocBuildVariables import
  • the PEM private key remains local to the token-minting process and is not stored as a pipeline variable

Affected production builds:

  • 3072623
  • 3072891
  • 3072937

Validation:

  • YAML and PowerShell syntax parse successfully
  • git diff --check passes
  • the live Secret Manager PEM projection imports and signs successfully
  • all four exact secret-scope RBAC assignments are present
  • Arcade official pipeline 6 is authorized to use the dnceng WIF service connection
  • no OneLoc variable-group or raw App-credential parameter references remain

The legacy RSA-key permissions are intentionally retained until this path succeeds in production; removing them and cleaning up the variable groups remains post-rollout work under AB#12331/AB#12467.

Protected pre-merge canary:

  • dnceng/internal build 3073235 succeeded using this PR's exact WIF -> Key Vault REST -> PEM signing -> GitHub installation-token path.

  • Canary 3073233 caught the Azure CLI 2.90 az keyvault secret show failure before merge; the implementation now uses authenticated Key Vault data-plane REST instead.

  • dnceng/internal build 3073273 succeeded after adding the review-requested Key Vault hostname validation.

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

Make the variable-group import conditional for GitHub repositories so supported Azure DevOps jobs are not affected.

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

Pull request overview

Fixes OneLoc GitHub App authentication by importing the project-local variable group and updating setup documentation.

Changes:

  • Imports OneLocBuildVariables in the shared OneLoc job.
  • Clarifies variable-group authorization requirements.
File summaries
File Summary
eng/common/core-templates/job/onelocbuild.yml Imports OneLoc GitHub App variables.
Documentation/OneLocBuildGitHubApp.md Updates setup and authorization guidance.
Review details

Suppressed comments (1)

Documentation/OneLocBuildGitHubApp.md:40

  • This requirement is stated for every pipeline, but RepoType: azureDevOps remains a documented supported mode and does not consume these GitHub credentials. If the import is conditional on the repository type, this should limit the authorization requirement to GitHub-based pipelines; otherwise Azure DevOps users are told to grant unnecessary access to a secret group.
2. **Your pipeline must run in `dnceng/internal` or `DevDiv/DevDiv` and be authorized to use its
   project's Key Vault-backed `OneLocBuildVariables` variable group.** The shared OneLoc job
   imports the group automatically.
  • Files reviewed: 2/2 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.

Copilot AI review requested due to automatic review settings September 11, 2026 15:38

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

No unresolved review issues remain.

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

@missymessa
missymessa disabled auto-merge September 11, 2026 15:44
Copilot AI review requested due to automatic review settings September 11, 2026 16:03
@missymessa missymessa changed the title Import OneLoc GitHub App variable group Read OneLoc GitHub App credentials through WIF Sep 11, 2026
@missymessa
missymessa enabled auto-merge (squash) September 11, 2026 16:04

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

Security-sensitive credential changes have unresolved PEM handling and migration-documentation corrections.

Review details

Suppressed comments (2)

Documentation/OneLocBuildGitHubApp.md:110

  • The new step template declares azureSubscription and keyVaultName as required parameters, while the immediately preceding appId/appPrivateKey interface did not expose either of them. A direct caller migrating from the current template must add these parameters rather than “keep” them; otherwise template expansion fails for missing required inputs. Please update this migration text to describe replacing the old pair with all four new parameters.
Direct callers of `get-github-app-token.yml` keep `azureSubscription` and `keyVaultName`, remove
`keyName` and `appClientId`, and add `appIdSecretName` and `appPrivateKeySecretName`. There is no

eng/common/Get-GitHubAppToken.ps1:69

  • This validation runs before the PEM output is normalized. az ... --output tsv returns one PowerShell output element per line, so a PEM makes $value an array (as noted by the comment below); passing that array directly to the scalar IsNullOrWhiteSpace API can fail before the successful PEM reaches ImportFromPem. Join the native output before validating it and return the normalized string.
    if ($getExitCode -ne 0 -or [string]::IsNullOrWhiteSpace($value)) {
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 11, 2026 16:16

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

A critical KeyVaultName validation issue and two documentation migration nits remain unresolved.

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

Review details

Suppressed comments (2)

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

Documentation/OneLocBuildGitHubApp.md:110

  • These migration instructions do not match the direct-call API changed in this PR: the previous get-github-app-token.yml parameters were appId and appPrivateKey, not azureSubscription, keyVaultName, keyName, or appClientId. As written, existing direct callers are not told to replace the two inputs they actually used. Please document replacing appId/appPrivateKey with the four new parameters.

Documentation/OneLocBuildGitHubApp.md:107

  • This migration section omits the parameters exposed by the immediately previous OneLoc template. Before this change, callers could supply GitHubAppId and GitHubAppPrivateKey, and the new template removes them; callers that explicitly set them can now fail template expansion, but this text only says to remove the older RSA names. Please document removing the Secret Manager-variable parameters and using the four new service-connection/secret-name parameters.
The Key Vault RSA signing path has been removed. OneLoc callers must remove
`GitHubAppClientId` and `GitHubAppKeyName`. `GitHubAppServiceConnection` and
`GitHubAppKeyVaultName` now identify the least-privilege path used to read the Secret Manager
projections. The shared defaults are sufficient for standard callers.
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread eng/common/Get-GitHubAppToken.ps1 Resolved
Copilot AI review requested due to automatic review settings September 11, 2026 16:21

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

Production authentication and secret-access changes require final human review.

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 11, 2026 16:35

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

Migration guidance needs alignment with the current template contract, and final human review is warranted.

Review details

Suppressed comments (1)

Documentation/OneLocBuildGitHubApp.md:110

  • The migration instructions do not match the template contract: the current get-github-app-token.yml parameters are azureSubscription, keyVaultName, appIdSecretName, and appPrivateKeySecretName (lines 17-30), while appId and appPrivateKey were the previous parameters. As written, a direct caller following this guidance may keep parameters that were never present and omit the required secret-name parameters.
Direct callers of `get-github-app-token.yml` keep `azureSubscription` and `keyVaultName`, remove
`keyName` and `appClientId`, and add `appIdSecretName` and `appPrivateKeySecretName`. There is no
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 11, 2026 16:52

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

Production WIF, Key Vault, and token-signing changes require final human review.

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

@MichaelSimons MichaelSimons left a comment

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.

Approving but calling out I am not an expert here.

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