Skip to content

Conversation

@mccoyp
Copy link
Member

@mccoyp mccoyp commented Jan 6, 2026

Description

Resolves #44047. The EnvironmentVariableLoader currently passes all environment variable values to tests as plain strings. A consequence of this is that variable values can be exposed in pytest outputs, since pytest logs the test inputs and local variables upon failure. While this is helpful for debugging, it can be problematic when these variables are used to store secrets (e.g. account keys).

This PR adds a hide_secrets kwarg to the EnvironmentVariableLoader, which allows the user to specify which environment variables should be considered sensitive/secret. These variables will have their values wrapped in an EnvironmentVariable instance that has an overridden, redacted __str__ implementation to hide secrets in logs. To get the value during test execution, just use the .secret attribute wherever the value would have been used directly before.

This PR also migrates azure-storage-file-share tests to hide account keys.

As a draft, documentation in tests.md is pending. Storage tests have been confirmed locally to work in playback, but they still need to be tested in live mode.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@mccoyp mccoyp added Storage Storage Service (Queues, Blobs, Files) EngSys This issue is impacting the engineering system. labels Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

EngSys This issue is impacting the engineering system. Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose EnvironmentVariableLoader keys with object

1 participant