Skip to content

feat: log specific diagnostics for unknown authentication usernames - #890

Merged
foxcpp merged 1 commit into
foxcpp:masterfrom
mvanhorn:fix/649-authentication-failure-log-details
Nov 7, 2026
Merged

foxcpp merged 1 commit into
foxcpp:masterfrom
mvanhorn:fix/649-authentication-failure-log-details

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Why

Authentication logs do not distinguish an unknown username from other credential failures, making account typos harder to diagnose.

Summary

Attach a specific reason, provider identity, and mapped username when a credentials-table entry is missing. Preserve generic client errors and report table lookup errors before checking for a missing entry.

Testing

Gofmt -l internal/auth/pass_table/table.go internal/auth/pass_table/table_test.go reported no formatting changes. Go vet ./internal/auth/pass_table/... completed without diagnostics. Go test ./internal/auth/pass_table/... passed. Repo_lint ran three times with no output shown. The tests in internal/auth/pass_table/table_test.go fail without the fix in the maddy change (checked by reverting the source changes). The changed test internal/auth/pass_table/table_test.go did not run here: no test runner for it was available.

Fixes #649

Attach a specific reason, provider identity, and mapped username when a
credentials-table entry is missing. Preserve generic client errors and
report table lookup errors before checking for a missing entry.

Fixes foxcpp#649
@github-project-automation github-project-automation Bot moved this to First Feedback Needed in Maddy Mail Server PR Review Nov 6, 2026
@foxcpp
foxcpp merged commit b53b331 into foxcpp:master Nov 7, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from First Feedback Needed to Merged in Maddy Mail Server PR Review Nov 7, 2026
@mvanhorn

mvanhorn commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for merging this, @foxcpp. Having the missing credentials-table entry show up as its own reason in the auth logs should make username typos much quicker to track down.

gabrielcosi pushed a commit to gabrielcosi/home-ops that referenced this pull request Nov 20, 2026
…828)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [ghcr.io/foxcpp/maddy](https://maddy.email) ([source](https://github.com/foxcpp/maddy)) | patch | `0.9.7` → `0.9.8` |

---

### Release Notes

<details>
<summary>foxcpp/maddy (ghcr.io/foxcpp/maddy)</summary>

### [`v0.9.8`](https://github.com/foxcpp/maddy/releases/tag/v0.9.8): [SECURITY] maddy 0.9.8

[Compare Source](foxcpp/maddy@v0.9.7...v0.9.8)

## Summary

This release includes fixes for two reported security issues: IMAP
parsing now limits command size and nesting depth, and LDAP
authentication cleanup avoids a nil-pointer panic in a connection error
path.

Operators using IMAP or LDAP authentication should upgrade to receive
these fixes.

IMAP behavior is corrected for read-only `EXAMINE` sessions and `RENAME
INBOX`, and searches using `SINCE` or `ON` now include messages from the
specified day. The release also adds optional SMTP reverse-DNS lookup
control, bounded command execution for `check.command`, and
platform-specific default directories.

## Security

- endpoint/imap: Limit command size and nested list depth
  (GHSA-3gp8-jmrg-pq2v).

The IMAP parser now rejects excessively long commands and deeply nested
lists, limiting resource use while parsing client input. Previously, a
client able to reach an IMAP listener could send input without these
parser bounds.

Affects configurations exposing an IMAP endpoint to clients. No
additional configuration is required for the parser limits.

- auth/ldap: Stop cleanup after invalidating a connection
  (GHSA-854c-vjm7-rqw8).

If rebinding a pooled LDAP connection failed, cleanup could clear the
shared connection and then dereference it while trying to close it
again, panicking the process. Cleanup now returns after invalidating the
connection.

Affects configurations using `auth.ldap`; the problematic path requires
a rebind failure while returning a connection to the pool.

## Bug fixes

- endpoint/imap: Do not expunge a read-only mailbox on `CLOSE`, and
  reject `MOVE` and `UID MOVE` on a read-only selection ([#&#8203;906](foxcpp/maddy#906)).
- endpoint/imap: After `RENAME INBOX`, make the new empty `INBOX`
  visible in the same session while preserving messages in the renamed
  mailbox ([#&#8203;907](foxcpp/maddy#907)).
- endpoint/imap: Include messages dated on the specified day in `SINCE`
  and `ON` searches ([#&#8203;887](foxcpp/maddy#887)).
- endpoint/imap: Wait for active connections to finish during shutdown,
  avoiding a data race ([#&#8203;886](foxcpp/maddy#886)).
- endpoint/smtp: Snapshot connection metadata per message so
  asynchronous delivery does not race with changes to session state
  ([#&#8203;899](foxcpp/maddy#899)).
- auth/pass_table: Return an error instead of panicking on malformed
  Argon2 hashes ([#&#8203;888](foxcpp/maddy#888)) (PR [#&#8203;891](foxcpp/maddy#891), thanks [@&#8203;kabeer7121](https://github.com/kabeer7121)).
- auth: Apply `auth_map` only once during SASL LOGIN authentication.
- target/queue: Preserve enhanced SMTP status codes when converting
  delivery errors.
- target/remote: Do not pool a connection used when a TLS policy
  override bypassed MX authentication policies.
- check/milter: Accept IPv4- and IPv6-specific TCP endpoints, and reject
  TLS endpoints explicitly because the milter client does not support
  TLS.
- DMARC and address checks: Decode RFC 2047 display names in address
  lists, including supported legacy character sets ([#&#8203;894](foxcpp/maddy#894)).

## Improvements

- endpoint/smtp: Add `rdns_lookup` to disable client reverse-DNS
  lookups. It defaults to `yes`; setting it to `no` skips PTR lookups
  and dependent checks ([#&#8203;150](foxcpp/maddy#150)) (PR [#&#8203;889](foxcpp/maddy#889), thanks [@&#8203;kabeer7121](https://github.com/kabeer7121)).
- check/command: Add `timeout` and `interrupt_timeout` controls for
  external commands. Both default to one minute; a timed-out command
  receives SIGINT and is killed if it does not stop within the interrupt
  timeout.
- imap.filter.command: Add a one-minute default command timeout and
  close message-body readers after filtering.
- config: Use platform-specific default directories on Windows, macOS
  and BSD. Windows uses `%ProgramData%\maddy` for configuration,
  separate `data` and `run` directories, and `%ProgramFiles%\maddy` for
  libexec. macOS and BSD use `/var/run/maddy` for runtime files and
  `/usr/lib/maddy` for libexec ([#&#8203;290](foxcpp/maddy#290)) (PR [#&#8203;900](foxcpp/maddy#900), thanks [@&#8203;AdamMagued](https://github.com/AdamMagued)).
- config: Support `tcp4`, `tcp6`, `fd` and `fdname` endpoint addresses,
  including TLS modifiers for inherited file descriptors.
- auth.pass_table: Log specific diagnostics when a credentials table has
  no entry for a username, while keeping client-facing authentication
  errors generic ([#&#8203;649](foxcpp/maddy#649)) (PR [#&#8203;890](foxcpp/maddy#890), thanks [@&#8203;mvanhorn](https://github.com/mvanhorn)).
- table/regexp: Accept the documented `expand_placeholders` directive
  while retaining the old `expand_replaceholders` spelling with a
  deprecation warning ([#&#8203;896](foxcpp/maddy#896)) (PR [#&#8203;902](foxcpp/maddy#902), thanks [@&#8203;troioi-vn](https://github.com/troioi-vn)).

## Documentation

- Document configuration macros and variable expansion syntax ([#&#8203;335](foxcpp/maddy#335)).
- Add documentation for the Dovecot SASL endpoint ([#&#8203;438](foxcpp/maddy#438)).
- Correct the `+tag` stripping example for `table.chain` ([#&#8203;896](foxcpp/maddy#896)) (PR
  [#&#8203;898](foxcpp/maddy#898), thanks [@&#8203;troioi-vn](https://github.com/troioi-vn)).

## Misc

- tests: Reserve test ports with shared listening sockets to avoid port
  collisions
- tests: Use Parallel for all integration tests and fix encountered data
  races in test code.

</details>

---

### Configuration

📅 **Schedule**: (in timezone Europe/Berlin)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Operator](https://github.com/mogenius/renovate-operator).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4yMzkuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjIzOS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.xcd.dev/gabrielcosi/home-ops/pulls/1828
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Error Message should Validate Username is in Domain for Authentication Error

2 participants