mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-25 19:59:54 -05:00
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))
### Description
There were cases where we would generate a server side nonce that included the '=' character. '=' is a "reserved" character since the response payload schema is "r={},s={},i={}" so during SASL continue, the incoming nonce would not match the nonce from SASL start, for example:
**Client sasl start nonce:** abcdefghijk12345.
**Server generated nonce:** abcdefghijk12345=1
**Client sasl continue nonce:** abcdefghijk12345
**Expected nonce:** abcdefghijk12345=1
This change ensures the generated nonce doesn't include '='
----
#### AI description (iteration 1)
#### PR Classification
Bug fix to ensure the generated nonce never includes '=' characters.
#### PR Summary
This pull request refactors the nonce generation logic to explicitly avoid '=' by introducing a custom random string generator and updates test configurations accordingly.
- `src/auth.rs`: Added `generate_random_string()` using a restricted charset and replaced the old nonce generation method in `handle_sasl_start`.
- `tests/common/mod.rs`: Updated imports and modified the call to `run_server` by specifying `<DocumentDBDataClient>`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->