Skip to content

fix(provider): validate coder_app URL scheme for external apps - #541

Open
mmustafasenoglu wants to merge 2 commits into
coder:mainfrom
mmustafasenoglu:fix/external-app-url-validation
Open

fix(provider): validate coder_app URL scheme for external apps#541
mmustafasenoglu wants to merge 2 commits into
coder:mainfrom
mmustafasenoglu:fix/external-app-url-validation

Conversation

@mmustafasenoglu

Copy link
Copy Markdown

Summary

Validate coder_app.url when external = true so external apps require both a URL scheme and a host.

Changes

  • reject external app URLs missing a scheme or host
  • add regression tests for missing-scheme and missing-host inputs

Validation

  • go test ./provider/...

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 1, 2026 16:24
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@mmustafasenoglu

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds plan-time validation to the coder_app resource so that when external = true, the configured url must be a fully-qualified URL with both a scheme and a host, and it expands regression coverage for invalid external URL inputs.

Changes:

  • Add CustomizeDiff validation for coder_app.url when external = true.
  • Add test cases for missing-scheme and missing-host external app URLs.

Reviewed changes

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

File Description
provider/app.go Adds CustomizeDiff validation for external app URLs.
provider/app_test.go Adds regression tests for invalid external URL inputs.

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

Comment thread provider/app.go Outdated
Comment on lines +84 to +100
rawURL, ok := rd.GetOk("url")
if !ok {
return nil
}

rawURLStr, ok := rawURL.(string)
if !ok {
return fmt.Errorf("unexpected type %T for url, expected string", rawURL)
}

parsedURL, err := url.Parse(rawURLStr)
if err != nil {
return fmt.Errorf("invalid \"coder_app\" url %q for external app: %w", rawURLStr, err)
}
if parsedURL.Scheme == "" || parsedURL.Host == "" {
return fmt.Errorf("invalid \"coder_app\" url %q for external app: must include a scheme and host", rawURLStr)
}
Comment thread provider/app_test.go
`,
external: true,
}, {
name: "MissingScheme",
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mmustafasenoglu

Copy link
Copy Markdown
Author

Thanks — addressed the edge cases: empty url values are rejected when external = true, and we validate the parsed hostname (not just Host) so values like https://:8080 are rejected. Added regression tests for empty and missing-host cases.

1 similar comment
@mmustafasenoglu

Copy link
Copy Markdown
Author

Thanks — addressed the edge cases: empty url values are rejected when external = true, and we validate the parsed hostname (not just Host) so values like https://:8080 are rejected. Added regression tests for empty and missing-host cases.

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.

2 participants