Merged
Conversation
12200fa to
590ff8e
Compare
590ff8e to
04be86c
Compare
There was a problem hiding this comment.
Pull request overview
Adds CSP nonce handling for controller-served UI responses by generating a per-document nonce, injecting it into the CSP header, and rewriting the served index.html to replace a placeholder value.
Changes:
- Add
wrapHandlerWithCspmiddleware to generate/inject a CSP nonce for UI “document” requests and preserve default CSP for static assets. - Add a
ResponseWriterwrapper to replace a CSP placeholder inindex.htmlwith a runtime value. - Add unit tests covering CSP header nonce injection behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| internal/daemon/controller/handler_ui.go | Wraps UI document responses to replace a CSP placeholder in returned HTML. |
| internal/daemon/controller/handler_test.go | Adds tests for the new CSP wrapping middleware behavior. |
| internal/daemon/controller/handler.go | Introduces and wires a CSP middleware that injects a nonce for UI document requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
04be86c to
7166768
Compare
irenarindos
previously approved these changes
Apr 14, 2026
ZedLi
reviewed
Apr 14, 2026
ZedLi
reviewed
Apr 14, 2026
b59ff1c to
5631beb
Compare
5631beb to
a675c92
Compare
16a839d to
e69f87b
Compare
e69f87b to
a269242
Compare
a269242 to
897bbe1
Compare
ZedLi
approved these changes
Apr 22, 2026
Collaborator
ZedLi
left a comment
There was a problem hiding this comment.
Tested and works as expected for me!
10 tasks
irenarindos
approved these changes
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds nonce handling to support UI features. The changes include a new wrapper to apply CSP with a crypto nonce value and adjust injection of the nonce into returned HTML. This change will take place in tandem with a UI PR
PCI review checklist
Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.