Currently, mcpAuthentication is a backend level policy. This sort of
made sense at the time, as its only applicable for MCP, and "is MCP" is
a property of the backend. However, in practice this causes issues.
McpAuth is a glorified JWT validator with some additional special path
handling. One of the things you might want to use JWT/MCPAuth for is
apply other policies based on the claims. Authorization, rate limit,
transformations, etc
all based on the jwt claims are quite handy and common.
The alternative to this is to start copying every single policy to an
mcpXYZ policy which sucks.
----
This would be the first time the project faces a serious "deprecating an
API" so warrants some thinking. In this case I propose:
* The old backend policy is kept around in Kubernetes and marked as
deprecated. We can keep the field around for a very long time (forever?)
without too much burden on the project as its pretty much the same
translation regardless of where it is
* Standalone is not impacted; we already had users set it in the route
level and just translated it down to a backend policy.
* If a user sets both, we reject the backend one (TODO: this is not done
in this PR)
* If a user sets JWT and MCP auth, we prefer whichever is more precise.
(TODO: this is not done in this PR)
Fixes https://github.com/agentgateway/agentgateway/issues/870
`Deny` mode is a bad API with a useful goal: to ensure that policies
MUST match the rule, essentialy adding AND semantics on top of the ALLOW
policies OR semantics.
Deny is trick, because you often end up having double negatives.
For example `deny: !(port in [443, 8443])`. Or worse, somethign like
`deny: jwt.group != 'eng'`; if the jwt doesn't have a `group` this rule
will not deny.
Instead, this proposes adding a new Require mode which is like deny but
inverted.
The above rules would be `require: port in [443, 8443]` or `require:
jwt.group == 'eng'`.
These are useful for admin level rules that apply on top of user level
rules like `require: source.address not in [banned country cidr ranges]`
etc
Within the AgentgatewayPolicy CRD there is a bug with the HostRewrite
optional property.
It is simultaneously an `enum` for `Auto`/`None` and of type `object`
with a `mode` property, which are not simultaneously satisfiable.
I believe an adequate fix would be to just move the `enum` into the
`mode`, as it was probably just an indentation bug to begin with.
I'm not sure if there are any considerations to be had about
backwards-compability since, in this case, it goes from not working
(unsatisfiable constraints) to functional (at least on the CRD side).
---------
Co-authored-by: John Howard <john.howard@solo.io>
Part of https://github.com/agentgateway/agentgateway/issues/1078
* Deprecate `config.logging` and `config.tracing` which has been
superseded by frontendPolicies
* Remove reading of those, instead convert to frontendPolicies in local
config processing
* Support path in tracing
* Move MCP to the unified tracing config (for frontendPolicies support)
* Add support to add headers on the backend request
Pulls in part of https://github.com/agentgateway/agentgateway/pull/765/
(the MCP part only; that PR has more)