Repository navigation
tunnel: prioritize Tunnelstore lookup over configured credentials file in findID - #1765
dedsec-terminal wants to merge 2 commits into
Conversation
…e in findID When a tunnel name is provided to subcommands (such as route dns/lb), findID was returning the TunnelID from any configured credentials file without verifying that the file belonged to the named tunnel. Query Tunnelstore first to resolve the tunnel by name against the API. If Tunnelstore cannot be queried (such as credentials-file-only execution without origin cert), fall back to the credentials file. Signed-off-by: dedsec-terminal <dedsec.terminal@gmail.com>
|
Thanks for picking this up. I tested 225e404 against the setup I reported in #1762 (macOS arm64, Go build of this branch vs.
One suggestion: the fallback to the credentials file runs on any error from |
…redentials Only fall back to reading the credentials file when no API credentials are available to query Tunnelstore (e.g. credentials-file-only execution without an origin certificate). When API credentials exist, transient Tunnelstore errors (such as timeouts, rate limits, or 5xx) are returned directly instead of falling back to an unrelated credentials file. Additionally, log a warning naming the resolved tunnel ID when falling back. Signed-off-by: dedsec-terminal <dedsec.terminal@gmail.com>
|
Retested 7b86969 with the same setup: |
Problem
When a tunnel name is provided to commands such as
cloudflared tunnel route dns <name> <hostname>,sc.findIDreturned theTunnelIDfrom any configured credentials file (e.g.credentials-filespecified inconfig.ymlor via--credentials-file) before querying Tunnelstore. Because credentials files do not contain tunnel names,findIDcould not verify whether the file matched the requested name, leading to routes or operations silently applying to an unrelated tunnel.Change
findID, query Tunnelstore (sc.tunnelActive(input)) first wheninputis not a UUID. If the tunnel is found by name in Tunnelstore, return its ID directly.Test_subcommandContext_findIDverifying:Fixes #1762