Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Bypassing login-token checks for synthetic logins introduces an authentication boundary requiring end-to-end validation of header sanitization, cross-site POST rejection, and proxy-user/session isolation behind the intended proxy.
No open issues 🎉
What changed in this PR
Adds an optional authentication-proxy plugin for Adminer, enabling automatic login to a fixed database server using an identity supplied by a trusted proxy or web server.
Changes:
- Uses configured database credentials without storing the real password in the session.
- Requires a proxy identity on each request, resets session data when that identity changes, and restricts login to the configured connection.
- Includes deployment guidance, Czech and German translations, and a changelog entry.
| File | Description |
|---|---|
plugins/login-auth-proxy.php |
Implements proxy-based automatic login, connection restrictions, session handling, and translations. |
CHANGELOG.md |
Announces the new login-auth-proxy plugin. |
Review effort: Balanced
|
Thanks, this is careful work. Please publish it in your own repo or in a Gist and I'll link it from https://adminer.org/plugins/#user. A few things:
|
Since the login verifies the token (6.0.1), a posted auth with a wrong token is ignored, but the token was still replaced by a valid one after it. A POST with any auth[] field and a wrong token then performed its action in the existing session. Browsers don't send the SameSite=Lax session cookie with a cross-site POST. They send it from a same-site page, e.g. on a sibling subdomain, but verify_token() still rejects Sec-Fetch-Site: same-site. The replacement dated from the time when the login didn't verify the token. The form of an expired session posts a valid token. Found by Olof Mattsson in #1375 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the quick CSRF fix. The plugin is now at https://github.com/omattsson/adminer-login-auth-proxy, please link it from the plugins page. All four points are addressed:
The repo's tests pass on the 6.1.0, 6.2.0 and 6.3.0 releases with MySQL 8.4, using mysqli. They cover cross-site requests, expired sessions and a real database outage. |
|
Thanks, published at http://www.adminer.org/plugins/#user-login-auth-proxy |
Adminer often runs behind an authenticating reverse proxy, for example oauth2-proxy in front of a container, where users sign in with SSO and should not know the database password. This plugin logs them in automatically to one fixed server when the proxy sends the user in a header, and refuses requests without it.
How it works:
login()runs on every request and fails without the header, so an existing session or the permanent login doesn't outlive the proxy.credentials()returns the configured server, user and password; the password goes only to the configured driver, server and user, whatever the URL says.auth(only another website could send it) and skips the login token only for its own automatic login. Without that, a cross-site POST withauthand a query ran the query.bruteForceKey()counts failures per proxy user, since all requests come from the address of the proxy.$databaselimits the list of databases anddbin the URL; the doc-comment says to limit the account by GRANT.REMOTE_USER, which a client can't set. PHP mapsX-Auth-Request-EmailandX_Auth_Request_Emailto the same key, and some proxy versions strip only the dashed name, so the doc-comment says that the proxy must remove the header including its variants with underscores.The name differs from
login-reverse-proxy, which groups failed logins byX-Forwarded-For. I'm happy to rename it.Tested with the dev server and MySQL 8.4 (22 checks): automatic login, no access without the header (also with an existing session), only the configured database, another server or driver in the URL, a cross-site POST with and without
Sec-Fetch-Site, a second tab, no password in the session file, a retry after the database was down, a change of the proxy user, a header with spaces only,REMOTE_USERand an invalid header name.composer checkpasses.I didn't add it to
tests/plugins.phpbecause the automatic login would change every spec there; I can add a separate entry point and spec if you want.The code was written with Claude Code; I reviewed and tested it.