Skip to content

Commit 909a6d3

Browse files
committed
Document peer-topology header trust boundary and cross-refs
topology-affinity-filter/-scorer trust peerTopologyHeader without re-verifying its source; call out that it must only be set on a profile reachable exclusively through the coordinator. Cross-reference the x-peer-topology literal across its three independent definitions so a rename in one is discoverable from the others. Signed-off-by: Etai Lev Ran <elevran@gmail.com>
1 parent b8bbcc8 commit 909a6d3

5 files changed

Lines changed: 19 additions & 3 deletions

File tree

pkg/coordinator/gateway/paths.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ const (
2323
PathCompletions = "/v1/completions"
2424
DefaultGeneratePath = "/inference/v1/generate"
2525

26-
EPPProfileHeader = "EPP-Profile"
26+
EPPProfileHeader = "EPP-Profile"
27+
// PeerTopologyHeader must match the default headerName in
28+
// pkg/epp/framework/plugins/requestcontrol/responsereceived/topologystamp
29+
// and peerTopologyHeaderName in pkg/epp/util/request/headers.go.
2730
PeerTopologyHeader = "x-peer-topology"
2831
ContentTypeHeader = "Content-Type"
2932
ContentTypeJSON = "application/json"

pkg/epp/framework/plugins/requestcontrol/responsereceived/topologystamp/stamp.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ const PluginType = "topology-stamp-handler"
3737

3838
// defaultHeaderName is the response header the encoded topology is written
3939
// to, and the header topology-affinity-filter/-scorer read the peer topology
40-
// from in coordinator deployments.
40+
// from in coordinator deployments. Must match gateway.PeerTopologyHeader in
41+
// pkg/coordinator/gateway and peerTopologyHeaderName in
42+
// pkg/epp/util/request/headers.go.
4143
const defaultHeaderName = "x-peer-topology"
4244

4345
type parameters struct {

pkg/epp/framework/plugins/scheduling/filter/topologyaffinity/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ attribute is absent.
6464
| `topologyProducerName` | no | default producer | `topology-extractor` instance to read the `Topology` attribute from. |
6565
| `peerTopologyHeader` | no | unset | Request header carrying the peer topology in coordinator deployments. Set to `x-peer-topology` when running in a decode EPP behind the coordinator; unused in single-EPP deployments. |
6666

67+
The plugin trusts `peerTopologyHeader` without re-verifying its source. Only set it on a
68+
profile reachable exclusively through the coordinator's forwarded header; a decode EPP
69+
reachable directly by a client would let that client spoof its own peer topology.
70+
6771
**Configuration Example, single EPP:**
6872
```yaml
6973
plugins:

pkg/epp/framework/plugins/scheduling/scorer/topologyaffinity/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ attribute is absent.
8686
| `topologyProducerName` | no | default producer | `topology-extractor` instance to read the `Topology` attribute from. |
8787
| `peerTopologyHeader` | no | unset | Request header carrying the peer topology in coordinator deployments. Set to `x-peer-topology` when running in a decode EPP behind the coordinator; unused in single-EPP deployments. |
8888

89+
The plugin trusts `peerTopologyHeader` without re-verifying its source. Only set it on a
90+
profile reachable exclusively through the coordinator's forwarded header; a decode EPP
91+
reachable directly by a client would let that client spoof its own peer topology.
92+
8993
**Configuration Example, single EPP:**
9094
```yaml
9195
plugins:

pkg/epp/util/request/headers.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ import (
2828
// peerTopologyHeaderName is the coordinator's cross-EPP header carrying the
2929
// prefill endpoint's topology to the decode EPP. A client-supplied value must
3030
// not reach the backend, since topology-affinity-filter and
31-
// topology-affinity-scorer trust it as the peer to compare against.
31+
// topology-affinity-scorer trust it as the peer to compare against. Must
32+
// match gateway.PeerTopologyHeader in pkg/coordinator/gateway and
33+
// defaultHeaderName in
34+
// pkg/epp/framework/plugins/requestcontrol/responsereceived/topologystamp.
3235
const peerTopologyHeaderName = "x-peer-topology"
3336

3437
var (

0 commit comments

Comments
 (0)