The one way a command turns a Connection into endpoint auth options — spread this into
new CotalEndpoint({...}) instead of passing creds: directly, so a user-mode connection
(bearer + sentinel) and a static/raw one (creds) ride the same call sites without each command
re-learning the mode split.
The connect material for one resolved connection, spread straight into CotalEndpoint options
or a standalone helper.
tls rides along with the credentials DELIBERATELY. It used to be dropped here — this function
returned creds/bearer only — which meant every caller that spread endpointAuth(conn) got the
identity and silently lost the transport requirement. That is the failure with no symptom: the
connection still works against an honest TLS broker (the client upgrades on the server's INFO),
so nothing looks wrong until an on-path attacker forges an INFO without tls_required and
collects the credentials in the clear. Keeping the two together means a caller cannot take the
identity without also taking the requirement that protects it.
The one way a command turns a Connection into endpoint auth options — spread this into
new CotalEndpoint({...})instead of passingcreds:directly, so a user-mode connection (bearer + sentinel) and a static/raw one (creds) ride the same call sites without each command re-learning the mode split.The connect material for one resolved connection, spread straight into
CotalEndpointoptions or a standalone helper.tlsrides along with the credentials DELIBERATELY. It used to be dropped here — this function returned creds/bearer only — which meant every caller that spreadendpointAuth(conn)got the identity and silently lost the transport requirement. That is the failure with no symptom: the connection still works against an honest TLS broker (the client upgrades on the server's INFO), so nothing looks wrong until an on-path attacker forges an INFO withouttls_requiredand collects the credentials in the clear. Keeping the two together means a caller cannot take the identity without also taking the requirement that protects it.