Skip to content

fix: CCP-3643 lock down csp - #392

Merged
WalterMoar merged 3 commits into
mainfrom
fix/3643-tighten-csp
Mar 5, 2026
Merged

fix: CCP-3643 lock down csp#392
WalterMoar merged 3 commits into
mainfrom
fix/3643-tighten-csp

Conversation

@WalterMoar

@WalterMoar WalterMoar commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Description

The Content Security Policy for the frontend Caddyfile is not only overly permissive but it also includes things like openstreetmap. It’s probable that the CSP was copied from CHEFS and we cannot ignore security best practices and the OWASP ZAP Scan findings.

Work through the OWASP ZAP Scan results and with a timebox of one day fix as many of the issues as possible.

Acceptance Criteria

  • As many ZAP Scan items as possible are fixed within the timebox
  • No new ZAP Scan items are added to the report
  • The app continues to function as expected

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Manual testing plus running the ZAP Scan against the PR.

Checklist

  • I have read the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have already been accepted and merged

Thanks for the PR!

Deployments, as required, will be available below:

Please create PRs in draft mode. Mark as ready to enable:

After merge, new images are deployed in:

@WalterMoar WalterMoar added the zap Run the OWASP ZAP Scan on this PR label Mar 3, 2026
@WalterMoar
WalterMoar force-pushed the fix/3643-tighten-csp branch from b08a03e to fa373b7 Compare March 3, 2026 22:51
@WalterMoar
WalterMoar force-pushed the fix/3643-tighten-csp branch from 7e3bdde to 06fd737 Compare March 3, 2026 23:38
@WalterMoar
WalterMoar force-pushed the fix/3643-tighten-csp branch from 06fd737 to 38b3fd8 Compare March 3, 2026 23:55
@WalterMoar
WalterMoar marked this pull request as ready for review March 4, 2026 00:06
Comment thread frontend/Caddyfile

header {
-Server
X-Frame-Options "SAMEORIGIN"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering why this and X-XSS-Protection were removed as I believe they pertain to iframe security

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! Good question about X-Frame-Options. CSP replaced it with frame-ancestors: 'self', but I supposed it could be left in for IE11? And other legacy browsers?

X-XSS-Protection is discouraged, though, and again replaced with the CSP. AFAIK current browsers have stopped using it. I suppose that again we could leave it in for legacy browsers, but if anything it should be explicitly disabled (0) to prevent buggy legacy filters from being used.

@WalterMoar

Copy link
Copy Markdown
Contributor Author

@BrandonSharratt - restored the X-Frame-Options header, thanks! I think that since X-XSS-Protection is deprecated it's best to remove it.

The CSP was copied from CHEFS and far too permissive. Lock it down and open back up if problems occur.
The ZAP Scan for PRs was using the wrong URL.
Add the X-Frame-Options header back in for legacy browsers.
@sonarqubecloud

sonarqubecloud Bot commented Mar 4, 2026

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed for 'tenant-management-system_frontend'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@WalterMoar
WalterMoar merged commit d2d2f6b into main Mar 5, 2026
33 of 35 checks passed
@WalterMoar
WalterMoar deleted the fix/3643-tighten-csp branch March 5, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

zap Run the OWASP ZAP Scan on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants