Skip to content

fix!: validate workspace app URLs on the server (#31262) - #31934

Merged
denisra merged 1 commit into
release/2.38from
fix/backport-31262-to-2.38
Nov 10, 2026
Merged

denisra merged 1 commit into
release/2.38from
fix/backport-31262-to-2.38

Conversation

@EhabY

@EhabY EhabY commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Backport of #31262 to release/2.38.

Clean cherry-pick (git cherry-pick -x 8b0c0cc35e), no conflicts.

Validates workspace app URLs in coderd, not only in the provisioner: blocked schemes and control characters are rejected for external template and sub-agent apps, $SESSION_TOKEN is stripped from sub-agent app URLs, and app status URIs other than http, https and file are dropped. See #31262 for the full description and breaking changes.

Ran go test ./provisioner/ ./coderd/agentapi/ and the app-related ./coderd/provisionerdserver/ tests on the branch: pass.

Generated with Coder Agents on behalf of @EhabY.

- Reject external app URLs with javascript, vbscript, data, blob, file,
  or filesystem schemes, or control characters, for template and
  sub-agent apps.
- Skip invalid sub-agent apps and log the reason; the dev container
  still starts.
- Strip the $SESSION_TOKEN placeholder from sub-agent app URLs.
- Drop app status URIs that aren't http, https, or file.

(cherry picked from commit 8b0c0cc)
@EhabY EhabY added the release/breaking This label is applied to PRs to detect breaking changes as part of the release process label Nov 9, 2026
@EhabY
EhabY marked this pull request as ready for review November 9, 2026 18:40
| `healthCheck` | object | Health check configuration (see below) |

An external app's `url` must include a scheme and a host, such as `zed://ssh/...` or `https://...`.
Coder rejects `javascript`, `vbscript`, `data`, `blob`, `file`, and `filesystem` URLs, and URLs that contain control characters.

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.

The external app URL restrictions here (blocked javascript, vbscript, data, blob, file, and filesystem schemes and any control characters) also apply to template coder_app resources with external = true, because they share provisioner.ValidateExternalURL (provisioner/terraform/resources.go:527 and coderd/provisionerdserver/provisionerdserver.go:3740). This section reads as devcontainer-specific, so a template author who defines a coder_app with one of these URLs won't learn that it is now rejected. Consider noting in a shared workspace-app or template coder_app page that the same restrictions apply to external coder_app URLs, not only to dev container apps. (Coverage)

@coderagents

coderagents Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Documentation Check

No blocking documentation issues found. One non-blocking suggestion on customizing-dev-containers.md.

Findings for agents
- id: coverage-1
  persona: coverage
  class: suggestion
  blocking: false
  file: docs/user-guides/devcontainers/customizing-dev-containers.md
  line: 173
  quote: "Coder rejects `javascript`, `vbscript`, `data`, `blob`, `file`, and `filesystem` URLs, and URLs that contain control characters."
  evidence:
    - provisioner/urls.go:14
    - provisioner/terraform/resources.go:527
    - coderd/provisionerdserver/provisionerdserver.go:3740
  rule: null
  problem: The same external app URL validation applies to template coder_app external URLs, but the docs describe it only for devcontainer apps.
  fix: Note the shared restriction in a template or shared workspace-app docs page.
  verified: true

Automated review via Coder Agents. Reply to a finding's thread with the reason if the finding is wrong.

@denisra
denisra merged commit 2a7bf82 into release/2.38 Nov 10, 2026
58 of 60 checks passed
@denisra
denisra deleted the fix/backport-31262-to-2.38 branch November 10, 2026 14:21
nickvigilante added a commit that referenced this pull request Nov 12, 2026
…ment (#31994)

The doc-check agent posted the raw JSON of its review request as the
summary comment on #31385
([comment](#31385 (comment))),
so GitHub showed `{"commit_id": ..., "event": "COMMENT", "body": "##
Documentation Check\n..."}` with escaped newlines. The inline review on
that run posted correctly. Of the latest summary comments on 42 PRs
reviewed since 2026-10-25, this is the only malformed one.

This changes `.claude/skills/doc-check/output.md` so the agent:

- writes the review request to `review.json` and leaves the review
`body` empty, which matches what every other run does;
- writes the summary to its own `summary.md`, never reuses `review.json`
for it, and posts or edits it with exact `gh api ... -F
body=@summary.md` commands;
- checks, when it reads the comment back, that the body starts with `##
Documentation Check` and ends with the marker, and fixes it with `PATCH`
if not.

### Follow-up: workflow guard (not in this PR yet)

A workflow job that fails the run when the sticky summary comment does
not start with `## Documentation Check` is ready, but the bot that
opened this PR can't push changes under `.github/workflows/`. The patch
adds a `check-summary-comment` job (`needs: doc-check`, `pull-requests:
read`) at the end of `doc-check.yaml`, after `delete-workspace`, so it
stays clear of the hunks #31720 changes. It passed `actionlint` (with
shellcheck) and `zizmor --offline` with no findings, and a dry run
against live comments failed on #31385 and passed on #31896 and #31934.

Related open PRs: #31649 (draft) also edits `output.md`, and #31720
edits `doc-check.yaml`. Whichever lands second may need a small rebase.


Supersedes #31966, reopened under a human author for attribution.

Co-authored-by: coder[bot] <137810501+coder[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/breaking This label is applied to PRs to detect breaking changes as part of the release process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants