Skip to content

Take a floored mode argument on the encryption actions #513

Closed

Description

@David-Noble-at-work

DecryptSopsFile and EncryptFile hardcode 0o600, making them the only writes in the catalog that do not
take a mode — every other one (Copy, Mkdir, WriteBytes, WriteText) does.

But the parameter cannot be free. Encrypting a file is the declaration that its contents are sensitive,
and the deployed mode already follows from that declaration
(tree/builder.go derives 0o600 from the pipeline containing
encryption.decrypt). A plain mode parameter would reopen that decision to a caller who can get it wrong,
and a world-readable secret fails silently: the file is written, the run succeeds, nothing reports it.

Ruled: take mode, and floor it on decrypt — refuse any mode granting group or other access, before
decrypting, so a rejected call never materializes plaintext. 0o600 and 0o400 remain expressible.

The encrypt side is not floored: its product is ciphertext, safe at rest by construction and destined for
a repository that stores it 0o644 regardless.

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions