fix(secret-references): resolve dotted local secret names before env.path.key#6492
Open
jaydeep-pipaliya wants to merge 1 commit into
Open
fix(secret-references): resolve dotted local secret names before env.path.key#6492jaydeep-pipaliya wants to merge 1 commit into
jaydeep-pipaliya wants to merge 1 commit into
Conversation
…path.key
Secret names may contain dots (e.g. when targeting `appsettings.json`-style
transforms in Azure DevOps), but `${A.B}` was always parsed as a nested
reference to env=A, secret=B at root — making `${Secret.Reference}` fail to
resolve a local secret literally named `Secret.Reference`.
The expansion step now tries the dotted local name first and only falls
back to env.path.key when no local secret with that exact name exists.
Existing nested references (e.g. `${prod.deep.KEY}`) are unaffected.
Fixes Infisical#5962
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.
Context
${A.B}was always parsed as a nested reference (env=A, secret=B at root), so a local secret literally named with a dot — e.g.Secret.Referenceor anyappsettings.json-style transform key that contains dots — could not be referenced from another secret. The Reference Tree UI also broke on these refs (showing "No Value"), because both the runtime expansion and the stack-trace path share the same parser.The fix is at the expansion layer (
recursivelyExpandSecretinbackend/src/services/secret-v2-bridge/secret-reference-fns.ts):This preserves every existing nested reference (cross-env, cross-path) and unblocks dotted local names without changing any storage format.
$validateSecretReferencesalready silently skips references to non-existent envs (backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts:192), so the parser's nested-by-default classification of dotted refs at write time is harmless.Fixes #5962
Steps to verify the change
Secret.Reference = testin any env at/.Secret_Test = \${Secret.Reference}in the same env at/.Secret_Test. Expected: resolves totest. Previously: "No Value".\${prod.deep.KEY}from a dev secret should still resolve to theKEYin envprodat/deep.Type
Checklist
secret-reference-fns.test.ts:\${prod.deep.nested.KEY}) still classified correctly\${HELLO}) still localmainwithout the source change