Skip to content

[SFI-PS3.1] Avoid passing NuGet credentials on PowerShell command lines - #17276

Merged
missymessa merged 2 commits into
dotnet:mainfrom
missymessa:missymessa/sfi-setupnugetsources-token-env
Aug 7, 2026
Merged

missymessa merged 2 commits into
dotnet:mainfrom
missymessa:missymessa/sfi-setupnugetsources-token-env

Conversation

@missymessa

@missymessa missymessa commented Aug 6, 2026 •

Copy link
Copy Markdown
Member

Summary

  • read PowerShell and Bash feed credentials from the Token environment variable
  • stop passing legacy and federated credentials on maintained Arcade template command lines
  • retain Password and the Bash positional argument as compatibility fallbacks for existing custom consumers
  • update SetupNugetSources tests to exercise environment-based credential delivery
  • remove a helper dependency on the script-scoped username variable

Validation

  • Build.cmd -test -projects src\Microsoft.DotNet.SetupNugetSources.Tests\Microsoft.DotNet.SetupNugetSources.Tests.csproj -configuration Release
  • Build succeeded with 0 warnings and 0 errors; tests succeeded on net11.0/arm64
  • manually verified the legacy PowerShell -Password alias
  • manually verified Bash environment-based credential delivery and positional compatibility fallback

SFI KPI: [SFI-PS3.1] Security Code Scanning

Tracking: https://dev.azure.com/dnceng/internal/_workitems/edit/12139

Read feed credentials from the Token environment variable in the maintained pipeline template while retaining a legacy parameter alias for existing custom consumers.

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

Copilot-Session: 3eb6a0bd-11cc-4d7a-97ce-16e5d553f215
Copilot AI review requested due to automatic review settings August 6, 2026 23:30

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.

Pull request overview

This PR updates Arcade’s internal feed setup to avoid placing NuGet feed credentials on PowerShell command lines, shifting credential delivery to the Token environment variable while keeping -Password as a compatibility alias for existing callers.

Changes:

  • Update SetupNugetSources.ps1 to read credentials from $env:Token (with -Password aliased to -Credential) and propagate the renamed parameter through helper functions.
  • Update the enable-internal-sources.yml template PowerShell invocations to stop passing -Password ... on the command line and instead provide Token via env:.
  • Update test script execution to provide the credential via an environment variable when invoking PowerShell.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/Microsoft.DotNet.SetupNugetSources.Tests/ScriptRunner.cs Switch PowerShell test invocation to pass credentials via Token environment variable instead of command-line args.
eng/common/SetupNugetSources.ps1 Introduce -Credential (with -Password alias) and prefer $env:Token; propagate credential parameter through feed/credential helper functions.
eng/common/core-templates/steps/enable-internal-sources.yml Remove -Password ... from PowerShell step arguments and pass Token via environment variables.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread eng/common/SetupNugetSources.ps1 Resolved
Use the Token environment variable for the maintained Bash template and tests, retain positional compatibility, and remove the helper's global username dependency.

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

Copilot-Session: 3eb6a0bd-11cc-4d7a-97ce-16e5d553f215
Copilot AI review requested due to automatic review settings August 6, 2026 23: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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@missymessa
missymessa merged commit f2f2a57 into dotnet:main Aug 7, 2026
10 of 12 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-rc1 milestone Aug 10, 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