-
Notifications
You must be signed in to change notification settings - Fork 824
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
Better network sandbox #5283
Better network sandbox #5283
Conversation
Is there a way to allow all domains? Basically in the syntax what does * mean, or it is even valid? Does * mean any domain and : is any IP? |
We couldn't figure out a way to allow only specific IPs and all domains. For example we wanted to allow *:80, *:443. This ends up not being possible because we need to add additionally some pattern for domains like *.com. |
I don't think the current design will satisfy these two common use cases. Use case 1
Use case 2
The first fails because there is no way to allow all IPs but just specific domains. |
Overview
This PR adds a more fine-grained sandbox for the network layer. Previously, the wasm module did not have access to any networking functionality by default and the user could give this access by providing the
--net
flag to the wasmer client. But this would expose all of host's network stack to the wasm module. Now users can provide a list of of patterns that will act as a whitelist or blacklist. This is done by extending the--net
flag:Rule Specification
Each member of the
<comma_separated_list_of_rules>
can be expressed like:Some examples:
dns:allow=example.com:80
dns:deny=*danger.xyz:*
ipv4:allow=127.0.0.1:80/in
.Features
Whitelisting and Blacklisting
Each rule can be expressed as an
allow
(whitelist) ordeny
(blacklist). A socket or domain is only accessible if at least one rule whitelists it and no rule blacklists it.Directional Filtering
IP based rules can be either directional by specifying
/in
or/out
postfixes to the rule, or bidirectional which is the default setting for these rules.Rule Combination
In order to prevent repetition, the parts before and after the
:
could hold multiple values. For example:This is equivalent to:
Resolves #5280.