Repository navigation
fix(rekey): override filename so SOPS creation rules match - #18
Merged
Merged
Conversation
rekey encrypted from /dev/stdin without --filename-override, so SOPS matched that input path against the scope creation rule, found no match, and failed with "no matching creation rules found" before ever applying the explicit --age recipients. Every invocation hit this, because Prepare requires .sops.yaml to exist and SOPS runs from the scope directory. Pass --filename-override with the declared scope source, mirroring init. Using Config.Source rather than a literal keeps it aligned with the creation rule, which is generated from that same value. Add a regression test covering the encrypt argv. fakeSOPS now appends its argv recording instead of overwriting, because rekey invokes SOPS three times and the final verify call clobbered the arguments under test.
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.
rekey encrypted from /dev/stdin without --filename-override, so SOPS matched that input path against the scope creation rule, found no match, and failed with "no matching creation rules found" before ever applying the explicit --age recipients. Every invocation hit this, because Prepare requires .sops.yaml to exist and SOPS runs from the scope directory.
Pass --filename-override with the declared scope source, mirroring init. Using Config.Source rather than a literal keeps it aligned with the creation rule, which is generated from that same value.
Add a regression test covering the encrypt argv. fakeSOPS now appends its argv recording instead of overwriting, because rekey invokes SOPS three times and the final verify call clobbered the arguments under test.
This pull request updates the SOPS encryption command to always use the
--filename-overrideoption during rekey operations, ensuring that SOPS creation rules are properly matched even when reading from stdin. It also adds a new test to verify this behavior and improves the SOPS test helper to append command arguments for more robust testing.Bugfix: SOPS encryption command
newRekey()to add the--filename-overrideflag, ensuring the correct filename is passed for creation rule matching. This fixes an issue where SOPS would fail to match creation rules when encrypting from stdin.Testing improvements
TestRekeyOverridesFilenameForCreationRulesto verify that the--filename-overrideflag is correctly used during rekey, preventing failures due to unmatched creation rules.fakeSOPStest helper to append (>>) arguments instead of overwriting, allowing multiple invocations to be captured and tested.