Repository navigation
feat(settings): 1239 let the email sender skip auth and choose a tls policy - #682
Merged
Merged
Conversation
This was referenced Oct 8, 2026
lizzy-liang-bigstack
marked this pull request as ready for review
October 8, 2026 23:59
lizzy-liang-bigstack
force-pushed
the
1236-smtp-anonymous-tls
branch
3 times, most recently
from
October 9, 2026 00:31
09007c0 to
95b549c
Compare
Signed-off-by: Lizzy Liang <lizzy.liang@bigstack.co>
lizzy-liang-bigstack
force-pushed
the
1236-smtp-anonymous-tls
branch
from
October 12, 2026 09:45
95b549c to
37ab0b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
feature
Which issue(s) this PR fixes?
Fixes bigstack-oss/cubecos#1239 (part of the story bigstack-oss/cubecos#1236)
What this PR does?
An email sender can now skip authentication and choose a TLS policy, and the test mail honours both. Today
Sender.UserAuth()always handssmtp.SendMailaPlainAuth, which refuses to send credentials over a plaintext link, so a relay that accepts anonymous submission but still advertisesAUTHfails the test mail. There is also no way to pick a TLS policy.email.Sendergainsauthandtls(none/opportunistic/mandatory), the field names and values ofbigstack-dependency-go/pkg/email/v2.pkg/email/v2, andSender.UserAuth()is gone. Withauth: falsego-mail stays onNoAuthandAUTHis never attempted. Withauth: trueovertls: noneit usesPLAIN-NOENC.auth→ true if ausernameis giventls→mandatory, matching the v2 helper, so an old client never silently downgradestls→ 400 with the allowed valuesauthandtlskeep the sender's current values.""clears it on purpose, which is what the UI's "leave empty to clear it" tooltip already promises.auth: false: username and password are dropped, since they are never sent.null.tlspredates the field and is reported asopportunistic, which is how it was sent before.bigstack-dependency-gomoves to596a0a8. That is the first commit with the v2 interface andCc, and it predates the August dependency bumps, sogo.modonly addsgo-mail. The latest version would have also bumped slack 0.16 → 0.29 and k8s 0.33 → 0.36.api/cube-cos-openapi→ feat(settings): add auth and tls to the email sender cube-cos-openapi#122 (b22e829, which also carries develop's bps ranking examples).4d475ad) for #1746's SAML assertion decryption.go.modkeeps both develop'sgithub.com/beevik/etreeand this branch'sbigstack-dependency-gobump.Test results (optional)
1). make sure the api docs have been updated —
api/cube-cos-openapipoints at bigstack-oss/cube-cos-openapi#122, which addsauth/tlsto the three sender schemas.api/docs.jsonis regenerated from it in CI.2). make sure the api works properly
Done
internal/definition/v1/email/email_test.go(table-driven):Normalize: auth unset with and without a username, auth off drops credentials, unset fields keep the current sender's, explicit fields override them, all three TLS values, unknown and wrong-case TLS rejectedtlsreads back asopportunisticinternal/apis/v1/handlers/settings/trial_test.gosends real mail through a fake plaintext relay that advertisesAUTH PLAINand no STARTTLS:auth: false, tls: nonedelivers and never sendsAUTHauth: false, tls: opportunisticdelivers in plaintextauth: true, tls: nonedelivers and authenticatestls: mandatoryfails, since STARTTLS is not offeredGOWORK=off go test ./internal/...passesgo vetis clean on the touched packagesOn a cluster — 3-node HA (cube45/46/47,
CUBE_3.2.0_20261008-0240, Keycloak 26), with bigstack-oss/cubecos#1810 and bigstack-oss/cube-cos-ui#892 deployed. The relay was a loopback test relay on each node that logs every SMTP command; port 2526 advertisesAUTH PLAIN LOGINand no STARTTLS. Restored afterwards; every file matched the backup.auth: true,tls: opportunistic(UI: Opportunistic / On).auth: "false",tls: "none", an empty username, and"password": ""(not"null").EHLO → MAIL → DATA, with noAUTHand noSTARTTLS. The sender then shows as verified./saml/acsbecause it lacked #1746.auth: trueovernoneandopportunistic, andmandatoryfailing when STARTTLS is not offered.PATCHwith"tls": "starttls"→ 400: covered by unit tests, not exercised on the cluster.🤖 Generated with Claude Code