You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juneau.apache.org by "jamesbognar (via GitHub)" <gi...@apache.org> on 2026/06/12 13:13:00 UTC
Re: [PR] Proposal for public-facing APIs to implement Content Security Policy. [juneau]
jamesbognar commented on PR #57:
URL: https://github.com/apache/juneau/pull/57#issuecomment-4691579637
Hi @garydgregory — thank you for this contribution and for raising Content Security Policy support for Juneau all the way back in 2021. The proposal here (the `CspHash`/`CspNonce` vocabulary and the spec references) was a valuable starting point.
We've now implemented first-class CSP support on master, including dynamic per-request nonce support. The implementation is a fresh one built against the current 10.0 APIs (the original diff could no longer be rebased — the `org.apache.juneau.marshall.html` package move, the removal of the `HTMLDOC_*`/`ContextProperties` property system in favor of builders, and the CRTP `HtmlDocSerializer.Builder<SELF>` refactor all invalidated it). What shipped:
- A first-class immutable `ContentSecurityPolicy` HTTP header bean + fluent builder in `juneau-rest-common` (`org.apache.juneau.http.header`), with typed directive setters, a generic `directive(name, sources...)` escape hatch, source-expression helpers, report-only mode, and a ready-made nonce-based "strict starter" preset.
- Per-response `SecureRandom` nonce generation, with the same nonce injected into the emitted `Content-Security-Policy` header and stamped onto every inline `<script>`/`<style>` Juneau emits — the HtmlDoc template, the Swagger UI, the OpenAPI UI, and menu-item widgets.
- Documentation and full unit + end-to-end integration test coverage.
Because this fully supersedes the API-stub proposal here, I'm closing this PR as superseded by that work (merged to master). Your original contribution is credited in the 10.0.0 release notes. Thanks again!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@juneau.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org