Repository navigation
feat: explain blocked apps in the Coder Agents side panel - #31949
ethanndickson wants to merge 6 commits into
Conversation
|
@codex review |
|
@codex security review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3495f6c89
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (src === undefined) { | ||
| return; | ||
| } | ||
| const origin = URL.parse(src, location.href)?.origin; |
There was a problem hiding this comment.
Replace URL.parse for supported browsers
In the supported Chrome 111 and Safari 16.4 targets declared in site/package.json, URL.parse is unavailable, so mounting any WorkspaceIframe throws a TypeError from this layout effect before the CSP listener is registered. Consequently, workspace app and port-preview panels fail even when CSP would allow them; parse with the broadly supported new URL(...) under try/catch instead.
Useful? React with 👍 / 👎.
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3495f6c89
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 117821d0a9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
117821d to
ebdcf0a
Compare
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ebdcf0a89f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Chat: Review in progress (0/1 reviewers complete) | View chat deep-review v0.13.0 | Round 1 | Status: Netero (first pass) About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
When a Content-Security-Policy frame-src directive blocks a workspace app or port preview, the right panel now shows a blocked view with the origin, an "Open app in new tab" button and a link to new troubleshooting docs. It tells Coder's own policy apart from a policy that a reverse proxy adds. Closes CODAGT-1455
The reverse proxy text no longer asks admins to allow one per-user app origin, and it fits a header that has only default-src. The docs now show an example frame-src, cover the default-src fallback and non-default ports, and explain what to check when Coder's own policy still blocks an app after a reload.
… blocks an app With Coder's frame-src now covering every app host, Coder's own policy blocks an app only when the page loaded before the host was added. Show one message for every role, with a Reload page button, and drop the docs steps for a frame-src that does not match the app hosts.
A reverse proxy's policy also checks the redirect, so adding the origin only to CODER_ADDITIONAL_CSP_POLICY leaves the frame blocked.
…branch Each view now owns its heading and body through a shared BlockedLayout, so WorkspaceAppBlocked checks reason.kind once.
71ac834 to
b21450b
Compare
There was a problem hiding this comment.
Doc-check review (automated). 5 findings below; see the summary comment for the full checklist. This is a re-review after the branch was updated; previously raised feedback that is now addressed is not repeated here.
Generated by Coder Agents (doc-check skill).
|
|
||
| The right panel of [Coder Agents](../../coder-agents/index.md) shows workspace apps and port previews in a frame. | ||
| The browser loads a frame only if the Content Security Policy (CSP) of the dashboard page allows the origin of the app in its `frame-src` directive. | ||
| Coder adds every host that serves workspace apps to the `frame-src` directive of its policy: the access URL, the wildcard access URL, and the URL and the wildcard access URL of each workspace proxy. |
There was a problem hiding this comment.
Blocking: The plain access URL host is never literally added to frame-src; it's covered only via 'self' (the primary proxy's Host always equals r.Host, so coderd/httpmw/csp.go's extraHost.Host != r.Host check excludes it). This contradicts the correct statement two lines below ("That directive must allow 'self', the wildcard access URL, and...") and the test's own comment: "Host is not added because it duplicates the host header."
Evidence: coderd/httpmw/csp.go:148-149 ('self' already covers r.Host; extraHost.Host != r.Host && extraHost.Host != extraHost.AppHost), coderd/coderd.go:2196 (Host: api.AccessURL.Host for the primary proxy), coderd/httpmw/csp_test.go:114's TestCSP comment "Host is not added because it duplicates the host header."
| Coder adds every host that serves workspace apps to the `frame-src` directive of its policy: the access URL, the wildcard access URL, and the URL and the wildcard access URL of each workspace proxy. | |
| Coder adds every other host that serves workspace apps to the `frame-src` directive of its policy, covering the access URL with `'self'`: the wildcard access URL, and the URL and the wildcard access URL of each workspace proxy. |
(Fact Checker)
| ### Plan for apps in the right panel | ||
|
|
||
| The right panel of the Agents page shows workspace apps and port previews in a frame. | ||
| Apps with `subdomain = true` and port previews need a [wildcard access URL](../admin/networking/wildcard-access-url.md). |
There was a problem hiding this comment.
Blocking: This page documents the CSP-block case (linking to "Apps in the dashboard") but never mentions what a reader sees when the wildcard access URL is simply missing. A newcomer following this page's instructions to set up apps or port previews without a wildcard access URL hits WorkspaceAppBlocked with kind: "missing-wildcard" (or PortPreviewPanel's separate "Port previews require a wildcard access URL" message), and this page gives no pointer to that behavior or what it means.
Evidence: site/src/modules/apps/WorkspaceAppFrame.tsx (shouldDisplayWildcardWarning path renders WorkspaceAppBlocked{kind:"missing-wildcard"}), site/src/modules/apps/WorkspaceAppBlocked.tsx (missing-wildcard admin/non-admin copy), site/src/pages/AgentsPage/components/RightPanel/PortPreviewPanel.tsx (getUnavailableMessage).
Add a sentence noting what happens if the wildcard access URL isn't configured (e.g., "Without a wildcard access URL, the right panel shows an error instead of the app or port preview.") so a reader isn't left guessing when they hit the blocked state.
(Newcomer)
|
|
||
| ### Apps in the dashboard | ||
|
|
||
| The right panel of [Coder Agents](../../coder-agents/index.md) shows workspace apps and port previews in a frame. |
There was a problem hiding this comment.
Blocking: "Coder Agents" here should be "the Agents page" for consistency with docs/coder-agents/getting-started.md:153 ("The right panel of the Agents page shows workspace apps and port previews in a frame." — nearly identical sentence), and with docs/reference/glossary.md and other pages (e.g. docs/coder-agents/models.md, docs/coder-agents/chat-debug-logging.md), which consistently use "Coder Agents" as the product-name term and "the Agents page" for the screen. Using the product name here where the screen is meant creates a one-term-per-concept violation.
Rule: docs/.style/style-guide/word-choice.md#one-term-per-concept
| The right panel of [Coder Agents](../../coder-agents/index.md) shows workspace apps and port previews in a frame. | |
| The right panel of the Agents page shows workspace apps and port previews in a frame. |
(Continuity Editor)
| ``` | ||
|
|
||
| If the header has no `frame-src` directive, the browser uses its `default-src` directive for frames, so add a `frame-src` directive. | ||
| If a URL uses a port other than the default port of its scheme, include the port, for example `*.coder.example.com:8443`. |
There was a problem hiding this comment.
Blocking: "for example" introducing a parenthetical fragment should be set off with parentheses rather than a comma, per the Latin-abbreviations/example-phrasing rule's guidance on for example usage.
Rule: docs/.style/style-guide/accessibility-and-inclusion.md#latin-abbreviations
| If a URL uses a port other than the default port of its scheme, include the port, for example `*.coder.example.com:8443`. | |
| If a URL uses a port other than the default port of its scheme, include the port (for example, `*.coder.example.com:8443`). |
(Copy Editor)
| If a URL uses a port other than the default port of its scheme, include the port, for example `*.coder.example.com:8443`. | ||
| `CODER_ADDITIONAL_CSP_POLICY` doesn't change that header, because it changes only the policy that Coder sends. | ||
|
|
||
| If an app redirects to another origin in the frame, for example an external sign-in page, every policy on the dashboard page must allow that origin, including a header that a reverse proxy adds. |
There was a problem hiding this comment.
Blocking: same issue as the *.coder.example.com:8443 sentence above; the "for example" fragment here creates a double-comma cascade that's even harder to parse. Set it off with parentheses.
Rule: docs/.style/style-guide/accessibility-and-inclusion.md#latin-abbreviations
| If an app redirects to another origin in the frame, for example an external sign-in page, every policy on the dashboard page must allow that origin, including a header that a reverse proxy adds. | |
| If an app redirects to another origin in the frame (for example, an external sign-in page), every policy on the dashboard page must allow that origin, including a header that a reverse proxy adds. |
(Copy Editor)
Documentation CheckBlocking
Related open PRs
Findings for agents- id: accuracy-1
persona: accuracy
class: wrong
blocking: true
file: docs/admin/networking/wildcard-access-url.md
line: 144
quote: "Coder adds every host that serves workspace apps to the `frame-src` directive of its policy: the access URL, the wildcard access URL, and the URL and the wildcard access URL of each workspace proxy."
evidence:
- coderd/httpmw/csp.go:148-149
- coderd/coderd.go:2196
- coderd/httpmw/csp_test.go:114
rule: null
problem: The plain access URL host is never literally added to frame-src; it is covered only via 'self', contradicting the correct list two lines below.
fix: Drop "the access URL" from the list or state that 'self' covers it.
verified: true
- id: learner-1
persona: learner
class: missing
blocking: true
file: docs/coder-agents/getting-started.md
line: 154
quote: "Apps with `subdomain = true` and port previews need a [wildcard access URL](../admin/networking/wildcard-access-url.md)."
evidence:
- site/src/modules/apps/WorkspaceAppFrame.tsx:51
- site/src/modules/apps/WorkspaceAppBlocked.tsx:14
rule: null
problem: The page never describes the missing-wildcard blocked state that the right panel shows when no wildcard access URL is configured, so a reader who skips that setup cannot tell why they see an error.
fix: Add a sentence noting that without a wildcard access URL the right panel shows an error instead of the app or port preview.
verified: true
- id: consistency-1
persona: consistency
class: rule
blocking: true
file: docs/admin/networking/wildcard-access-url.md
line: 142
quote: "The right panel of [Coder Agents](../../coder-agents/index.md) shows workspace apps and port previews in a frame."
evidence:
- docs/coder-agents/getting-started.md:153
- docs/reference/glossary.md:109-114
rule: docs/.style/style-guide/word-choice.md#one-term-per-concept
problem: "Coder Agents" names the product, but this sentence means the screen, which the docs call "the Agents page".
fix: Change to "The right panel of the Agents page shows workspace apps and port previews in a frame."
verified: true
- id: language-1
persona: language
class: rule
blocking: true
file: docs/admin/networking/wildcard-access-url.md
line: 155
quote: "If a URL uses a port other than the default port of its scheme, include the port, for example `*.coder.example.com:8443`."
evidence:
- docs/.style/style-guide/accessibility-and-inclusion.md:290-344
rule: docs/.style/style-guide/accessibility-and-inclusion.md#latin-abbreviations
problem: The comma-led "for example" fragment should be a parenthetical.
fix: "Rewrite as: If a URL uses a port other than the default port of its scheme, include the port (for example, `*.coder.example.com:8443`)."
verified: true
- id: language-2
persona: language
class: rule
blocking: true
file: docs/admin/networking/wildcard-access-url.md
line: 158
quote: "If an app redirects to another origin in the frame, for example an external sign-in page, every policy on the dashboard page must allow that origin, including a header that a reverse proxy adds."
evidence:
- docs/.style/style-guide/accessibility-and-inclusion.md:290-344
rule: docs/.style/style-guide/accessibility-and-inclusion.md#latin-abbreviations
problem: The comma-led "for example" fragment creates a hard-to-parse double-comma sentence.
fix: "Rewrite as: If an app redirects to another origin in the frame (for example, an external sign-in page), every policy on the dashboard page must allow that origin, including a header that a reverse proxy adds."
verified: trueAutomated review via Coder Agents. Reply to a finding's thread with the reason if the finding is wrong. |
Closes CODAGT-1455
This is stacked on #31744, which fixes the cases where Coder's own policy blocked apps it should have allowed.
When a CSP blocks a workspace app or port preview in the Coder Agents right panel, Chrome just shows "This content is blocked", which doesn't tell anyone what to do. This PR replaces the frame with a view that names the blocked origin, has an "Open app in new tab" button (the block doesn't apply to a new tab) and links to the docs.
We can tell which policy blocked the frame from the
securitypolicyviolationevent. Coder's own policy always hasreport-uri /api/v2/csp/reports, and with #31744 itsframe-srcallows every origin the dashboard frames, so a block from it means the page loaded before that origin existed (e.g. a workspace proxy was added since). In that case we show a "Reload page" button in place of the docs link. Any other policy comes from a reverse proxy, load balancer or ingress in front of Coder, so admins are told to remove that header or add the origin to itsframe-src, and everyone else is told to contact an admin. If both policies block the app, we show the reverse proxy case, as a reload won't help.A new "Apps in the dashboard" section in
docs/admin/networking/wildcard-access-url.mdexplains which hosts the dashboard's policy has to allow and why, and the Coder Agents getting started guide links to it. The missing wildcard access URL warning now uses the same view.The dashboard can't detect an app, or a proxy in front of the wildcard access URL, sending
X-Frame-Optionsorframe-ancestors, as that violation is reported to the app's document, not ours. That case still shows Chrome's "refused to connect" page, and the docs name the headers that cause it.I've tested this by hand in Chrome and Firefox, as both an admin and a regular member, with an nginx reverse proxy in front of Coder adding its own policy. The right view showed up when Coder's policy blocked the app, when the proxy's did, and when both did, and allowed apps, report-only policies and unrelated directives were left alone.