diff options
| author | Gab <24553253+gabrix73@users.noreply.github.com> | 2026-08-13 14:04:30 +0200 |
|---|---|---|
| committer | Gab <24553253+gabrix73@users.noreply.github.com> | 2026-08-13 14:04:30 +0200 |
| commit | 994071243fc80990cf09e820b671006e9bd31c76 (patch) | |
| tree | b65e02724b98033240aa6f9d153acea021abc456 /katzenpost/dispatcher/envelope_test.go | |
| parent | 47d903de3bca4165e96d6ec8830eafbacf524cd2 (diff) | |
| download | yamnweb-994071243fc80990cf09e820b671006e9bd31c76.tar.gz yamnweb-994071243fc80990cf09e820b671006e9bd31c76.tar.xz yamnweb-994071243fc80990cf09e820b671006e9bd31c76.zip | |
Separate active YAMN code from Katzenpost PoC
Diffstat (limited to 'katzenpost/dispatcher/envelope_test.go')
| -rw-r--r-- | katzenpost/dispatcher/envelope_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/katzenpost/dispatcher/envelope_test.go b/katzenpost/dispatcher/envelope_test.go new file mode 100644 index 0000000..712071c --- /dev/null +++ b/katzenpost/dispatcher/envelope_test.go @@ -0,0 +1,21 @@ +package dispatcher + +import "testing" + +func TestEnvelopeValidate(t *testing.T) { + allowed := map[string]struct{}{"remailer.example": {}} + valid := Envelope{ + EntryAddress: "entry@remailer.example", + Message: []byte("To: entry@remailer.example\nFrom: mix@nowhere.invalid\n\n-----BEGIN REMAILER MESSAGE-----\nabc\n"), + } + if err := valid.Validate(allowed); err != nil { + t.Fatalf("expected valid envelope: %v", err) + } + + invalidDomain := valid + invalidDomain.EntryAddress = "entry@other.example" + invalidDomain.Message = []byte("To: entry@other.example\n-----BEGIN REMAILER MESSAGE-----\n") + if err := invalidDomain.Validate(allowed); err == nil { + t.Fatal("expected unknown domain rejection") + } +} |
