From ecdba7775f0d3ca4a8b07f0e5462d70997ad7702 Mon Sep 17 00:00:00 2001 From: mnovak Date: Sat, 7 Nov 2026 15:58:00 +0100 Subject: [PATCH] [docs] Notes: tests/support in layout, forward-auth failure modes, bash hook self-test --- CLAUDE.md | 3 ++- crates/edge/src/forward_auth.rs | 6 +++++- docs/ROADMAP.md | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index c34972f..8e44b5b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,6 +10,7 @@ crates/control API, git routes repo, apply/rollback, share links, PKI flows. Lo apps/web Svelte 5 (runes, TypeScript strict). A client of the API; no logic. packages/ui shared dark Domi theme. tests/diff same requests against Ianitor and Caddy, responses compared. +tests/support shared test fixtures (test CA, upstreams, mock Authelia, clients); test-only. tests/fuzz cargo-fuzz targets. deploy/nixos NixOS module + VM tests. @@ -23,7 +24,7 @@ nix flake check # includes NixOS VM tests (Linux + KVM) On Windows, build and test in WSL2 Debian (ROADMAP ยง8.3: Pingora's Windows support is best effort; edge, diff and ACME tests are Linux-only). Use a Linux target dir, and put caddy, pebble and pebble-challtestsrv on PATH (`nix profile add nixpkgs#caddy nixpkgs#pebble`): wsl -d Debian -- bash -lc 'cd /mnt/f/Akce/Ianitor && CARGO_TARGET_DIR=$HOME/ianitor-target cargo test --workspace' -One-time per clone: git config core.hooksPath .githooks (self-test: sh .githooks/test-pre-commit.sh) +One-time per clone: git config core.hooksPath .githooks (self-test: bash .githooks/test-pre-commit.sh) ## Rules - Commits: `[] : `. No AI attribution, no trailers, ever. diff --git a/crates/edge/src/forward_auth.rs b/crates/edge/src/forward_auth.rs index 275714c..4666f5a 100644 --- a/crates/edge/src/forward_auth.rs +++ b/crates/edge/src/forward_auth.rs @@ -13,7 +13,11 @@ //! client request and, when the auth answer has a non-empty value, set from it. //! - Any other answer is returned to the client as it is (status, headers, body), and the //! request never reaches the upstream. -//! - If the auth server cannot be reached, the request fails closed with 502. +//! - If the auth server cannot be reached, does not answer completely within 10 s, answers +//! with more than 1 MiB of body, a broken body or `101`, the request fails closed with 502. +//! Informational answers (100, 102, 103) before the real answer are skipped. +//! - Client-sent identity headers (Authelia's four plus the copy headers) are removed first, +//! so neither the auth server nor the upstream ever sees them. use std::time::Duration; diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index a0fb77f..0b49887 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -114,7 +114,7 @@ Identity gate, tunnel, Domi templates, ACME server, HTTP/3, migrating public sit **Answer: it compiles and the unit tests run on Windows (MSVC, Rust 1.99), but the README calls Windows support "preliminary by community's best effort only".** Unix-only parts include graceful upgrade, the in-process runner and the integration tests. Caddy and Pebble are not on this Windows box. So the edge integration tests, the diff suite and the ACME test run in WSL2 Debian, as noted in CLAUDE.md. One gotcha: libz-ng-sys's CMake build fails under a very deep CARGO_TARGET_DIR (MSBuild path length). [S github.com/cloudflare/pingora README; local builds 2026-11-07] 4. Pingora graceful reload behaviour under load. (phase 2) 5. Authelia forward-auth endpoint and headers to mirror exactly. (phase 1) - **Answer: `GET /api/authz/forward-auth` (ForwardAuth implementation; legacy `/api/verify` not used).** Edge sends X-Forwarded-Method, -Proto, -Host, -URI (required) and X-Forwarded-For, and always sets them itself. It also forwards the client's headers (Cookie, Authorization) without hop-by-hop headers or body. A 2xx answer copies Remote-User, Remote-Groups, Remote-Email and Remote-Name onto the request (client copies removed). Any other answer (302 portal, 401 + WWW-Authenticate, 403) goes back to the client verbatim. An unreachable auth server fails closed with 502. This mirrors `caddy adapt` output for Authelia's documented `forward_auth` snippet; tested against a mock, not a real Authelia. [S authelia.com/reference/guides/proxy-authorization, authelia.com/integration/proxies/caddy] + **Answer: `GET /api/authz/forward-auth` (ForwardAuth implementation; legacy `/api/verify` not used).** Edge sends X-Forwarded-Method, -Proto, -Host, -URI (required) and X-Forwarded-For, and always sets them itself. It also forwards the client's headers (Cookie, Authorization) without hop-by-hop headers or body. A 2xx answer copies Remote-User, Remote-Groups, Remote-Email and Remote-Name onto the request (client copies removed). Any other answer (302 portal, 401 + WWW-Authenticate, 403) goes back to the client verbatim. An unreachable, silent (10 s deadline), oversized (>1 MiB), broken or `101` auth answer fails closed with 502; 1xx heads are skipped. Client-sent Remote-* headers are always stripped on forward-auth hosts, whatever copy_headers says. This mirrors `caddy adapt` output for Authelia's documented `forward_auth` snippet; tested against a mock, not a real Authelia. [S authelia.com/reference/guides/proxy-authorization, authelia.com/integration/proxies/caddy] 6. Custos CSR-signing operation with match-code approval. (phase 3) 7. Red Panda Network donation route for a non-US individual and the receipt they issue. (phase 4, Mark)