Add .well-known/security.txt redirect to MoJ central file#1145
Merged
Carl Sixsmith (carlsixsmith-moj) merged 1 commit intoJun 18, 2026
Merged
Conversation
This complies with MoJ security guidance, which requires services where the MoJ is responsible for cyber security to redirect (301) the /.well-known/security.txt path
Contributor
|
Confirmed works locally. Awaiting deployment to CP to confirm deployed version. |
Carl Sixsmith (carlsixsmith-moj)
approved these changes
Jun 18, 2026
Carl Sixsmith (carlsixsmith-moj)
pushed a commit
that referenced
this pull request
Jun 19, 2026
Add /.well-known/security.txt redirect to MoJ central file This complies with MoJ security guidance, which requires services where the MoJ is responsible for cyber security to redirect (301) the /.well-known/security.txt path
Carl Sixsmith (carlsixsmith-moj)
pushed a commit
that referenced
this pull request
Jun 25, 2026
Add /.well-known/security.txt redirect to MoJ central file This complies with MoJ security guidance, which requires services where the MoJ is responsible for cyber security to redirect (301) the /.well-known/security.txt path
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.
🔗 Related Work
📌 Summary
Adds an anonymous
HTTP 301redirect from/.well-known/security.txtto the MoJ-maintained centralsecurity.txtfile.🎯 Purpose / Motivation
MoJ security guidance requires every service where the MoJ is responsible for cyber security to expose
/.well-known/security.txtso security researchers can find vulnerability-disclosure contacts (per RFC 9116 / securitytxt.org). Rather than hosting our own copy, the guidance mandates redirecting to the central file so the contacts and the mandatoryExpiresfield stay current and never drift per service.🧠 Approach
GET /.well-known/security.txtendpoint inConfigureServer(Server.UIDependencyInjection.cs) that returnsResults.Redirect(..., permanent: true)— i.e. anHTTP 301.https://security-guidance.service.justice.gov.uk/.well-known/security.txt, exactly as required by the guidance (not the raw GitHub copy)..AllowAnonymous()so the path is reachable from the public Internet without authentication, even though the rest of the application requires sign-in. This is an explicit requirement of the guidance.wwwroot/.well-known/security.txtfile deliberately: a self-hosted copy drifts, and its mandatoryExpiresfield goes stale (the central file's had already expired). Redirecting keeps a single source of truth.Reviewers: please confirm the redirect remains anonymous behind any auth/forwarded-headers/reverse-proxy configuration in deployed environments.
Reference: https://security-guidance.service.justice.gov.uk/implement-security-txt/
🔄 Changes
GET /.well-known/security.txt301 redirect endpoint (anonymous) insrc/Server.UI/DependencyInjection.cs.🧪 How to Test
Cats.AppHostvia Aspire)./.well-known/security.txt, e.g.curl -I https://localhost:<port>/.well-known/security.txt.Locationheader.Expected result:
📸 Screenshots / Output (if applicable)
Details:
🙋 Notes for Reviewers
MapRazorComponents, beforeMapAdditionalIdentityEndpoints) is appropriate.AllowAnonymous()is sufficient to bypass any global authorization/session-timeout middleware in all environments.