SIGN IN SIGN UP

proxy: split password hack payload on first separator (#12899)

## Problem

`PasswordHackPayload::parse` iterated through `[";", "$"]` and used
whichever separator appeared in the bytes first by *iteration* order,
not by *position* in the input. The result: a client that picked `$` as
its separator and happened to put `;` somewhere in the password got
split at the `;` instead.

Concretely, `endpoint=foobar$pass;with;semis` parsed to:

- endpoint: `foobar$pass` (rejected later by `parse_endpoint_param`, or
routed to the wrong endpoint if the prefix happened to look valid)
  - password: `with;semis`

Endpoint names are restricted to alphanumeric plus hyphen (see
`parse_endpoint_param`), so neither separator can ever appear inside an
endpoint. Whichever separator appears first in the bytes is the correct
one.

## Summary of changes

* `proxy/src/auth/password_hack.rs`: scan the input for the first
occurrence of either `;` or `$` (`bytes.iter().position(...)`), split
there, and use everything past it as the password.
* Add `parse_uses_first_separator` test covering both directions
(`$`-separated payload with `;` in the password, and the mirror case).
* Existing `parse_password_hack_payload_{project,endpoint,dollar}` tests
continue to pass.

Before:

$ cargo test -p proxy --lib
auth::password_hack::tests::parse_uses_first_separator
test auth::password_hack::tests::parse_uses_first_separator ... FAILED
    thread '...' panicked at proxy/src/auth/password_hack.rs:126:9:
    assertion `left == right` failed
      left: EndpointId("foobar$pass")
     right: "foobar"

After:

    $ cargo test -p proxy --lib auth::password_hack
    running 5 tests
    test auth::password_hack::tests::parse_uses_first_separator ... ok
test auth::password_hack::tests::parse_password_hack_payload_dollar ...
ok
test auth::password_hack::tests::parse_password_hack_payload_project ...
ok
test auth::password_hack::tests::parse_password_hack_payload_endpoint
... ok
    test auth::password_hack::tests::parse_endpoint_param_fn ... ok
    test result: ok. 5 passed; 0 failed
A
Akhilesh Arora committed
8f60b04da47ffefe0e52bda2440134b42874eb75
Parent: 6a35a3e
Committed by GitHub <noreply@github.com> on 5/25/2026, 1:07:37 PM