You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(sdk/go): gateways with host-derived names (containing dots) cannot be loaded #4509
I use OpenShell and build automation against its SDKs. While reviewing sdk/ I hit this behavior and reproduced it with the minimal test below against main. Any gateway added by URL without --name is affected.
Problem Statement
openshell gateway add https://gw.example.com derives the gateway name from the host (gw.example.com). The CLI accepts any single path component as a name, but the Go SDK's validateGatewayName rejects any name containing a dot (gateway/paths.go).
Impact / Why This Matters
gateway.NewClient("gw.example.com") and gateway.LoadConfig fail with invalid gateway name: name must not contain dots; when that gateway is the active one, NewClient("") fails too, and ListGateways() silently omits it. Users must re-register gateways under a dot-free name to use the Go SDK.
Acceptance Criteria
The Go SDK loads, lists and resolves (as active) any gateway name the CLI can create, including host-derived names such as gw.example.com and IPv4 hosts.
Path traversal (.., separators) is still rejected.
Reproduction Steps
openshell gateway add https://gw.example.com (or create $XDG_CONFIG_HOME/openshell/gateways/gw.example.com/metadata.json with {"gateway_endpoint":"https://gw.example.com:443","auth_mode":"none"} and active_gateway = gw.example.com).
gateway: invalid gateway name: name must not contain dots
gateway: no active gateway: active_gateway contains invalid name "gw.example.com": gateway: invalid gateway name: name must not contain dots
ListGateways omits the CLI-registered gateway
Confirmed on main. When no name is given, the CLI derives the name from the URL host (crates/openshell-cli/src/commands/gateway.rs). Its only constraint is validated_gateway_name in crates/openshell-bootstrap/src/paths.rs: the name must be a single path component. The Go SDK's validateGatewayName (sdk/go/openshell/v1/gateway/paths.go) is stricter. It rejects any dot and anything outside [A-Za-z0-9_-], so every host-derived name fails, including IPv4 hosts. Non-loopback IPv6 hosts such as [2001:db8::1] fail for the same reason.
The fix should make the Go SDK apply the same rule as the CLI: exactly one path component, rejecting empty names, ., .. and any separator. As with #4508, a shared set of valid and invalid name fixtures checked by both the Rust and Go tests would keep the two from drifting again.
The report's evidence and acceptance criteria are complete. Next step: maintainer acceptance decision.
@sunilteja93 , thanks for jumping on this! I can give your branch a review, but I have no karma to move this issue forward (needs a state:triage-accepted label by a maintainer). This might become easier in the future when the SDK gets its own repo, but for now we need to follow the process, so I would wait with my review for the issue accepted and your PR to be vouched
Thanks @rhuss , appreciate you offering to review and looping in the maintainers. I will wait for the issue acceptance and vouch approval before opening the PR.
Accepted for implementation. The CLI creates host-derived gateway names such as gw.example.com, while the Go SDK rejects the resulting configuration. A fix should align the SDK with the CLI for safe single-component names while continuing to reject path traversal and separators.
Activity
rhuss commentedon Oct 14, 2026
Confirmed on
main. When no name is given, the CLI derives the name from the URL host (crates/openshell-cli/src/commands/gateway.rs). Its only constraint isvalidated_gateway_nameincrates/openshell-bootstrap/src/paths.rs: the name must be a single path component. The Go SDK'svalidateGatewayName(sdk/go/openshell/v1/gateway/paths.go) is stricter. It rejects any dot and anything outside[A-Za-z0-9_-], so every host-derived name fails, including IPv4 hosts. Non-loopback IPv6 hosts such as[2001:db8::1]fail for the same reason.The fix should make the Go SDK apply the same rule as the CLI: exactly one path component, rejecting empty names,
.,..and any separator. As with #4508, a shared set of valid and invalid name fixtures checked by both the Rust and Go tests would keep the two from drifting again.The report's evidence and acceptance criteria are complete. Next step: maintainer acceptance decision.
sunilteja93 commentedon Oct 16, 2026
Hi @rhuss ,
I was looking into the above issue and prepared a fix for #4509 to align the Go SDK gateway name validation with the cli.
The changes cover host derived names, active gateway resolution, gateway listing, and path traversal protection.
All Go sdk tests passed locally (
go test ./... -count=1).Branch: https://github.com/sunilteja93/OpenShell/tree/fix/4509-gateway-names
Would you be open to accepting this fix? I'm also waiting on contributor vouch approval in #3827 before opening a PR.
Thanks!
rhuss commentedon Oct 16, 2026
@sunilteja93 , thanks for jumping on this! I can give your branch a review, but I have no karma to move this issue forward (needs a
state:triage-acceptedlabel by a maintainer). This might become easier in the future when the SDK gets its own repo, but for now we need to follow the process, so I would wait with my review for the issue accepted and your PR to be vouchedcc @johntmyers @mrunalp @sjenning ... for moving the needle 🙏
sunilteja93 commentedon Oct 16, 2026
Thanks @rhuss , appreciate you offering to review and looping in the maintainers. I will wait for the issue acceptance and vouch approval before opening the PR.
TaylorMutch commentedon Oct 20, 2026
Accepted for implementation. The CLI creates host-derived gateway names such as
gw.example.com, while the Go SDK rejects the resulting configuration. A fix should align the SDK with the CLI for safe single-component names while continuing to reject path traversal and separators.TaylorMutch commentedon Oct 20, 2026
@sunilteja93 I also approved your vouch request.