Repository navigation
Read OneLoc GitHub App credentials through WIF - #17541
Conversation
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟡 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
OneLocBuildVariablesin 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: azureDevOpsremains 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.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🔵 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
azureSubscriptionandkeyVaultNameas required parameters, while the immediately precedingappId/appPrivateKeyinterface 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 tsvreturns one PowerShell output element per line, so a PEM makes$valuean array (as noted by the comment below); passing that array directly to the scalarIsNullOrWhiteSpaceAPI can fail before the successful PEM reachesImportFromPem. 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
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
🟡 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.ymlparameters wereappIdandappPrivateKey, notazureSubscription,keyVaultName,keyName, orappClientId. As written, existing direct callers are not told to replace the two inputs they actually used. Please document replacingappId/appPrivateKeywith 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
GitHubAppIdandGitHubAppPrivateKey, 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
There was a problem hiding this comment.
🔵 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.ymlparameters areazureSubscription,keyVaultName,appIdSecretName, andappPrivateKeySecretName(lines 17-30), whileappIdandappPrivateKeywere 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
Co-authored-by: Copilot <[email protected]>
MichaelSimons
left a comment
There was a problem hiding this comment.
Approving but calling out I am not an expert here.
Co-authored-by: Copilot <[email protected]>
Fixes the production regression introduced by #17528 without restoring the legacy
OneLocBuildVariablesdependency.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-githubappis used indnceng/internaldevdiv-oneloc-githubappis selected automatically inDevDiv/DevDivKey Vault Secrets Userat only the two exact secret scopesOneLocBuildVariablesimportAffected production builds:
Validation:
git diff --checkpassesThe 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 showfailure 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.