Skip to content

Commit 7750c04

Browse files
committed
Validate in registry logout as well
1 parent b6a0628 commit 7750c04

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

private/buf/cmd/buf/command/registry/registrylogout/registrylogout.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"github.com/bufbuild/buf/private/bufpkg/bufconnect"
2222
"github.com/bufbuild/buf/private/pkg/app/appcmd"
2323
"github.com/bufbuild/buf/private/pkg/app/appext"
24+
"github.com/bufbuild/buf/private/pkg/netext"
2425
"github.com/bufbuild/buf/private/pkg/netrc"
2526
"github.com/spf13/pflag"
2627
)
@@ -63,6 +64,9 @@ func run(
6364
remote := bufconnect.DefaultRemote
6465
if container.NumArgs() == 1 {
6566
remote = container.Arg(0)
67+
if _, err := netext.ValidateHostname(remote); err != nil {
68+
return err
69+
}
6670
}
6771
modified1, err := netrc.DeleteMachineForName(container, remote)
6872
if err != nil {

0 commit comments

Comments
 (0)