config: keep local SMTP auth secret overrides - #5448
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughSMTP receiver authentication secrets now inherit global values only when both receiver-level fields are unset. Tests and test data cover inheritance and mutual clearing between inline secrets and secret files. ChangesSMTP secret inheritance
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to This change makes receiver-level SMTP authentication secrets take precedence over global defaults, with no actionable merge-blocking risk remaining after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Global SMTP auth secret defaults are a mutually exclusive inline/file pair. Merging each field independently can add the global secret file to a receiver that already has a local inline secret. Email resolution checks the file first, so the receiver override is ignored. Only inherit the pair when neither receiver field is set, matching the password pair. Extend the global/local SMTP fixture to cover both directions. Signed-off-by: Sueun Cho <sueun.dev@gmail.com>
1968855 to
c4c6ca4
Compare
A receiver-level
auth_secretshould override the global SMTP auth secret defaults. The loader currently mergesauth_secretandauth_secret_fileindependently, though, so a receiver with a local inline secret also inheritsglobal.smtp_auth_secret_file.That leaves both fields set.
getAuthSecretchecks the file first, so the receiver's inline secret is not used. If the global path is unavailable, the notification fails while trying to read it; if it is available, CRAM-MD5 uses the global file contents instead of the receiver override.This restores paired inheritance: copy the global secret fields only when neither receiver field is set, matching the existing password/password-file handling. The global/local SMTP fixture now covers a global secret file with both local inline-secret and local secret-file overrides.
Tested with:
go test ./config/ -run '^TestGlobalAndLocalSMTPPassword$' -count=1go test ./config/... ./notify/email/... -count=1go test -race ./config/... ./notify/email/... -count=1go vet ./config/... ./notify/email/...go build ./config/... ./notify/email/... ./cmd/amtoolPull Request Checklist
auth_secretandauth_secret_fileare mutually exclusive.Which user-facing changes does this PR introduce?