fix(secret): log an error when a secret reference cannot be resolved#13737
Open
shreemaan-abhishek wants to merge 1 commit into
Open
fix(secret): log an error when a secret reference cannot be resolved#13737shreemaan-abhishek wants to merge 1 commit into
shreemaan-abhishek wants to merge 1 commit into
Conversation
An unresolvable $secret:// or $env:// reference silently falls back to the literal reference string, which is then used verbatim as a password, key or token. On the cached path (used by plugin conf resolution) the underlying error was swallowed entirely, so a missing secret manager or an unset environment variable produced no diagnostic at all. Report the failure with the field name and the underlying error, and drop the now-duplicated log in the uncached branch.
shreemaan-abhishek
force-pushed
the
fix/secret-ref-silent-failure
branch
from
July 24, 2026 04:48
50dd841 to
14fc0f1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
An unresolvable
$secret://or$env://reference silently falls back to the literal reference string:The literal is then used verbatim as whatever the field is: a password, an API key, an AWS access key ID. Nothing tells the operator that resolution failed. On the cached path (
use_cache = true, which is what plugin conf resolution inplugin.filter()uses) the error returned by the secret manager was swallowed entirely, so a missing/apisix/secrets/<manager>/<id>resource or an unset environment variable produced no log line at all.The failure mode this surfaces in practice: the raw reference goes upstream as a credential, and the operator only sees the provider's rejection. A user hit exactly this with
ai-proxy+ Bedrock, where the unresolved reference ended up inside the SigV4 credential scope:with no corresponding error in APISIX's log.
This PR keeps the existing fallback behaviour (documented, and changing it would break existing deployments) but makes the failure visible:
It covers both failure shapes: a manager error (
no secret conf, backend failure) and a reference that simply resolves to nothing (unset environment variable), which previously returnednilwithout an error on either path.The now-duplicated log in the uncached branch is dropped, since the caller logs with more context (the field name).
Which issue(s) this PR fixes
N/A
Checklist