spinframework / spinframework/spin

Rethink client IP headers

Open
#3,185 0 comments 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

We currently set spin-client-addr to the incoming client's <ip>:<src port>, but it is ambiguous whether this is the closest hop on the network (often a reverse proxy) or some previous hop in the proxy chain (which could be the original client IP). I suggest that we update the docs to state that this header is optional and that when present it only holds the address of the "closest hop".

Separately, we might want to think about documenting a "Spin standard" way to expose trusted forwarding information to guests. This would probably involve some http trigger config like e.g. SPIN_HTTP_TRUSTED_CLIENT_IP_HEADER=x-forwarded-for where the operator pinky swears that the header is valid.

When enabled, this trusted information would be exposed to guests; a couple of options for that:

  • a new e.g. spin-trusted-client-ip header that is only set if the info is available
  • (slightly more "standardsy"): use the forwarded header and apply some transformation so that trusted and untrusted entries can be distinguished, for example by (ab)using the by field or by blatantly disregarding the RFC and introducing our own parameter without registering it with IANA.

We should document whatever we decide here, even if it only ends up being a recommendedation.

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 by reviewing the existing documentation for the optional spin-client-addr header and how it describes the closest hop. Then resolve whether Spin should define a trusted forwarding mechanism and document the chosen header or recommendation, including how trusted and untrusted information are distinguished.

Written by the indexing model from the issue text.

Assessment

Domain
documentation, networking
Issue type
Documentation
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.