Repository navigation
feat: add COEP and Permissions-Policy to SecurityHeadersMiddleware - #136
Conversation
…eware Add Cross-Origin-Embedder-Policy (default: require-corp) to complete the cross-origin isolation trio (COOP + CORP + COEP), and Permissions-Policy (disabled by default) for restricting browser features. closes #125 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds missing cross-origin isolation and feature-restriction response headers to SecurityHeadersMiddleware, completing the COOP/CORP/COEP set and enabling optional Permissions-Policy control for applications that want to lock down browser capabilities.
Changes:
- Add
Cross-Origin-Embedder-Policy(defaultrequire-corp) with a setter to override/disable. - Add
Permissions-Policy(disabled by default) with a setter to enable/configure. - Extend middleware unit tests to cover defaults, disabling, and custom values for both headers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| enkan-web/src/main/java/enkan/middleware/SecurityHeadersMiddleware.java | Adds COEP + Permissions-Policy fields, applies them conditionally, and documents both headers. |
| enkan-web/src/test/java/enkan/middleware/SecurityHeadersMiddlewareTest.java | Adds assertions and new tests for COEP defaults/overrides and Permissions-Policy enablement/default absence. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * <li>{@code Cross-Origin-Embedder-Policy: require-corp}</li> | ||
| * </ul> | ||
| * | ||
| * <p>The following headers are available but disabled by default (no safe universal default): |
There was a problem hiding this comment.
Javadoc sentence is grammatically incomplete: "The following headers are available but disabled by default (no safe universal default):". Consider changing to "... (no safe universal default exists):" to match the field/setter docs and read cleanly.
| * <p>The following headers are available but disabled by default (no safe universal default): | |
| * <p>The following headers are available but disabled by default (no safe universal default exists): |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Merge coepCanBeDisabled into disabledHeaderIsNotPresent test - Combine default and disabled-by-default headers into a single <ul> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Cross-Origin-Embedder-Policyheader (default:require-corp) to complete the cross-origin isolation trio (COOP + CORP + COEP), enablingcrossOriginIsolatedcontext in browsersPermissions-Policyheader (disabled by default) for restricting browser features (camera, geolocation, etc.)nullto disablecloses #125
Test plan
require-corpand Permissions-Policy is absentnullcredentialless🤖 Generated with Claude Code