Review report

core: PR #36374

2 suggestions

Earlier concerns neither republished nor resolved: 1 minor finding. See the Run archive for their assessments.

Optional improvements

Link

[suggestion] · Quoted password encoding requires ordered escaping

The HASHEDPASSWORD path can use Tor's documented hexadecimal password form to avoid order-dependent escaping while preserving the original password bytes.

Location: src/torcontrol.cpp:670 (head).

Details and suggested fix

The new backslash-then-quote escaping is correct, but hexadecimal encoding would remove both ordered ReplaceAll calls. The AUTHENTICATE specification permits the original HashedControlPassword secret as either a quoted string or hexadecimal, explicitly “to avoid escaping issues”; Tor ticket #4817 also gives an equivalence example. Send "AUTHENTICATE " + HexStr(torpassword) with the same callback instead. This file already uses that representation for SAFECOOKIE, and HexStr has a character-span overload. The wire representation changes, so the new functional test's exact-line assertion must change too. Hex encoding would also avoid embedding CR/LF directly in the line-oriented command; that limitation predates this PR and involves only the operator's own setting. This recommendation relies on the documented protocol, not inspected Tor source or a live test of hexadecimal password authentication.


Link

[suggestion] · The password-escaping change lacks a compatibility note

Configurations that doubled backslashes to compensate for the old decoding will fail Tor authentication after upgrading, so a release note would help operators update them.

Location: src/torcontrol.cpp:668 (head).

Details and suggested fix

For HASHEDPASSWORD authentication, a configured value a\\b containing two backslashes previously reached Tor as a\b containing one. It now reaches Tor with both backslashes intact. Neither configuration parsing nor GetArg removes the extra backslash. A setup compensating for the old decoding will therefore log only tor: Authentication failed and will not create the automatic onion service; reconnecting reuses the same setting. Add a short release note explaining that backslashes are now sent literally and that operators should remove any compensating doubling so the value matches the password given to tor --hash-password. This restores the clear-text semantics already documented in doc/tor.md, rather than introducing a password-handling defect. No configuration relying on the old decoding was identified, so the production impact remains unconfirmed.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.