fix: preserve nested .gpg-id scope during key selection - #187
Merged
Merged
Conversation
|
✅ Fix pushed: Fixed the failing test by handling empty relative paths in |
|
⏸️ CI Auto-Fix paused A user commit was detected after an automated fix. CI auto-fix is now paused To resume CI auto-fix, use the |
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.
Fixes #184
An empty/missing
subDircan collapse to the physical password-store root becauseFile(repoRoot, "")resolves torepoRoot. That makes both recipient lookup and the key-selection callback capable of consulting or creating a root.gpg-ideven when the operation originated in a nested subtree.This change keeps the operation scope separate from the repository root:
subDirexactly as suppliedsubDir == ""), recover it from the immutable operation path (EXTRA_FILE_PATH)SUB_PATHpassed through the key pickerSUB_PATHis unexpectedly absentBackward compatibility
The compatibility baseline for this fix is v1.21.0, before the full Pass-Secrets integration released in v1.22.0 (the version used in #184).
Before Pass-Secrets:
requireEncryptionKeysExist; root was represented as/and nested directories as values such as/ID-Pessoal/HGrelativeParentPathdirectly torequireDecryptionKeysExist, producing scopes such as/ID-Pessoal/HG/The v1.22 Pass-Secrets preflight kept those same PGP scope inputs. This patch therefore preserves every non-empty explicit scope byte-for-byte, including the legacy leading/trailing separator forms, and changes behavior only for the lost/invalid empty scope that can otherwise be mistaken for the physical repository root.
Regression tests lock down:
//ID-Pessoal/HG/ID-Pessoal/HG/.gpg-idtrust boundaries and no Pass-Secrets metadata is not claimed by Pass-Secrets and does not gain a root.gpg-idThis keeps pre-Pass-Secrets
.gpg-idlookup semantics intact while preventing the new failure mode from widening a nested operation to repository scope.