initial commit on Federted servers
release gate / check (push) Failing after 8m35s

This commit is contained in:
Andrew S Erwin
2026-10-19 16:23:55 -05:00
commit b9721ff13f
217 changed files with 31534 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
package signals
import (
"context"
"strings"
"testing"
"time"
)
// Review NET-02: mailbox credentials must never travel over a plaintext
// socket unless the explicit development fixture flag is set.
func TestPlaintextTransportRejected(t *testing.T) {
t.Setenv("INTEGRATIONS_ALLOW_INSECURE_IMAP", "")
if e := checkTransport(Mailbox{TLS: false}); e == nil {
t.Fatal("plaintext mailbox accepted without the development flag")
}
if e := checkTransport(Mailbox{TLS: true}); e != nil {
t.Fatalf("TLS mailbox rejected: %v", e)
}
// The guard runs before any dial, so Connect fails fast without network.
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
_, e := Connect(ctx, Mailbox{Host: "127.0.0.1", Port: 1, TLS: false})
if e == nil || !strings.Contains(e.Error(), "TLS is required") {
t.Fatalf("plaintext Connect was not refused up front: %v", e)
}
t.Setenv("INTEGRATIONS_ALLOW_INSECURE_IMAP", "1")
if e := checkTransport(Mailbox{TLS: false}); e != nil {
t.Fatalf("development fixture flag did not permit plaintext: %v", e)
}
}