mirror of
https://github.com/juanfont/headscale.git
synced 2026-09-28 02:56:21 +09:00
0ce3356b89
waitForFollowup returns nodeToRegisterResponse for a completed registration without checking that the Noise session polling for the result was started with the machine key that opened the registration. That response carries the registering user's User and Login, so the auth ID in the followup URL is the only thing protecting it. handleRegister and handleLogout both call machineKeyMismatch before handing back a node, so this is the one path of the three that does not. The key is already available: HandleNodeFromAuthPath resolves the node from the MachineKey cached in RegistrationData, so on the normal path the node and the session agree and the check is a no-op. The auth ID is 96 bits of randomness and is not guessable, so this is not reachable by brute force. It is logged at info level when a registration is created, which makes log access the realistic way to obtain one. The existing followup_registration_success case built its node with CreateNodeForTest, which picks a random machine key that no real registration would produce. Set the registering machine key so the fixture matches the production path. Signed-off-by: Arpit Jain <arpitjain099@gmail.com>