From 321bbfc7726560c2cbbc01335eaba936d2bc4455 Mon Sep 17 00:00:00 2001 From: n/a Date: Tue, 4 Aug 2026 12:13:30 +0200 Subject: [PATCH 1/3] toke removed --- .gitignore | 4 +++- go.mod | 3 +-- go.sum | 8 ++------ internal/grpc/grpcapi.go | 34 +--------------------------------- 4 files changed, 7 insertions(+), 42 deletions(-) diff --git a/.gitignore b/.gitignore index 6f16082..7b588cb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,6 @@ tests/kbox .nfs* reports/ .nfs* -bin \ No newline at end of file +bin +common +go.work* \ No newline at end of file diff --git a/go.mod b/go.mod index 7b34e8d..6c3d7a7 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/fatih/color v1.18.0 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 github.com/gorilla/mux v1.8.1 - github.com/k8shell-io/common v0.33.0 + github.com/k8shell-io/common v0.36.0 github.com/k8shell-io/k8shell-go v0.2.1 github.com/pkg/sftp v1.13.10 github.com/rs/zerolog v1.34.0 @@ -28,7 +28,6 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.27.0 // indirect - github.com/golang-jwt/jwt/v5 v5.3.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/kr/fs v0.1.0 // indirect github.com/kr/pretty v0.3.1 // indirect diff --git a/go.sum b/go.sum index cd25248..c31026b 100644 --- a/go.sum +++ b/go.sum @@ -30,8 +30,6 @@ github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91 github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4= github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY= -github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= @@ -44,10 +42,8 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/k8shell-io/common v0.32.2 h1:C/lQycVaYVqXIoAzPJuVV0jqq7FuPk6O2RtbeNndJ/4= -github.com/k8shell-io/common v0.32.2/go.mod h1:40c5GkpS7Y0/aOFa37Lq8z/mLUn3k3GV/AHtFJFL28k= -github.com/k8shell-io/common v0.33.0 h1:2PehtiDOG2i88pUwnPUce0HufJjgBJylcIIZkWePafU= -github.com/k8shell-io/common v0.33.0/go.mod h1:40c5GkpS7Y0/aOFa37Lq8z/mLUn3k3GV/AHtFJFL28k= +github.com/k8shell-io/common v0.36.0 h1:fkMH1XfYRLzDxqhIq5/luHusWWPGnCGJUXSTEIhEDzI= +github.com/k8shell-io/common v0.36.0/go.mod h1:E8dsb9ta4v3ne61AJgtRyTTbTkMMmKeCMAcXD+/9+cY= github.com/k8shell-io/k8shell-go v0.2.1 h1:6n88ijXkzP39//lIy4ai3XqtpSUXzoa/dVaWogHQYf4= github.com/k8shell-io/k8shell-go v0.2.1/go.mod h1:j1JHgUIKIbaiRaitx6Pzw37ahqS4Hu9OcM4uvJ7BP4g= github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= diff --git a/internal/grpc/grpcapi.go b/internal/grpc/grpcapi.go index c0758b1..fb78a00 100644 --- a/internal/grpc/grpcapi.go +++ b/internal/grpc/grpcapi.go @@ -2,8 +2,7 @@ // license that can be found in the LICENSE file. // Package grpc implements the k8shelld gRPC API service. It creates a gRPC server, -// registers all service handlers, sets up TLS, and enforces JWT-based caller authentication -// via a unary server interceptor. +// registers all service handlers, and sets up TLS. package grpc @@ -167,8 +166,6 @@ func (a *GRPCService) Serve(ctx context.Context) error { return fmt.Errorf("failed to create gRPC server: %v", err) } - server.AddInterceptor(a.callerValidationInterceptor()) - if err := server.RegisterService(func(s *grpc.Server) error { k8shelldv1.RegisterSystemServiceServer(s, NewSystemServiceServer(a)) k8shelldv1.RegisterSshServiceServer(s, NewSshServiceServer(a)) @@ -228,35 +225,6 @@ func (a *GRPCService) Serve(ctx context.Context) error { } } -func (s *GRPCService) callerValidationInterceptor() grpc.UnaryServerInterceptor { - return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) { - // md, ok := metadata.FromIncomingContext(ctx) - // if !ok { - // return nil, status.Errorf(codes.InvalidArgument, "missing metadata") - // } - - // data := md.Get("token") - // if len(data) == 0 { - // return nil, status.Errorf(codes.InvalidArgument, "missing token in metadata") - // } - - // tokenStr := data[0] - // if tokenStr == "" { - // return nil, status.Errorf(codes.InvalidArgument, "empty token in metadata") - // } - - // _, err = s.jwtVerifier.VerifyToken(tokenStr) - // if err != nil { - // return nil, status.Errorf(codes.PermissionDenied, "invalid token: %v", err) - // } - - // if !s.user.TokenEqual(tokenStr) { - // return nil, status.Errorf(codes.PermissionDenied, "invalid token: caller token does not match workspace token") - // } - return handler(ctx, req) - } -} - // resolveShellUser determines which OS user the shell session should run as. // Priority: explicit "root" > named user lookup > default user. func (s *GRPCService) resolveShellUser(reqUser string, callerUser *models.User) (models.ShellUser, error) { From 46b7abf5d611cacc9fdbe659bc9866697cb13470 Mon Sep 17 00:00:00 2001 From: n/a Date: Tue, 4 Aug 2026 12:31:21 +0200 Subject: [PATCH 2/3] k8shell go version bump --- go.mod | 2 +- go.sum | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 6c3d7a7..daac1eb 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 github.com/gorilla/mux v1.8.1 github.com/k8shell-io/common v0.36.0 - github.com/k8shell-io/k8shell-go v0.2.1 + github.com/k8shell-io/k8shell-go v0.2.3 github.com/pkg/sftp v1.13.10 github.com/rs/zerolog v1.34.0 github.com/spf13/cobra v1.9.1 diff --git a/go.sum b/go.sum index c31026b..246de42 100644 --- a/go.sum +++ b/go.sum @@ -46,6 +46,10 @@ github.com/k8shell-io/common v0.36.0 h1:fkMH1XfYRLzDxqhIq5/luHusWWPGnCGJUXSTEIhE github.com/k8shell-io/common v0.36.0/go.mod h1:E8dsb9ta4v3ne61AJgtRyTTbTkMMmKeCMAcXD+/9+cY= github.com/k8shell-io/k8shell-go v0.2.1 h1:6n88ijXkzP39//lIy4ai3XqtpSUXzoa/dVaWogHQYf4= github.com/k8shell-io/k8shell-go v0.2.1/go.mod h1:j1JHgUIKIbaiRaitx6Pzw37ahqS4Hu9OcM4uvJ7BP4g= +github.com/k8shell-io/k8shell-go v0.2.2 h1:rwLOeIfyq1+l2Jyv0ak/lXZS7x6xbA5ye0yMsRkTonw= +github.com/k8shell-io/k8shell-go v0.2.2/go.mod h1:ZShnaWs7zxUlNwAkIn4lJodFqaB+PB8O+gn2EIscxq8= +github.com/k8shell-io/k8shell-go v0.2.3 h1:gL7dXDYN4EhWdQvvnY4B2On9Tpb1sZ7G5lO8RtI/nr4= +github.com/k8shell-io/k8shell-go v0.2.3/go.mod h1:wWb5gq693qqb48/p5iYrosLG4uNeGOr5dQJiOClIbE8= github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= From 1b58bef0019441e67c08884d8b5b6f40119ef73e Mon Sep 17 00:00:00 2001 From: n/a Date: Thu, 6 Aug 2026 08:53:37 +0200 Subject: [PATCH 3/3] common version bump --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index daac1eb..4126099 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/fatih/color v1.18.0 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 github.com/gorilla/mux v1.8.1 - github.com/k8shell-io/common v0.36.0 + github.com/k8shell-io/common v0.37.0 github.com/k8shell-io/k8shell-go v0.2.3 github.com/pkg/sftp v1.13.10 github.com/rs/zerolog v1.34.0 diff --git a/go.sum b/go.sum index 246de42..f4829e4 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/k8shell-io/common v0.36.0 h1:fkMH1XfYRLzDxqhIq5/luHusWWPGnCGJUXSTEIhEDzI= github.com/k8shell-io/common v0.36.0/go.mod h1:E8dsb9ta4v3ne61AJgtRyTTbTkMMmKeCMAcXD+/9+cY= +github.com/k8shell-io/common v0.37.0 h1:whq66WosIJECKErUKZF1RQep7tdpOfI6GtP4hXREpsQ= +github.com/k8shell-io/common v0.37.0/go.mod h1:E8dsb9ta4v3ne61AJgtRyTTbTkMMmKeCMAcXD+/9+cY= github.com/k8shell-io/k8shell-go v0.2.1 h1:6n88ijXkzP39//lIy4ai3XqtpSUXzoa/dVaWogHQYf4= github.com/k8shell-io/k8shell-go v0.2.1/go.mod h1:j1JHgUIKIbaiRaitx6Pzw37ahqS4Hu9OcM4uvJ7BP4g= github.com/k8shell-io/k8shell-go v0.2.2 h1:rwLOeIfyq1+l2Jyv0ak/lXZS7x6xbA5ye0yMsRkTonw=