Files
opencloud/services/proxy/pkg
Jörn Friedrich Dreyer bd4325b75b feat(policies): pass request lengths to the proxy policies
The proxy policies middleware now passes the Content-Length of the
request body and the TUS Upload-Length header to the policies engine
as input.request.content_length and input.request.upload_length. This
allows rejecting uploads that are too big before any data is
transferred, instead of only in postprocessing after the upload has
completed.

We add them to the request instead of setting resource.size, because
the resource describes the target of the request (the middleware may
even stat it) and in postprocessing resource.size is the actual file
size.

This can only be an early check. The TUS concatenation extension
allows merging several smaller uploads into one file, so the file size
still has to be checked in postprocessing.

protojson encodes uint64 values as strings with camelCase keys, so
NewEnvironmentFromPB copies the lengths explicitly.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2026-11-05 15:28:49 +01:00
..