Watch
0
0
Fork
You've already forked hyperhive
0

swarm-authelia-bridge: authorize a request before parsing its body

The handler took `Json<BridgeRequest>`, which axum runs before the handler
body. A caller with no token and a malformed body got axum's rejection
(415/400/422), whose text is serde's ("unknown variant ..., expected one of
..."), and not the one generic 401 an unauthenticated caller is meant to see.

Take the body as bytes, authorize, then parse. A caller that is let in and
sends a body that doesn't parse gets a 400 with the parse error, as before in
substance. The request's content type is no longer checked.
This commit is contained in:
maia 2026-11-30 14:53:32 +01:00 • committed by mara
commit 56cc8a86ec

1
Cargo.lock generated
View file

@ -5423,6 +5423,7 @@ dependencies = [
"swarm-authelia-bridge-sock",
"swarm-secret-client",
"tokio",
"tower",
"tracing",
]