test(secrets): pin what happens to a secret's value on each authorship transition - #676
Open
JeroenSoeters wants to merge 1 commit into
Open
test(secrets): pin what happens to a secret's value on each authorship transition#676JeroenSoeters wants to merge 1 commit into
JeroenSoeters wants to merge 1 commit into
Conversation
…p transition A secret's value has three authorship modes: seeded and enforced, seeded once, and not seeded, where the value is authored outside formae, which is what an imported secret looks like. The transitions between them were untested, and they are where a live credential could be destroyed by accident. Under reconcile a field absent from the forma is normally removed. For a write-only secret that would clear a live credential on the first apply of a forma that merely stopped restating it, so the rule is the opposite: an omitted value means don't touch. That already holds; nothing enforced it. Three tests, one per transition. An omitted value produces no operation on that field and is never removed or resubmitted. A secret whose seed was removed settles rather than drifting, asking the provider for nothing on a re-apply, since the value is no longer formae's to enforce. Getting rid of a value is done by destroying the secret, and a consumer still pointing at it fails loudly rather than carrying on against something that no longer exists.
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.
What
A secret's value has three authorship modes — seeded and enforced, seeded once, and not seeded (the value authored outside formae, which is what an imported secret looks like). The transitions between them had no test coverage at all, and they are exactly where a live credential could be destroyed by accident.
Under reconcile, a field absent from the forma is normally removed. Applied to a write-only secret that would clear a live credential the first time someone applied a forma that merely stopped restating it. The rule is the opposite: an omitted value means don't touch, and there is no "clear the value" operation — getting rid of a value means destroying the secret.
I verified the behaviour is already correct before writing these. They are regression guards, not fixes: nothing stopped a future refactor turning omission into a
removeop.The three transitions
Note on an unrelated pre-existing failure
TestContractAuthFailureininternal/cli/connectionfails on a clean checkout ofmainon this machine, independently of this change. It reads the developer's real localprodprofile, so it is environment-dependent, and on failure it prints the actual bearer token to the console. Both worth fixing, neither touched here.make test-unitis otherwise green, andmake lintis clean.