Skip to content

Commit 5201f58

Browse files
authored
Merge pull request #6971 from matte1782/docs-authz-64kib-buffer-2026-05
docs: clarify 64 KiB response-body buffer in authz plugin docs
2 parents 5d48774 + 6d38b7a commit 5201f58

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

docs/extend/plugins_authorization.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,31 @@ passed to the authorization plugins. For commands that return chunked HTTP
8686
response, such as `logs` and `events`, only the HTTP request is sent to the
8787
authorization plugins.
8888

89+
### Response body size and partial buffering
90+
91+
The internal buffer that holds the response body between the daemon's HTTP
92+
handler and the plugin's response authorization callback (`responseModifier`,
93+
defined in [`pkg/authorization/response.go`](https://github.com/moby/moby/blob/master/pkg/authorization/response.go))
94+
has a fixed capacity of 64 KiB (`maxBufferSize`).
95+
96+
For most non-streaming endpoints the full response is buffered for plugin
97+
inspection regardless of total size, because Go's `encoding/json` encoder
98+
serializes the complete payload into a single underlying write. The
99+
streaming-response exclusion noted above (for example, `logs` and `events`)
100+
is the practical effect of this 64 KiB threshold combined with the
101+
`io.WriteFlusher` write pattern used by streaming handlers, where each write
102+
is immediately drained to the client and is therefore no longer available
103+
for plugin inspection by the time the handler returns.
104+
105+
> [!NOTE]
106+
> Plugins that depend on `ResponseBody` inspection for redaction or
107+
> content-filtering should restrict their policies to endpoints whose
108+
> response is produced as a single write (typical of REST-style API
109+
> responses). For commands whose responses are streamed or are likely to
110+
> exceed the buffer through multiple writes, do not rely on `ResponseBody`
111+
> for security-relevant decisions; perform the filtering in a separate
112+
> layer in front of the daemon.
113+
89114
During request/response processing, some authorization flows might
90115
need to do additional queries to the Docker daemon. To complete such flows,
91116
plugins can call the daemon API similar to a regular user. To enable these

0 commit comments

Comments
 (0)