spinframework / spinframework/spin

How should redirects interact with `allowed_http_hosts`?

Open
#1,881 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
6.5k
Forks
310
Avg merge
1d 20h
Merged PRs (30d)
24

Description

At the moment, Spin's outbound HTTP interface automatically follows redirects. This happens within the reqwest stack in the Spin host, and therefore bypasses allowed_http_hosts.

Generally, this is reasonable, because it means a component granted access to, say, twitter.com does not need to be reconfigured when that domain starts redirecting to x.com. However, there may be cases where it is not safe to follow the redirection: consider the case where the operator of a Spin hosting environment (e.g. a Kubernetes cluster) wants to prevent redirection to internal services.

To complicate matters, our understanding of wasi-http is that the host should not automatically follow redirects; it would be up to a higher-level HTTP stack running inside the guest to manage redirect policy. In that case, the host cannot know that the request to the non-allowed x.com is merely following a redirect from the allowed twitter.com - it must enforce allowed_http_hosts on all requests. Which could be vexing for an application which just wants to get the latest cat GIFs and not have to constantly chase the hostname du jour.

(As a side note, Cloud does not currently automatically follow redirects. So it avoids the 'policy bypass' problem but runs into the 'chase the hostname' problem.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reqwest stack in the Spin host and the wasi-http redirect expectations described in the issue. Compare this with Cloud's current behavior and trace how allowed_http_hosts is enforced. Done requires a documented and implemented decision for redirect handling that preserves the intended host policy.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.