fix: external urls validate a scheme and hostname - #542
Open
untra wants to merge 2 commits into
Open
Conversation
with all these tests
untra
force-pushed
the
fix/DEVEX-523-validate-external-url-scheme
branch
from
September 1, 2026 21:57
e613fb6 to
4ddc9f1
Compare
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.
Summary
external = truenow validate the url at plan time via a newCustomizeDiffinprovider/app.go, ensuring the URL has both a scheme and a host before apply.ValidateExternalURLinprovider/helpers/validation.go, matching what a browser or OS URLhandler would actually accept. Rejects bare host:port strings (which Go's url.Parse misreads as a
scheme), opaque schemes and malformed urls
Why
External app URLs are opened directly by the browser or a custom protocol handler (e.g.
vscode://), soa URL missing a scheme or missing a host (
https://) silently fails to open for the user. This catches that at terraform plan time with a clear error instead of a confusing runtime failure.Testing
provider/helpers/validation_test.gocovering valid cases (https, vscode://,reverse-DNS custom schemes,
jetbrains-gateway://) and invalid cases (host:port without scheme,opaque schemes, missing scheme, missing host, malformed URLs).
provider/app_test.go(NoScheme, HostPortWithoutScheme, NoHost,NotExternalIsUnchecked) verifying the diff-time check only fires when external = true and unknown values (computed at apply) are skipped.
go test ./provider/... passes.