Skip to content

Conversation

@nayeemrmn
Copy link
Contributor

@nayeemrmn nayeemrmn commented May 16, 2025

Closes #6532.

// deno run --unstable-subdomain-wildcards --allow-net=*.github.com main.ts

await fetch("https://foo.github.com");

Supports one wildcard which must be the first label. Doesn't support wildcards in a middle label like cloudformation.*.amazonaws.com as one user requested. Based on https://developers.cloudflare.com/dns/manage-dns-records/reference/wildcard-dns-records/#aspects-to-consider.

https only
deno run --allow-net=https://* server.js
or
deno run --allow-net=*/**:443 server.js

Let's decline these ones.

@nayeemrmn nayeemrmn changed the title feat(permissions): subdomain wildcards feat(permissions): net subdomain wildcards May 16, 2025
@nayeemrmn nayeemrmn changed the title feat(permissions): net subdomain wildcards feat(unstable): --allow-net subdomain wildcards May 16, 2025
@Hajime-san
Copy link
Contributor

IMO, users may need to be concerned about attacks via dangling records, while this feature is safe to use in most cases.

https://www.form3.tech/blog/engineering/dangling-danger
https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/protection-from-dangling-dns.html

@bartlomieju bartlomieju requested a review from littledivy May 27, 2025 16:05
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

Exciting!

@bartlomieju
Copy link
Member

Please open a PR to https://github.com/denoland/docs that updates explanation of the --allow-net flag

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

LGTM once the boolean parameter is removed.

@dsherret dsherret self-requested a review May 28, 2025 21:35
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

See latest comment.

@nayeemrmn nayeemrmn requested a review from dsherret May 29, 2025 00:14
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks!

|| NetDescriptor::parse(host_and_port).is_ok()
|| NetDescriptor::parse_for_list(
host_and_port,
UnstableSubdomainWildcards::Enabled,
Copy link
Member

Choose a reason for hiding this comment

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

Sweet. Thanks! This also makes it slightly easier to remove in the future because we'll just need to do a find all references for this type.

fn parse_net_query(
&self,
text: &str,
) -> Result<NetDescriptor, NetDescriptorParseError>;
Copy link
Member

@dsherret dsherret May 29, 2025

Choose a reason for hiding this comment

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

One tiny thing, is considering this is permissions, I wonder if we should use a different type for query like NetQuery instead of NetDescriptor so there's a bit more protection in not accidentally mixing them up? I'm not sure it makes sense. Just a thought.

Copy link
Contributor Author

@nayeemrmn nayeemrmn May 29, 2025

Choose a reason for hiding this comment

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

That was my first try. It's hard to walk through it all but I essentially hit a roadblock implementing QueryDescriptor::from_allow() (this method fundamentally doesn't make sense) for NetQuery { type AllowDesc = NetDescriptor }, and the change exploded in scope trying to address everything. So I restarted.

However, I'm also doubtful we should have separate 'query' and 'allow-listed range' types, since the latter should also be query-able through the runtime API. It also needs to be queried when checking for escalations when spawning child workers, which is precisely where we use QueryDescriptor::from_allow().

There might have been technical causes to do this type AllowDesc stuff for env or run permissions, but from a wider lens it seems flawed.

@nayeemrmn nayeemrmn merged commit ab9673d into denoland:main May 29, 2025
18 checks passed
@nayeemrmn nayeemrmn deleted the permission-net-subdomain-wildcard branch May 29, 2025 03:24
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.

Allow wildcards in --allow-net allow lists.

4 participants