8000 feat: add COEP and Permissions-Policy to SecurityHeadersMiddleware by kawasima · Pull Request #136 · enkan/enkan · GitHub
[go: up one dir, main page]

Skip to content

feat: add COEP and Permissions-Policy to SecurityHeadersMiddleware - #136

Merged
kawasima merged 3 commits into
developfrom
feature/issue-125-coep-permissions-policy
Apr 2, 2026
Merged

kawasima merged 3 commits into
developfrom
feature/issue-125-coep-permissions-policy

Conversation

@kawasima
@kawasima kawasima commented Apr 2, 2026
Copy link
Copy Markdown
Collaborator

Summary

  • Add Cross-Origin-Embedder-Policy header (default: require-corp) to complete the cross-origin isolation trio (COOP + CORP + COEP), enabling crossOriginIsolated context in browsers
  • Add Permissions-Policy header (disabled by default) for restricting browser features (camera, geolocation, etc.)
  • Both headers follow the existing pattern: configurable string field, null to disable

closes #125

Test plan

  • Default headers test verifies COEP is require-corp and Permissions-Policy is absent
  • COEP can be disabled by setting to null
  • COEP can be set to credentialless
  • Permissions-Policy is applied when explicitly set
  • All 276 existing tests pass

🤖 Generated with Claude Code

…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>
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 (default require-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):
< 8000 /deferred-diff-lines>
Copilot AI Apr 2, 2026
Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
* <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):

Copilot uses AI. Check for mistakes.
kawasima and others added 2 commits April 3, 2026 07:09
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>
@kawasima
kawasima merged commit 4cd3b75 into develop Apr 2, 2026
1 check passed
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

0