Skip to content

feat(api): send Permissions-Policy header on all responses - #1221

Open
rsdmike wants to merge 1 commit into
mainfrom
feat/permissions-policy-header
Open

feat(api): send Permissions-Policy header on all responses#1221
rsdmike wants to merge 1 commit into
mainfrom
feat/permissions-policy-header

Conversation

@rsdmike

@rsdmike rsdmike commented Aug 25, 2026

Copy link
Copy Markdown
Member

Console serves the bundled Angular UI itself, so it owns the response headers on that document. Extend the existing nosniff middleware to also send a Permissions-Policy denying the browser APIs the UI never uses. Postman collections check for it.

The default keeps clipboard-write and fullscreen at self: the copy buttons and the KVM viewer need them, so a blanket deny-all policy would break both.

HTTP_PERMISSIONS_POLICY / http.permissions_policy overrides the value, and an empty one sends no header. Deployments that host the UI elsewhere, or front Console with a gateway that sets its own policy, can own the header instead.

Console serves the bundled Angular UI itself, so it owns the response
headers on that document. Extend the existing nosniff middleware to
also send a Permissions-Policy denying the browser APIs the UI never
uses. Postman collections check for it.

The default keeps clipboard-write and fullscreen at self: the copy
buttons and the KVM viewer need them, so a blanket deny-all policy
would break both.

HTTP_PERMISSIONS_POLICY / http.permissions_policy overrides the value,
and an empty one sends no header. Deployments that host the UI
elsewhere, or front Console with a gateway that sets its own policy,
can own the header instead.
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.62%. Comparing base (c28d7a3) to head (b77e2ba).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1221      +/-   ##
==========================================
+ Coverage   50.61%   50.62%   +0.01%     
==========================================
  Files         148      148              
  Lines       13783    13786       +3     
==========================================
+ Hits         6976     6979       +3     
  Misses       6206     6206              
  Partials      601      601              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

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.

Pull request overview

Adds a configurable Permissions-Policy response header (alongside the existing X-Content-Type-Options: nosniff) to harden the embedded UI/document responses and keep response headers under Console’s control, with an opt-out for deployments where a gateway or external UI host should own the policy.

Changes:

  • Extend the existing security-headers middleware to optionally emit Permissions-Policy on all responses, driven by http.permissions_policy / HTTP_PERMISSIONS_POLICY.
  • Introduce config.DefaultPermissionsPolicy and wire it into default configuration and unit tests.
  • Update Postman collections to assert the shipped default Permissions-Policy is present.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/app/app.go Pass configured permissions policy into the security-headers middleware and emit Permissions-Policy when non-empty.
internal/app/app_test.go Expand middleware tests to cover presence/absence of Permissions-Policy across response shapes and ensure default policy retains required features.
integration-test/collections/console_rps_apis.postman_collection.json Add Postman assertions that responses include a default Permissions-Policy header.
integration-test/collections/console_mps_apis.postman_collection.json Add Postman assertions that responses include a default Permissions-Policy header.
config/config.go Define DefaultPermissionsPolicy, add PermissionsPolicy config field, and set its default.
config/config_test.go Assert PermissionsPolicy default is set in NewConfig() defaults.
.env.example Document HTTP_PERMISSIONS_POLICY behavior and the “empty disables header” option.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@rsdmike
rsdmike marked this pull request as ready for review August 25, 2026 21:15
@rsdmike
rsdmike requested a review from a team as a code owner August 25, 2026 21:15
@rsdmike
rsdmike enabled auto-merge (rebase) August 25, 2026 21:18

@sudhir-intc sudhir-intc left a comment

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.

LGTM, please change the PR title to refactor so that the console release binary does not get generated.

@rsdmike

rsdmike commented Aug 27, 2026

Copy link
Copy Markdown
Member Author

I think lets just hold on to it until we can release again. This isn't holding anything up, we don't have a customer asking for it. Thanks

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.

3 participants