MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / TestSignMessage_SignErrorFailsOpen

Function TestSignMessage_SignErrorFailsOpen

internal/outbound/sender_test.go:190–208  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

188}
189
190func TestSignMessage_SignErrorFailsOpen(t *testing.T) {
191 // Store returned a selector + bytes, but the bytes aren't a
192 // valid PKCS#1 RSA private key (corruption, partial-write, etc).
193 // dkim.Sign returns an error; we log and proceed unsigned. A
194 // panic here would crash the outbound goroutine for every send.
195 lookup := &fakeDKIMLookup{
196 get: func(_ context.Context, _ string) (string, []byte, error) {
197 return "e2a202605", []byte("definitely-not-a-key"), nil
198 },
199 }
200 s := NewSenderWithDKIM(nil, "example.com", lookup)
201 signed, ok := s.signMessage([]byte(validTestMessage), "example.com")
202 if ok {
203 t.Errorf("ok = true, want false (sign should fail on garbage key)")
204 }
205 if signed != nil {
206 t.Errorf("signed != nil on sign error")
207 }
208}
209
210func TestSignMessage_HappyPathPrependsSignatureHeader(t *testing.T) {
211 // Generate a real keypair, hand it to the fake lookup, sign the

Callers

nothing calls this directly

Calls 2

NewSenderWithDKIMFunction · 0.85
signMessageMethod · 0.80

Tested by

no test coverage detected