Long Unicode Passwords: How to Check That the Server Does Not Truncate Input
Supporting long passwords takes more than a generous input field. Developers and product owners need to align what registration, password changes and login accept, then verify the results using test accounts. The key criterion: the exact permitted password works, while a modified ending or shortened prefix does not allow login. Below are OWASP recommendations and an author-designed test plan for a fictional web product in an environment you own.
What Password Length to Promise Users
OWASP recommends a maximum permitted password length of at least 64 characters to support passphrases. This does not mean that every password must have a minimum length of 64 characters. It also recommends allowing all characters, including Unicode and spaces, and never silently truncating passwords.
Define a single contract for registration, password changes and login: which values are permitted, how length is counted and when users receive an explicit rejection. The interface's promise must match what the server can process in full. Explicitly rejecting an excessively long value is better than storing only its beginning.
Where Character and Byte Boundaries Apply
A character limit and a byte limit are different constraints. The team needs to choose a unit for counting characters and an encoding, then separately define the permitted number of bytes before hashing. These recommendations do not prescribe a particular encoding or counting method: that is a team decision that should be documented.
The trust boundary lies between user input and server-side processing. An input field limit does not replace checking the server-side path to the hashing library. The library must support all Unicode code points; the entropy of the entered password must not be reduced before hashing. During testing, it is therefore important to trace whether the value changes between entry, receipt by the server and delivery to the library.
What to Check in the Hashing Library
Most bcrypt implementations have a 72-byte input limit. OWASP requires passwords to be restricted to this limit or the specific implementation's lower limit. Do not assume that advertised support for 64 characters is automatically compatible with this constraint: verify the contract in both characters and bytes under the chosen encoding.
For new systems, the source recommends more modern algorithms: bcrypt is intended for legacy systems where Argon2 and scrypt are unavailable. If the existing limit prevents acceptance of the Unicode passwords covered by the contract, reconsider the algorithm. To verify an entered password against a stored hash, use the language or framework's secure function when available.
Author-Designed Plan: Boundary Values
Imagine a fictional service called “Draft” and accounts created by the team exclusively in its own test environment. The following checks are an author-designed plan, not an official OWASP procedure. Prepare your own synthetic passwords immediately below, exactly at and above each established limit. Repeat the set for ASCII, Cyrillic, pictographs and spaces, recording lengths in the chosen character units and in bytes.
At registration, a permitted password must subsequently allow login with the exact value; a disallowed password must receive an explicit rejection. A password change requires an active authenticated session and verification of the current password. After an accepted change, verify that the new value allows login and the old one is rejected, choosing distinct test passwords. After a rejected change, the previous password must continue to work. A successful HTTP response alone does not confirm the required state change.
Author-Designed Test: Same Beginning, Different Endings
Set a permitted long password P for the fictional account. First, log in with the exact P: this is the positive control. Then prepare Q of the same permitted length, preserving a long initial portion but changing the ending. Login with Q must be rejected. Separately test a shortened prefix of P: it must not allow login either.
Repeat the check after a password change and for Unicode sets near the applicable boundaries. For values above the limit, expect rejection rather than login based on a matching beginning. Acceptance of a modified value requires investigation, but the observation alone does not establish the cause. Check the actual login outcome, not just the response code or notification text.
The Null Character and the Limits of Testing
The source separately requires the hashing library to handle input containing a null byte. As an additional author-designed check, if the application's contract permits the null character, use your own synthetic password containing one internally. The exact value must work, while the prefix before that character and a version with a modified ending must be rejected. If the application prohibits such input, expect an explicit rejection without silent removal or truncation.
Passing the test set confirms only the cases tested. It does not prove the absence of truncation for all inputs or provide a statistical security guarantee. Keep a description of the test conditions and expected results so that the checks can be repeated when password processing changes.
What to Fix First
The first priority is to eliminate acceptance of modified passwords and silent truncation. Then align server-side limits for registration, password changes and login with the interface, verify the library's Unicode support and repeat the boundary tests. If the algorithm's constraints conflict with the product's promises, reconsider the algorithm and contract before expanding the permitted input.
To determine the scope of further testing, you can start with a free website or web-product audit from CheckMyApp. Discuss the scope of work and the scenarios to be tested; individual test results should not be turned into a promise of complete security.