MaxBodySize logs the full client-chosen path ahead of RequireAuth, sidestepping the access-log line budget #176
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by the independent review of #174 while sweeping for siblings of the credential leak. Pre-existing, and outside that PR's scope.
internal/middleware/middleware.go:616-622— theMaxBodySizerejection path logsr.URL.Pathuntruncated, atWarnlevel, so it is on by default. Andinternal/server/routes.go:128-131placesMaxBodySizeahead ofRequireAuth.So an unauthenticated
POST /source/<8 KB of client-chosen text>/editcarrying an oversize declaredContent-Lengthwrites an arbitrary-length attacker-chosen path into the operator's log — bypassing the 2,560-byte per-line budget that #146 just established, because that budget lives in the access-log field capping and this is a separate log call.Milestoned
1.0.0for consistency: this is exactly the defect class #146 was moved into the milestone for — an unauthenticated client on the public internet writing unbounded attacker-chosen text into the operator's logs. That fix is incomplete while this path exists, and leaving it would mean the stated per-line bound is true of one log call and false of another, which is worse than not stating it.Note it does NOT reopen #160: there is no query string involved, only the path.
Definition of done
slogcall reaching a client-controlled value — path, header, form field, URL — before or independently of the access-log capping needs the same treatment or an explicit reason. List what you checked.MaxBodySizeshould sit behindRequireAuthinstead. It probably should not — an oversize body ought to be rejected before any session work — so if you leave the ordering, say why in a comment, since the ordering is what makes this reachable unauthenticated.Implementation requirements
next, PR based onnext, single commit, title ending(closes #N).TODO.md(see #112).make bootstrapin a fresh clone before gating — browser assets are fetched at build time, andmake lintnow needs Docker.make checkplus the Docker lint path with the cache defeated. All linting runs in Docker, never on the host.