Skip to content

v0.3.0 — challenged requests keep their body (nginx 1.31.3)

Choose a tag to compare

@github-actions github-actions released this 17 Aug 11:51
· 26 commits to main since this release

Highlights

  • A challenged POST is no longer lost. A clearance expires while a page is open, the user submits the form, and the gate answers that POST with the challenge page — the body is gone, and reloading after the solve re-issues a GET or makes the browser ask the user to confirm a resubmission. The gate now reads the body first and embeds the request in the challenge page it is already sending back to that same client (docs):
    • solver.js re-issues it the moment the clearance cookie is set — as a real form submit for an application/x-www-form-urlencoded POST, so redirects, history and rendering keep their native semantics, and through fetch with the raw bytes otherwise (multipart uploads, JSON, every method a form cannot express).
    • Stateless: nothing is buffered server-side, no shared memory, no TTL, no eviction policy — the client already has its own data. The payload is unsigned by design: it travels only back to the client that sent it, and a client that edits it merely sends a different request of its own, which a cleared client may do anyway. What is enforced is that it cannot break out of the page — the URL is held to an absolute same-site path and <, >, & are escaped in the JSON (wire format).
    • Covers every data-carrying method, not just POST: the rule is a deny-list of GET/HEAD/TRACE/CONNECT, so PUT, PATCH, DELETE, OPTIONS, WebDAV verbs and anything else an API speaks are replayed too. What decides is whether the request declared a body; the method is echoed back verbatim.
  • New directives, both inheriting http → server → location like the rest:
    • pow_gate_replay on|off — default on.
    • pow_gate_replay_max_body <size> — default 1m, matching nginx's own client_max_body_size default. A real budget: the body is read into the worker before the client has proven anything.
  • Not captured (unchanged behaviour — the client is still challenged, the request just loses its body as before): bodies over the budget or without a declared length (Transfer-Encoding: chunked), requests the browser marks as ones that will not render the page (Sec-Fetch-Dest outside document/iframe/frame — a fetch/XHR call gets the challenge page as inert bytes), and the challenge:nojs tier, which has no way to carry a body back. client_max_body_size still rejects first: nginx does that in the FIND_CONFIG phase, before the gate runs at all.
  • Fix: the manual dev sandbox (./scripts/dev.sh up) had not built since the nginx 1.31.3 bump — docker-compose.dev.yml still pinned 1.31.2 against the new tarball checksum.

Upgrading from 0.2.x: drop-in, no config change needed, and a custom pow_gate_page keeps working unchanged — just keep a </body> in it, that is where the block is injected. Note the default is on, so an un-cleared POST now has its body read (up to 1m) before the challenge page is served, and that page is sent Cache-Control: no-store. Use pow_gate_replay off; to restore the previous behaviour — worth doing on file-upload locations rather than reasoning about sizes.

Artifacts

File nginx libc arch
ngx_http_pow_gate_module-0.3.0-nginx1.31.3-glibc-amd64.so 1.31.3 glibc amd64
ngx_http_pow_gate_module-0.3.0-nginx1.31.3-glibc-arm64.so 1.31.3 glibc arm64
ngx_http_pow_gate_module-0.3.0-nginx1.31.3-musl-amd64.so 1.31.3 musl amd64
ngx_http_pow_gate_module-0.3.0-nginx1.31.3-musl-arm64.so 1.31.3 musl arm64

A module .so loads only into the exact nginx version it was built for (1.31.3, --with-compat).

Verify

sha256sum -c --ignore-missing SHA256SUMS
cosign verify-blob \
  --certificate ngx_http_pow_gate_module-0.3.0-nginx1.31.3-glibc-amd64.so.pem \
  --signature   ngx_http_pow_gate_module-0.3.0-nginx1.31.3-glibc-amd64.so.sig \
  --certificate-identity-regexp 'github.com/teian/ngx_http_pow_gate' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  ngx_http_pow_gate_module-0.3.0-nginx1.31.3-glibc-amd64.so

Builds are reproducible: the workflow builds every artifact twice independently and publishes only on byte-identical output.