-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Get rid of allowed_http_hosts
in v2 manifest
#1988
Conversation
Signed-off-by: Ryan Levick <ryan.levick@fermyon.com>
Signed-off-by: Ryan Levick <ryan.levick@fermyon.com>
.context("`allowed_outbound_hosts` is malformed")?; | ||
} | ||
spin_outbound_networking::AllowedHostsConfig::parse(&component.allowed_outbound_hosts) | ||
.context("`allowed_outbound_hosts` is malformed")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely low priority but it might be nice to eventually move this parsing into serde for the nice errors you get out of toml deserialization.
examples/rust-outbound-pg/spin.toml
Outdated
@@ -12,6 +12,6 @@ component = "outbound-pg" | |||
[component.outbound-pg] | |||
environment = { DB_URL = "host=localhost user=postgres dbname=spin_dev" } | |||
source = "target/wasm32-wasi/release/rust_outbound_pg.wasm" | |||
allowed_outbound_hosts = ["localhost:5432"] | |||
allowed_outbound_hosts = ["postgres://localhost:5432"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure where this scheme comes from? There's no scheme used in the connection string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not doing literal equality checking on strings: the scheme in this config signifies that you are allowed to make postgres outbound calls to that host and port (and not, for example, http calls).
@@ -12,7 +12,7 @@ component = "wasi-http-async" | |||
|
|||
[component.wasi-http-async] | |||
source = "target/wasm32-wasi/release/wasi_http_rust_streaming_outgoing_body.wasm" | |||
allowed_http_hosts = ["insecure:allow-all"] | |||
allowed_outbound_hosts = ["https://*:*"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this still allow HTTP (not HTTPS) for localhost scenarios?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in the current implementation it would but that seems a bit odd. The most consistent thing would be to require {http, https}://*:*
(note that the list syntax is not yet implemented), but that is admittedly a bit annoying.
We just discussed this in the Spin Up meeting, and I think we should hold off on removing the existing way of doing this this shortly before the release. Landing this change requires a lot of documentation update, solid work on devUX to ensure that developers aren't left stranded because they don't know how to migrate, and potentially also some deeper conversation about the exact design and ergonomics of |
Signed-off-by: Ryan Levick <ryan.levick@fermyon.com>
Ok. I've pushed some changes that I think address most of the issues:
|
4a52b09
to
a875503
Compare
a875503
to
b340a3a
Compare
c946bd8
to
f9f9947
Compare
Signed-off-by: Ryan Levick <ryan.levick@fermyon.com>
f9f9947
to
6785e96
Compare
if !normalized.is_empty() { | ||
terminal::warn!( | ||
"Use of the deprecated field `allowed_http_hosts` - to fix, \ | ||
replace the use of `allowed_http_hosts` with `allowed_outbound_hosts = {normalized:?}`", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: thoughts on reducing to just the following?
replace the use of `allowed_http_hosts` with `allowed_outbound_hosts = {normalized:?}`", | |
replace with `allowed_outbound_hosts = {normalized:?}`", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vdice maybe
replace the use of `allowed_http_hosts` with `allowed_outbound_hosts = {normalized:?}`", | |
replace `allowed_http_hosts` with `allowed_outbound_hosts = {normalized:?}`", |
so as to be absolutely specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are no other changes, I might sneak this in to a follow-up PR to avoid having to run CI again, but otherwise 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working through what must at times have been frustrating feedback. I've not fully grasped the internals of the PR, but it looks good, and the behaviour gives us the long-term plan going forward while making users following older content successful. The ideal outcome.
I will update the docs to align with this. (Thanks for picking up the templates!) |
@vdice heads up for the JS and Python templates |
This removes
allowed_http_hosts
in favor ofallowed_outbound_hosts
.allowed_outbound_hosts
has become strict in that it is required to follow the form "$SCHEME://$HOST:$PORT" where $SCHEME can be "*" or a specific scheme, $HOST can be "*" or a specific host, and $PORT can be "*", a specific port, or a port range. In the future we will allow lists of schemes, hosts, and ports.Some notes:
*://*:*
.*://example.com