High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
test(authn): pin the client-most reading of a multi-element Forwarded header for RequestScheme and RequestHost (PIN-292)
Luigi Agosti3d51572cb9c0
diff --git a/internal/authn/forwarded_test.go b/internal/authn/forwarded_test.goindex bdead20b..96503f93 100644--- a/internal/authn/forwarded_test.go+++ b/internal/authn/forwarded_test.go@@ -57,6 +57,11 @@ func TestRequestScheme(t *testing.T) {requestWith("example.com", false, map[string]string{"Forwarded": `proto="https"`}),true, "https",},+ {+ "rfc7239 Forwarded proto reads the client-most element, not the proxy-most",+ requestWith("example.com", false, map[string]string{"Forwarded": `for=203.0.113.7;host=app.example;proto=https, for=10.0.0.1;proto=http;host=proxy.internal`}),+ true, "https",+ },{"X-Forwarded-Proto preferred over Forwarded",requestWith("example.com", false, map[string]string{"X-Forwarded-Proto": "https", "Forwarded": "proto=http"}),@@ -111,6 +116,11 @@ func TestRequestHost(t *testing.T) {requestWith("origin.internal", false, map[string]string{"Forwarded": `host=public.example.com;proto=https`}),true, "public.example.com",},+ {+ "rfc7239 Forwarded host reads the client-most element, not the proxy-most",+ requestWith("origin.internal", false, map[string]string{"Forwarded": `for=203.0.113.7;proto=https;host=app.example, for=10.0.0.1;proto=http;host=proxy.internal`}),+ true, "app.example",+ },{"falls back to direct host when no forwarded header",requestWith("origin.internal", false, nil),