| 618 | } |
| 619 | |
| 620 | func TestUnencryptedCommentRegexFail(t *testing.T) { |
| 621 | branches := TreeBranches{ |
| 622 | TreeBranch{ |
| 623 | TreeItem{ |
| 624 | Key: Comment{Value: "sops:noenc"}, |
| 625 | Value: nil, |
| 626 | }, |
| 627 | TreeItem{ |
| 628 | Key: "foo", |
| 629 | Value: "bar", |
| 630 | }, |
| 631 | }, |
| 632 | } |
| 633 | tree := Tree{Branches: branches, Metadata: Metadata{UnencryptedCommentRegex: "ENC"}} |
| 634 | cipher := encPrefixCipher{} |
| 635 | _, err := tree.Encrypt(bytes.Repeat([]byte("f"), 32), cipher) |
| 636 | assert.ErrorContains(t, err, "Encrypted comment \"ENC:sops:noenc\" matches UnencryptedCommentRegex!") |
| 637 | } |
| 638 | |
| 639 | type MockCipher struct{} |
| 640 | |