diff --git a/go.mod b/go.mod index 1b4fc247..673f1b13 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,7 @@ require ( github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20230725143853-5dd0632f9245 github.com/charmbracelet/keygen v0.4.3 github.com/charmbracelet/log v0.2.3 - github.com/charmbracelet/ssh v0.0.0-20230720143903-5bdd92839155 + github.com/charmbracelet/ssh v0.0.0-20230822194956-1a051f898e09 github.com/go-jose/go-jose/v3 v3.0.0 github.com/gobwas/glob v0.2.3 github.com/gogs/git-module v1.8.2 diff --git a/go.sum b/go.sum index 9a44f257..94541c2b 100644 --- a/go.sum +++ b/go.sum @@ -37,6 +37,8 @@ github.com/charmbracelet/log v0.2.3 h1:YVmBhJtpGL7nW/nlf5u+SEloU8XYljxozGzZpgwIv github.com/charmbracelet/log v0.2.3/go.mod h1:ZApwwzDbbETVTIRTk7724yQRJAXIktt98yGVMMaa3y8= github.com/charmbracelet/ssh v0.0.0-20230720143903-5bdd92839155 h1:vJqYhlL0doAWQPz+EX/hK5x/ZYguoua773oRz77zYKo= github.com/charmbracelet/ssh v0.0.0-20230720143903-5bdd92839155/go.mod h1:F1vgddWsb/Yr/OZilFeRZEh5sE/qU0Dt1mKkmke6Zvg= +github.com/charmbracelet/ssh v0.0.0-20230822194956-1a051f898e09 h1:ZDIQmTtohv0S/AAYE//w8mYTxCzqphhF1+4ACPDMiLU= +github.com/charmbracelet/ssh v0.0.0-20230822194956-1a051f898e09/go.mod h1:F1vgddWsb/Yr/OZilFeRZEh5sE/qU0Dt1mKkmke6Zvg= github.com/charmbracelet/wish v1.1.1 h1:KdICASKd2oh2JPvk1Z4CJtAi97cFErXF7NKienPICO4= github.com/charmbracelet/wish v1.1.1/go.mod h1:xh4KZpSULw+Xqb9bcbhw92QAinVB75CVLWrFuyY6IVs= github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY= diff --git a/server/ssh/middleware.go b/server/ssh/middleware.go index 9a387f49..300dd379 100644 --- a/server/ssh/middleware.go +++ b/server/ssh/middleware.go @@ -68,6 +68,13 @@ func CommandMiddleware(sh ssh.Handler) ssh.Handler { cmd.GitUploadArchiveCommand(), cmd.GitReceivePackCommand(), cmd.RepoCommand(), + cmd.SettingsCommand(), + cmd.UserCommand(), + cmd.InfoCommand(), + cmd.PubkeyCommand(), + cmd.SetUsernameCommand(), + cmd.JWTCommand(), + cmd.TokenCommand(), ) if cfg.LFS.Enabled { @@ -92,25 +99,6 @@ func CommandMiddleware(sh ssh.Handler) ssh.Handler { rootCmd.SetErr(s.Stderr()) rootCmd.SetContext(ctx) - user := proto.UserFromContext(ctx) - isAdmin := cmd.IsPublicKeyAdmin(cfg, s.PublicKey()) || (user != nil && user.IsAdmin()) - if user != nil || isAdmin { - if isAdmin { - rootCmd.AddCommand( - cmd.SettingsCommand(), - cmd.UserCommand(), - ) - } - - rootCmd.AddCommand( - cmd.InfoCommand(), - cmd.PubkeyCommand(), - cmd.SetUsernameCommand(), - cmd.JWTCommand(), - cmd.TokenCommand(), - ) - } - if err := rootCmd.ExecuteContext(ctx); err != nil { s.Exit(1) // nolint: errcheck return