Repository navigation
fix(sops): writ encrypts and decrypts every secret as its bytes, so token.sops deploys as its plaintext - #1148
Merged
David-Noble-at-work merged 5 commits intoOct 24, 2026
Conversation
… so token.sops deploys as its plaintext (#977) Lane 47 of #949. One mode, sops's binary store, in both directions; the format detection deleted. Every test compares what it observes with what it expects, entire, and a round trip of test files comes back byte for byte. How writ finds .sops.yaml is #1144, elsewhere. Reviewed with the owner 2026-10-22.
…decrypted output is compared entire (#977) Lane 47 of #949, Phase 2. Nine test files in pkg/sops/testdata/roundtrip go through writ's encrypter and back under their names plus .sops, each compared with the file byte for byte; the deploy test adds token.sops, encrypted by writ's encrypter; the encryption provider's and the deploy test's fragment checks compare the whole output. Against today's code all nine files fail, and the deploy test fails on token.sops; the plan records how each fails.
…oken.sops deploys as its plaintext (#977) Lane 47 of #949, Phase 3, ruled 2026-10-22: one mode, sops's binary store, in both directions, whatever the file is called. detectFormat and storeForFormat are deleted, and with them the JSON wrapper a name with no format deployed as, the reformatting of YAML and JSON secrets, the refusal of text named .yaml that is not YAML, and the .env and .ini documents IsEncrypted did not recognize. Client.Decrypt takes the data alone. The encryption provider's and the deploy test's ciphertext is made by writ's own encrypter. writ secret encrypt's help, two doc comments and the writ guide no longer say the format comes from the name or from .sops.yaml. All nine round-trip files come back byte for byte.
… over; the plan complete (#977)
…/977-secret-with-no-format-before
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
Lane 47 of #949.
.yaml,.yml,.json,.envand.ini, where sops parses the document and encrypts each value, and binary for anything else. Decrypting a name with no format, it looked at the ciphertext instead, saw the{every binary document begins with, and read it as JSON, sotoken.sopsdeployed as{"data": "..."}. Writ now encrypts and decrypts every secret in sops's binary mode, whatever the file is called, and deploys the bytes that were encrypted.detectFormatandstoreForFormatare deleted;Client.Decrypttakes the data alone. Ruled: "I don't like doing things two ways when one way works. as long as i have sops edit, why do i care about structured".0e7bcdd4: YAML and JSON secrets came back rewritten (comments moved, quotes dropped, indentation changed); text named.yamlthat is not YAML was refused at encryption; and.envand.inisecrets encrypted to documentsIsEncrypteddid not recognize, which decryption would have passed through as ciphertext.pkg/sops/testdata/roundtrip, among themtoken,blob(a NUL and bytes that are not UTF-8), YAML with comments, JSON, dotenv, INI, a PEM and text named.yamlthat is not YAML, go through writ's encrypter and back and are compared byte for byte; all nine failed at0e7bcdd4and all nine pass. The deploy test addstoken.sops, and its checks, and the encryption provider's, compare whole outputs instead of fragments; their ciphertext is made by writ's own encrypter.writ secret encrypt's help, two doc comments and the writ guide say each file is encrypted as its bytes,.sops.yamlgiving the recipients; the guide sayssops decryptshows a secret andsops editchanges one. A secret encrypted before in structured mode would need encrypting again; none exists in any of the three layers..sops.yaml, which differs from sops's way, is writ finds and applies .sops.yaml differently from sops: from the secret's directory, through a chain with a devlore fallback, SOPS_CONFIG ignored, a malformed file skipped silently #1144.docs/plans/fix/977-secret-with-no-format-before.md.Resolves #977
Test plan
0e7bcdd4and pass with the fix;make testmake check-allWritten with AI assistance.
Signed-off-by: David Noble [email protected]
Assisted-by: Claude Code
Time
Computed by the algorithm of noblefactor-ops#188 at merge.