Skip to content

fix(csp): add explicit manifest-src 'self' directive#961

Merged
nesquena-hermes merged 1 commit intonesquena:masterfrom
24601:fix/manifest-src-csp
Apr 24, 2026
Merged

fix(csp): add explicit manifest-src 'self' directive#961
nesquena-hermes merged 1 commit intonesquena:masterfrom
24601:fix/manifest-src-csp

Conversation

@24601
Copy link
Copy Markdown
Contributor

@24601 24601 commented Apr 24, 2026

Hermes WebUI now serves a PWA manifest (static/manifest.json) and service worker added in PR #920, but the Content-Security-Policy in _security_headers() has no explicit manifest-src directive. Browsers fall back to default-src 'self' per the spec, which is functionally correct, but omitting the directive generates a console warning on every page load and leaves the PWA policy implicit rather than declared.

What changed: One line added to api/helpers.pymanifest-src 'self' inserted before base-uri. No origin set is changed; this is a declaration-only fix.

Verification: 3 regression tests added in tests/test_pwa_manifest_csp.py asserting the directive is present and that all existing directives are unchanged. Run with pytest tests/test_pwa_manifest_csp.py -v.

Risk: Limited to the CSP header string. No logic, routing, or auth changes.

Co-authored with Claude Sonnet 4.6 / Anthropic.

@24601 24601 marked this pull request as draft April 24, 2026 17:02
@24601 24601 marked this pull request as ready for review April 24, 2026 17:04
@24601 24601 force-pushed the fix/manifest-src-csp branch from 86b6721 to c0eac44 Compare April 24, 2026 17:20
PR nesquena#920 added static/manifest.json and sw.js for PWA support. The CSP
in _security_headers() had no explicit manifest-src directive, so browsers
fell back to default-src 'self' and emitted a console warning on every page
load. The fallback is functionally correct but non-compliant with CSP Level 3
best practice of declaring each directive explicitly.

Adds manifest-src 'self' before base-uri. No origin set is changed.
Regression test added alongside existing CSP coverage in test_pwa_manifest_csp.py.

Co-authored with Claude Sonnet 4.6 / Anthropic.
@24601 24601 force-pushed the fix/manifest-src-csp branch from c0eac44 to 30b4ca6 Compare April 24, 2026 17:36
@24601 24601 marked this pull request as draft April 24, 2026 17:42
nesquena-hermes added a commit that referenced this pull request Apr 24, 2026
Co-authored-by: nesquena-hermes <[email protected]>
@nesquena-hermes nesquena-hermes marked this pull request as ready for review April 24, 2026 17:44
@nesquena-hermes nesquena-hermes merged commit b072a68 into nesquena:master Apr 24, 2026
nesquena-hermes added a commit that referenced this pull request Apr 24, 2026
Co-authored-by: nesquena-hermes <[email protected]>
JKJameson pushed a commit to JKJameson/hermes-webui that referenced this pull request Apr 25, 2026
JKJameson pushed a commit to JKJameson/hermes-webui that referenced this pull request Apr 25, 2026
PR nesquena#920 added static/manifest.json and sw.js for PWA support. The CSP
in _security_headers() had no explicit manifest-src directive, so browsers
fell back to default-src 'self' and emitted a console warning on every page
load. The fallback is functionally correct but non-compliant with CSP Level 3
best practice of declaring each directive explicitly.

Adds manifest-src 'self' before base-uri. No origin set is changed.
Regression test added alongside existing CSP coverage in test_pwa_manifest_csp.py.

Co-authored with Claude Sonnet 4.6 / Anthropic.
JKJameson pushed a commit to JKJameson/hermes-webui that referenced this pull request Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants