Repository navigation
Description
Before reporting an issue
- I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.
Area
authentication
Describe the bug
The username field in Keycloak's login form accepts excessively long input and reflects the full value verbatim in authentication logs without any length restriction or truncation.
During testing, submitting ~124,000 characters in the username field caused the log file to grow from 34KB to 161KB in a single unauthenticated request - an amplification of over 127x compared to a normal login attempt.
The full username is written to the WARN log entry under type="LOGIN_ERROR" without any truncation, meaning any unauthenticated user
can generate disproportionate log data on the server with a single request.
Version
26.5.3
Regression
- The issue is a regression
Expected behavior
The username field should enforce a reasonable maximum length limit before the value is passed to the logging layer. Any input exceeding that
limit should be truncated or rejected, preventing disproportionate log growth from a single request.
Actual behavior
The full username value is written verbatim to the authentication logs regardless of length. A single unauthenticated request with ~124,000
characters in the username field caused the log file to grow from 34KB to 161KB — over 127x the size of a normal login attempt.
How to Reproduce?
- Start a standard Keycloak instance
- Navigate to the login page:
http://localhost:8080/realms/master/protocol/openid-connect/auth?client_id=security-admin-console&response_type=code& enter any wrong credentials and submit the login form to be redirected. - You will be redirected to:
/realms/master/login-actions/authenticatewith parameters: execution, client_id, tab_id, client_data - Now in the username field, paste a very long string (~124,000 characters) & submit the form
- Observe the logs and the log file size.
Anything else?
The username value is reflected in logs via org.keycloak.events under the LOGIN_ERROR event type.
Measured evidence:
- Log file before: 34KB
- Log file after 1 request: 161KB
- Input length: ~124,000 characters
- Authentication required: None
- All realms affected: Yes

Activity
17 remaining items
sguilhen commentedon Aug 31, 2026
@msdaly200 @rmartinc This was reported as a regression in #52154 - I tested and indeed only 26.7.x is affected (26.6.x works well). I am adding a backport label here so the fix makes its way to 26.7.
sguilhen commentedon Aug 31, 2026
Sent #52253 - only had to adjust the location of the organization tests as in 26.7 the org tests were still in the legacy testsuite.
Closes #50903, added length check for username (#52253)