Skip to content

Conversation

@jessehouwing
Copy link
Contributor

@jessehouwing jessehouwing commented Dec 1, 2025

Introduce functionality to read authentication tokens from standard input and environment variables, enhancing flexibility in credential management. Update tests to validate the new token sources.

Should fix: #519

This pull request introduces support for securely passing Azure DevOps Personal Access Tokens (PAT) via stdin, environment variables, and improves authentication flexibility and documentation. The most important changes include the addition of a --token-from-stdin option, updates to authentication priority, new documentation, and refactoring of credential handling logic. These changes enhance security, especially for CI/CD pipelines, and clarify usage for end users.

Authentication improvements:

  • Added a new StdinStringArgument class and registered the --token-from-stdin option, allowing tokens to be read securely from stdin. This is prioritized after explicit --token and before environment variables or stored credentials. [1] [2] [3]
  • Refactored credential resolution logic in TfCommand to support the new priority order: username/password, explicit token, token from stdin, environment variable (AZURE_DEVOPS_TOKEN), stored credentials, and interactive prompt. Also added mutual exclusivity checks for --token and --token-from-stdin. [1] [2]

Documentation updates:

  • Updated README.md and docs/extensions.md to document new authentication methods, including environment variable and stdin usage, and clarified the recommended approaches for CI/CD and security. [1] [2]
  • Added a new docs/token-from-stdin.md file detailing usage scenarios, priority order, and security benefits of the --token-from-stdin feature.

Testing and dependency changes:

  • Added adm-zip as a dependency and integrated it into test setup, along with new test utility to enforce Azure token isolation in integration tests. [1] [2] [3] [4]

Minor improvements:

  • Refactored manifest gathering logic in merger.ts for clarity and async/await usage. [1] [2]
  • Bumped package version to 0.23.0 to reflect new features.

@jessehouwing jessehouwing marked this pull request as ready for review December 1, 2025 20:49
@jessehouwing jessehouwing requested review from a team as code owners December 1, 2025 20:49
@jessehouwing
Copy link
Contributor Author

@tarunramsinghani this adds support for reading the token from the AZURE_DEVOPS_TOKEN variable or from stdin.

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.

Feature request: support using environment variables for Personal Access Tokens (PATs).

1 participant