Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): Add IP address support to DENO_AUTH_TOKEN #22297

Merged
merged 7 commits into from Feb 6, 2024

Conversation

mmastrac
Copy link
Member

@mmastrac mmastrac commented Feb 6, 2024

Auth tokens may be specified for one of the following:

  • abc123@deno.land: deno.land, www.deno.land, etc
  • abc123@deno.land:8080: deno.land:8080, www.deno.land:8080, etc
  • abc123@1.1.1.1: IP 1.1.1.1 only
  • abc123@1.1.1.1:8080: IP 1.1.1.1, port 8080 only
  • abc123@[ipv6]: IPv6 [ipv6] only
  • abc123@[ipv6]:8080: IPv6 [ipv6], port 8080 only

Leading dots are ignored, so .deno.dev is equivalent to deno.dev.

cli/auth_tokens.rs Outdated Show resolved Hide resolved
Comment on lines 276 to 283
let candidates = [
"example.com",
"www.example.com",
"notexample.com",
"www.notexample.com",
"1.1.1.1",
"[2001:db8:a::123]",
];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some tests with ports here?

Copy link
Member Author

@mmastrac mmastrac Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are tested with ports -- we add a port to each candidate below.

    // Generate each candidate with and without a port
    let candidates = candidates
      .into_iter()
      .flat_map(|c| [url(c), url_port(c)])
      .collect::<Vec<_>>();

@mmastrac mmastrac changed the title feat(cli): Add IP address support to DENO_AUTH_TOKEN fix(cli): Add IP address support to DENO_AUTH_TOKEN Feb 6, 2024
@mmastrac mmastrac enabled auto-merge (squash) February 6, 2024 17:35
@mmastrac mmastrac merged commit a6b2a44 into denoland:main Feb 6, 2024
15 checks passed
littledivy pushed a commit that referenced this pull request Feb 8, 2024
Auth tokens may be specified for one of the following:

 - `abc123@deno.land`: `deno.land`, `www.deno.land`, etc
 - `abc123@deno.land:8080`: `deno.land:8080`, `www.deno.land:8080`, etc
 - `abc123@1.1.1.1`: IP `1.1.1.1` only
 - `abc123@1.1.1.1:8080`: IP `1.1.1.1`, port 8080 only
 - `abc123@[ipv6]`: IPv6 `[ipv6]` only
 - `abc123@[ipv6]:8080`: IPv6 `[ipv6]`, port 8080 only

Leading dots are ignored, so `.deno.dev` is equivalent to `deno.dev`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants