beam-cloud / beta9

Run serverless GPU workloads with fast cold starts on bare-metal servers, anywhere in the world
https://docs.beam.cloud
GNU Affero General Public License v3.0
488 stars 27 forks source link

Fix token validation in auth interceptor #517

Closed nickpetrovic closed 2 months ago

nickpetrovic commented 2 months ago

Fixes a panic when using the CLI

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x2dadf30]

goroutine 5070 [running]:
github.com/beam-cloud/beta9/pkg/auth.(*AuthInterceptor).validateToken(0x40003b24e0, 0x400086eb70)
        /workspace/pkg/auth/grpc.go:72 +0x160
github.com/beam-cloud/beta9/pkg/gateway.(*Gateway).initGrpc.(*AuthInterceptor).Unary.func1({0x3fd2bf0, 0x400086e3c0}, {0x36dd940, 0x40007a8480}, 0x40009016a0, 0x40001118f0)
        /workspace/pkg/auth/grpc.go:126 +0x4c
github.com/beam-cloud/beta9/proto._ImageService_VerifyImageBuild_Handler({0x343eec0, 0x4000555508}, {0x3fd2bf0, 0x400086e3c0}, 0x40007a8400, 0x400070b790)
        /workspace/proto/image_grpc.pb.go:130 +0x148
google.golang.org/grpc.(*Server).processUnaryRPC(0x40005e1000, {0x3fd2bf0, 0x400086e270}, {0x3fe39c0, 0x4000801200}, 0x4000883560, 0x4000539a40, 0x5cce5a0, 0x0)
        /go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1369 +0xb58
google.golang.org/grpc.(*Server).handleStream(0x40005e1000, {0x3fe39c0, 0x4000801200}, 0x4000883560)
        /go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1780 +0xb20
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        /go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1019 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 5069
        /go/pkg/mod/google.golang.org/grpc@v1.63.2/server.go:1030 +0x13c