fix: validate cross-app secret refs against empty target envs#881
Merged
Conversation
Signed-off-by: rohan <rohan.chaturvedi@protonmail.com>
nimish-ks
approved these changes
May 18, 2026
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.
Summary
Fixes a false negative in
validateSecretReferenceswhere cross-app references like${app::env.MISSING_KEY}were not flagged as broken when the target env's decrypted key list was empty.Root cause
The cross-app key check was guarded by
crossAppEnvKeys.length > 0 &&, which silently skipped validation whenever the target env's key list was[]. That conflated two distinct cases:useOrgSecretKeysset the entry to[]as a fallback when env-key unwrap threw.[].The second case meant any
${app::env.X}ref against an empty env passed validation, even though the key clearly doesn't exist.Fix
frontend/hooks/useOrgSecretKeys.ts: on unwrap failure, leaveenvSecretKeys[env]undefined instead of[]. This lets validation distinguish "no visibility" from "empty env".frontend/utils/secretReferences.ts: cross-app key check now usescrossAppEnvKeys !== undefinedinstead oflength > 0. Undefined → skip (we can't see the keys); defined (including[]) → strict check.Test plan
validateSecretReferencestests still pass (82 → 84 with new cases)tsc --noEmitclean${OtherApp::env.NONEXISTENT}against an env with secrets and confirm warning fires