--management-url argument is ignored, reports success for invalid hosts #2440

Open
opened 2025-11-20 07:09:50 -05:00 by saavagebueno · 1 comment
Owner

Originally created by @tkloda on GitHub (Nov 4, 2025).

Describe the problem

When using the netbird CLI with the --management-url flag (e.g., netbird up --management-url https://netbird-instance.com), the client incorrectly reports success even when the provided URL is non-existent, arbitrary, or unreachable (e.g., https://foo.com, https://netbird-instance:8400).

The client returns messages like "Already connected" (for netbird up) or "Logging successfully" (for netbird login) without first validating that a connection to the specified management host was successfully established.

This behavior suggests the CLI is either:

1) Ignoring the --management-url argument entirely.

2) Relying on a cached local state that claims "connected" without re-validating.

3) Not performing any connectivity or authentication checks before reporting success.

To Reproduce

  1. Run the up command with the correct management URL:
    netbird up --management-url https://netbird-instance

Expected: client connects and displays connected state (or errors if unreachable).
Observed: "Already connected"

  1. Repeat with bogus/non-existent hosts:
    netbird up --management-url https://foo.example.invalid
    netbird up -- management-url https://foo2.com
    netbird up --management-url https://netbird-instance:8400
    All returned “Already connected”.

Expected behavior

  1. Fail fast & report errors: If the supplied --management-url is unreachable or fails TLS validation, the CLI must return a descriptive error and a non-zero exit code. Do not print “Already connected” or “Logging successfully” unless a successful connection/authentication is confirmed.

  2. Use management URL param: Ensure CLI logic actually uses the --management-url argument for the attempted connection (no silent ignore). Add unit tests covering argument parsing make sure host is used.

Are you using NetBird Cloud?

NetBird self-hosted

NetBird version

0.59.11

Originally created by @tkloda on GitHub (Nov 4, 2025). **Describe the problem** When using the netbird CLI with the --management-url flag (e.g., netbird up --management-url https://netbird-instance.com), the client incorrectly reports success even when the provided URL is non-existent, arbitrary, or unreachable (e.g., https://foo.com, https://netbird-instance:8400). The client returns messages like "Already connected" (for netbird up) or "Logging successfully" (for netbird login) without first validating that a connection to the specified management host was successfully established. This behavior suggests the CLI is either: 1) Ignoring the --management-url argument entirely. 2) Relying on a cached local state that claims "connected" without re-validating. 3) Not performing any connectivity or authentication checks before reporting success. **To Reproduce** 1) Run the up command with the correct management URL: netbird up --management-url https://netbird-instance Expected: client connects and displays connected state (or errors if unreachable). Observed: "Already connected" 2) Repeat with bogus/non-existent hosts: netbird up --management-url https://foo.example.invalid netbird up -- management-url https://foo2.com netbird up --management-url https://netbird-instance:8400 All returned “Already connected”. **Expected behavior** 1) Fail fast & report errors: If the supplied --management-url is unreachable or fails TLS validation, the CLI must return a descriptive error and a non-zero exit code. Do not print “Already connected” or “Logging successfully” unless a successful connection/authentication is confirmed. 2) Use management URL param: Ensure CLI logic actually uses the --management-url argument for the attempted connection (no silent ignore). Add unit tests covering argument parsing make sure host is used. **Are you using NetBird Cloud?** NetBird self-hosted **NetBird version** 0.59.11
saavagebueno added the triage-needed label 2025-11-20 07:09:50 -05:00
Author
Owner

@lixmal commented on GitHub (Nov 4, 2025):

You need to run netbird down first; the setting takes no effect if it is "already connected" just like it says

@lixmal commented on GitHub (Nov 4, 2025): You need to run `netbird down` first; the setting takes no effect if it is "already connected" just like it says
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#2440