diff --git a/internal/backends/nomad.go b/internal/backends/nomad.go index 3a77416..c41b732 100644 --- a/internal/backends/nomad.go +++ b/internal/backends/nomad.go @@ -150,7 +150,7 @@ func Nomad(route config.Route) router.Handler { return errors.New("task group not found") } - var taskName = args[2] + taskName := args[2] if taskName == "" { taskName = group.Tasks[0].Name } @@ -189,7 +189,7 @@ func Nomad(route config.Route) router.Handler { } } - var taskName = args[3] + taskName := args[3] if taskName == "" { taskName = group.Tasks[0].Name } diff --git a/internal/backends/proxy.go b/internal/backends/proxy.go index f70a797..2fcec3b 100644 --- a/internal/backends/proxy.go +++ b/internal/backends/proxy.go @@ -47,7 +47,7 @@ type proxySettings struct { UserMap *cty.Value `cty:"userMap"` } -// Proxy is the proxy backend. It returns a handler that establishes a proxy +// Proxy is the proxy backend. It returns a handler that establishes a proxy // session to a remote server based on the provided configuration. func Proxy(route config.Route) router.Handler { return func(sess ssh.Session, arg string) error { @@ -70,7 +70,7 @@ func Proxy(route config.Route) router.Handler { if opts.User == nil { userMap := ctyObjToStringMap(opts.UserMap) user, _ := sshctx.GetUser(sess.Context()) - + if muser, ok := userMap[user.Name]; ok { opts.User = &muser } else { @@ -100,19 +100,19 @@ func Proxy(route config.Route) router.Handler { if err != nil { return err } - + knownHostHandler, err := goph.DefaultKnownHosts() if err != nil { return err } - + c.Config.Callback = func(host string, remote net.Addr, key gossh.PublicKey) error { println("hi") err = goph.AddKnownHost(host, remote, key, "") if err != nil { return err } - return knownHostHandler(host, remote, key) + return knownHostHandler(host, remote, key) } baseCmd := sess.Command() @@ -187,7 +187,7 @@ func sshHandleResize(resizeCh <-chan ssh.Window, cmd *goph.Cmd) { // readPassword reads a password from the SSH session, sending an asterisk // for each character typed. -// +// // It handles interrupts (Ctrl+C), EOF (Ctrl+D), and backspace. // It returns what it read once it receives a carriage return or a newline. func readPassword(sess ssh.Session) (string, error) { diff --git a/internal/backends/serial.go b/internal/backends/serial.go index 9d8b70d..ece5abc 100644 --- a/internal/backends/serial.go +++ b/internal/backends/serial.go @@ -95,7 +95,7 @@ func Serial(route config.Route) router.Handler { file, baudRate, config = filepath.Join(*opts.Directory, args[0]), args[1], args[2] } } - + if !route.Permissions.IsAllowed(user, filepath.Base(file)) { return router.ErrUnauthorized } diff --git a/internal/config/permissions.go b/internal/config/permissions.go index c90af94..4317625 100644 --- a/internal/config/permissions.go +++ b/internal/config/permissions.go @@ -29,7 +29,7 @@ import ( type PermissionsMap map[string]map[string][]string // IsAllowed checks if the user has permissions for all the specified items. -// +// // The default policy is deny, and denials take priority, so if one item // in items is set to deny, IsAllowed will always return false, even if // other items are explicitly allowed.