Visitar URL original
Don't require the passphrase to read non-secret stack outputs by giladg · Pull Request #23820 · pulumi/pulumi · GitHub
Skip to content

Don't require the passphrase to read non-secret stack outputs - #23820

Merged
giladg merged 1 commit into
masterfrom
giladg/21141-stack-output-no-passphrase
Jul 9, 2026
Merged

giladg merged 1 commit into
masterfrom
giladg/21141-stack-output-no-passphrase

Conversation

@giladg

@giladg giladg commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Problem

For passphrase-encrypted stacks, pulumi stack output (of a non-secret output) and pulumi about failed unless PULUMI_CONFIG_PASSPHRASE (or PULUMI_CONFIG_PASSPHRASE_FILE) was set:

$ pulumi stack output aString
error: constructing secrets manager of type "passphrase": ... passphrase must be set with PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE environment variables

These commands deserialize the stack's outputs, which eagerly constructs the secrets manager and decrypts every secret up front — even ones the command never displays. So reading a plain string output, or listing resources in pulumi about, demanded the passphrase unnecessarily.

Fixes #21141

Fix

Add a shared BlindingProvider (in pkg/backend/secrets) that redacts every secret to config.BlindingCrypter's [secret] sentinel instead of decrypting it, so a checkpoint can be read without any secrets-provider credentials. It's used when:

  • pulumi stack output is run without --show-secrets — non-secret outputs are shown, secrets are masked as [secret]. With --show-secrets the real provider is still used and the passphrase is still required.
  • pulumi about reads the snapshot — it only reports resource types and URNs, never secret values.

This consolidates the equivalent blinding provider that already existed locally in pulumi policy analyze, which now reuses the shared one.

Behavior (passphrase unset)

Command Before After
stack output aString error from-qa
stack output (all) error aString shown, aSecret → [secret]
stack output aSecret error [secret]
about error stack info listed
stack output aSecret --show-secrets error error (unchanged — passphrase still required)
stack output aSecret --show-secrets (passphrase set) real value real value (unchanged)

Testing

  • Unit tests for BlindingProvider in pkg/backend/secrets/providers_test.go.
  • Existing stack, about, and policy package tests pass.
  • Manually verified the behavior matrix above against a passphrase-encrypted diy-backend stack.

🤖 Generated with Claude Code

@giladg
giladg requested a review from a team as a code owner July 8, 2026 06:03
@giladg
giladg force-pushed the giladg/21141-stack-output-no-passphrase branch from 51d7841 to ca54deb Compare July 8, 2026 06:04
Comment thread pkg/cmd/pulumi/stack/stack_output.go Outdated
Comment on lines +147 to +150
// When we're not showing secrets, deserialize with a provider that redacts every secret to "[secret]" instead
// of decrypting it. This lets us read non-secret outputs (and display masked secrets) without prompting for a
// passphrase or other secrets-provider credentials. When --show-secrets is set we use the real provider, which
// will require those credentials in order to decrypt.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// When we're not showing secrets, deserialize with a provider that redacts every secret to "[secret]" instead
// of decrypting it. This lets us read non-secret outputs (and display masked secrets) without prompting for a
// passphrase or other secrets-provider credentials. When --show-secrets is set we use the real provider, which
// will require those credentials in order to decrypt.

This is unnecessarily descriptive.

@giladg giladg Jul 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, I shortened the description.

@giladg
giladg force-pushed the giladg/21141-stack-output-no-passphrase branch 2 times, most recently from 2186fc2 to 40f6886 Compare July 8, 2026 17:53
@Frassle

Frassle commented Jul 9, 2026

Copy link
Copy Markdown
Member

If you merge master that test should be fixed now

For passphrase-encrypted stacks, `pulumi stack output` (of a non-secret
output) and `pulumi about` previously failed unless PULUMI_CONFIG_PASSPHRASE
(or PULUMI_CONFIG_PASSPHRASE_FILE) was set, because deserializing the stack's
outputs eagerly constructed the secrets manager and decrypted every secret
up front — even ones the command never displays.

Add a shared `BlindingProvider` (backend/secrets) that redacts every secret
to the "[secret]" sentinel instead of decrypting it, so a checkpoint can be
read without any secrets-provider credentials. Use it when:

- `pulumi stack output` is run without `--show-secrets` (non-secret outputs
  are shown, secrets are masked as `[secret]`). With `--show-secrets` the real
  provider is still used and the passphrase is still required.
- `pulumi about` reads the snapshot (it only reports resource types and URNs,
  never secret values).

This consolidates the equivalent blinding provider that already existed
locally in `pulumi policy analyze`, which now reuses the shared one.

Fixes #21141

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@giladg
giladg force-pushed the giladg/21141-stack-output-no-passphrase branch from 40f6886 to 18c3222 Compare July 9, 2026 16:56
@giladg
giladg added this pull request to the merge queue Jul 9, 2026
Merged via the queue into master with commit 5e51fe4 Jul 9, 2026
123 checks passed
@giladg
giladg deleted the giladg/21141-stack-output-no-passphrase branch July 9, 2026 18:41
@pulumi-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped in release v3.252.0.

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.

Can not get non-secret stack outputs without PULUMI_CONFIG_PASSPHRASE

4 participants