Repository navigation
608 trust the ingress forwarded headers and make every cookie secure - #631
Merged
paulc1983 merged 5 commits intoOct 19, 2026
Conversation
Pods sit behind Front Door -> nginx ingress, but ForwardedHeadersMiddleware only stops honouring X-Forwarded-* when BOTH KnownProxies AND KnownNetworks are empty, and only KnownProxies was cleared. The loopback KnownNetworks default therefore survived, so the edge's X-Forwarded-Proto was discarded, Request.IsHttps stayed false inside the pod, OIDC built http:// redirect URIs, cookies were never Secure, and app-level HSTS never fired. Two ordered changes: (1) trust the edge - clear KnownNetworks beside KnownProxies and record why in a comment, since the pod is reachable only through the ingress and that must be revisited if a route bypassing the edge is ever added; (2) make every cookie Secure outside Development - apply IsDevelopment() ? SameAsRequest : Always to the antiforgery cookie and to the auth cookie and the OIDC Correlation/Nonce cookies (AddDfeSignInAuthentication now takes IHostEnvironment). The order matters: DefaultAntiforgery.CheckSSLConfig throws when the policy is Always and the request is not HTTPS, so trusting X-Forwarded-Proto has to land first or every page with a form would 500. Unit 7142/7142, integration 1070/1070, E2E 301 passed / 52 skipped / 0 failed against the local Development stack, which keeps SameAsRequest so forms and the browser suite are unaffected. Review-app evidence and the DfE Sign-in https:// callback registration are still outstanding before this ships. Refs #608
|
Review app for PR 631 was deleted |
E2E smoke tests passed57 passed, 0 failed, 0 skipped in 2 min 28 s Commit |
E2E tests passed358 passed, 0 failed, 4 skipped in 17 min 17 s Commit |
paulc1983
marked this pull request as ready for review
October 19, 2026 13:02
ajs-uk-dev
previously approved these changes
Oct 19, 2026
Update code and tests to use the renamed property KnownIPNetworks. In CoreWebExtensions.cs replace options.KnownNetworks.Clear() with options.KnownIPNetworks.Clear(). In ForwardedHeadersTrustTests.cs update the assertion to Assert.Empty(options.KnownIPNetworks). Aligns code/tests with the upstream API rename and preserves behavior.
ajs-uk-dev
approved these changes
Oct 19, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.