HTTPRoute Path Protection #3452
Replies: 3 comments 5 replies
-
There is also some similar discussion on the level of Gateways and protecting the Gateway listeners here: #1218 |
Beta Was this translation helpful? Give feedback.
-
Thanks for this writeup @joranlager. We specifically define that, in the case of a path conflict, the oldest Route (by creation time) must be chosen, not the newest, precisely to prevent this sort of thing. Adding a new Route that matches the same hostname and path as another should be rejected by conformant impelmentations. If that's not the case, then we need to tighten up the conformance testing here and ensure that this contract is respected. |
Beta Was this translation helpful? Give feedback.
-
Thank you, @youngnick. I would like to read the section/details of the spec defining that behaviour - can you please share a link to it? I found this section that talks about the runtime enforcement/rules to follow by a Proxy or Load Balancer - and the oldest Route is the to be chosen only if there is a tie (link here: https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1.HTTPRouteRule). :
My proposal is to prevent the creation of the HTTPRoute if it contains a path that is chosen to be protected. |
Beta Was this translation helpful? Give feedback.
-
It looks like the creation of an HTTPRoute might enable a Team (the creator of a new HTTPRoute) to "steal" traffic already setup for another Team's Application (created earlier by an HTTPRoute)?
I think it would reduce risk and team friction if the HTTPRoutes could be optionally protected such that new HTTPRoutes created that will overlap protected paths will be rejected at the time of creation.
Consider this scenario:
Team A manages Application A on Gateway with hostname mycompany.com and an HTTPRoute with this path: http://mycompany.com/applicationa/*
... directing traffic to the "TeamAApplicationAService" Service.
Traffic flows into Application A for these requests:
http://mycompany.com/applicationa/index.html
http://mycompany.com/applicationa/api/*
Team B manages Application B on the same Gateway with hostname mycompany.com and an HTTPRoute with this path: http://mycompany.com/applicationb/*
... directing traffic to the "TeamBApplicationBService" Service.
Traffic flows into Application B for these requests:
http://mycompany.com/applicationb/index.html
http://mycompany.com/applicationb/api/*
Then, a new HTTPRoute is defined by Team B with the following path that includes a mistake done by Team B:
/applicationa/api/*
... directing traffic to the "TeamBApplicationBAPIService" Service.
After that change, traffic flows into Application B for these requests:
http://mycompany.com/applicationb/index.html
http://mycompany.com/applicationb/api/*
... and into Application B API for these requests:
http://mycompany.com/applicationa/api/*
And Application A looses this traffic:
http://mycompany.com/applicationa/api/*
I think it would reduce risk and team friction if the HTTPRoutes could be optionally protected such that new HTTPRoutes created that will overlap protected paths will be rejected at the time of creation.
The rules for merging Route Rules are lightly mentioned here: https://gateway-api.sigs.k8s.io/api-types/httproute/#merging
Details for hostname conflicts are documented here: https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1.HTTPRouteSpec
And HTTPRouteRule is documented here: https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io/v1.HTTPRouteRule
Beta Was this translation helpful? Give feedback.
All reactions