tree service panics when bearer token is nil #514

Closed
opened 2023-07-12 11:32:39 +00:00 by ironbee · 1 comment
Contributor

If request to tree service does not have a bearer token and is not authorised (via authorised keys #449), the service panics.

Expected Behavior

  • Accepts request if the key is authorised
  • Returns error if the key is not authorised

Current Behavior

panic: runtime error: invalid memory address or nil pointer dereference                                                                                         
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe60fa0]                                                                                          
                                                                                                                                                                
goroutine 1071 [running]:                                                                                                                                       
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree.(*Service).verifyClient(0xc000147b80, {0x14ef2a8, 0xc0016cffc0}, {0xba, 0xf9, 0x9e, 0x10, 0xf, 0xaa
, 0xd8, ...}, ...)                                                                                                                                              
        git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree/signature.go:113 +0x860                                                                    
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree.(*Service).GetSubTree(0xc000147b80, 0xc0016cffc0, {0x14f5400, 0xc000281d30})                       
        git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree/service.go:408 +0x1c5                                                                      
git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree._TreeService_GetSubTree_Handler({0x1269760?, 0xc000147b80}, {0x14f2b10, 0xc00178bc20})             
        git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree/service_grpc.pb.go:360 +0xd0                                                               
git.frostfs.info/TrueCloudLab/frostfs-observability/tracing/grpc.NewStreamServerInterceptor.func1({0x1269760, 0xc000147b80}, {0x14f3338, 0xc0000bf4d0}, 0xc00045
2420, 0x13a5ea8)                                                                                                                                                
        git.frostfs.info/TrueCloudLab/frostfs-observability@v0.0.0-20230531082742-c97d21411eb6/tracing/grpc/interceptors.go:110 +0x41d                          
google.golang.org/grpc.getChainStreamHandler.func1({0x1269760, 0xc000147b80}, {0x14f3338, 0xc0000bf4d0})                                                        
        google.golang.org/grpc@v1.56.1/server.go:1483 +0xb9                                                                                                     
github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors.StreamServerInterceptor.func1({0x1269760, 0xc000147b80}, {0x14f3848, 0xc00023eb40}, 0xc000452420?, 
0xc0016cfe80)                                                                                                                                                   
        github.com/grpc-ecosystem/go-grpc-middleware/v2@v2.0.0-rc.5/interceptors/server.go:35 +0x31f                                                            
google.golang.org/grpc.chainStreamInterceptors.func1({0x1269760, 0xc000147b80}, {0x14f3848, 0xc00023eb40}, 0x1026fc0?, 0xc00195f550?)                           
        google.golang.org/grpc@v1.56.1/server.go:1474 +0x8f                                                                                                     
google.golang.org/grpc.(*Server).processStreamingRPC(0xc0000f2000, {0x14f6d18, 0xc00011ab60}, 0xc0004fc900, 0xc000394420, 0x1de5700, 0x0)                       
        google.golang.org/grpc@v1.56.1/server.go:1638 +0x1363                                                                                                   
google.golang.org/grpc.(*Server).handleStream(0xc0000f2000, {0x14f6d18, 0xc00011ab60}, 0xc0004fc900, 0x0)                                                       
        google.golang.org/grpc@v1.56.1/server.go:1718 +0x9f0                                                                                                    
google.golang.org/grpc.(*Server).serveStreams.func1.1()                                                                                                         
        google.golang.org/grpc@v1.56.1/server.go:959 +0x98                                                                                                      
created by google.golang.org/grpc.(*Server).serveStreams.func1                                                                                                  
        google.golang.org/grpc@v1.56.1/server.go:957 +0x18c  

Steps to Reproduce (for bugs)

  1. Do not set any authorised keys in config.
  2. Send GetSubTree request without a bearer token.

Your Environment

If request to tree service does not have a bearer token and is not authorised (via authorised keys #449), the service panics. ## Expected Behavior - Accepts request if the key is authorised - Returns error if the key is not authorised ## Current Behavior ``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe60fa0] goroutine 1071 [running]: git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree.(*Service).verifyClient(0xc000147b80, {0x14ef2a8, 0xc0016cffc0}, {0xba, 0xf9, 0x9e, 0x10, 0xf, 0xaa , 0xd8, ...}, ...) git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree/signature.go:113 +0x860 git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree.(*Service).GetSubTree(0xc000147b80, 0xc0016cffc0, {0x14f5400, 0xc000281d30}) git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree/service.go:408 +0x1c5 git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree._TreeService_GetSubTree_Handler({0x1269760?, 0xc000147b80}, {0x14f2b10, 0xc00178bc20}) git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree/service_grpc.pb.go:360 +0xd0 git.frostfs.info/TrueCloudLab/frostfs-observability/tracing/grpc.NewStreamServerInterceptor.func1({0x1269760, 0xc000147b80}, {0x14f3338, 0xc0000bf4d0}, 0xc00045 2420, 0x13a5ea8) git.frostfs.info/TrueCloudLab/frostfs-observability@v0.0.0-20230531082742-c97d21411eb6/tracing/grpc/interceptors.go:110 +0x41d google.golang.org/grpc.getChainStreamHandler.func1({0x1269760, 0xc000147b80}, {0x14f3338, 0xc0000bf4d0}) google.golang.org/grpc@v1.56.1/server.go:1483 +0xb9 github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors.StreamServerInterceptor.func1({0x1269760, 0xc000147b80}, {0x14f3848, 0xc00023eb40}, 0xc000452420?, 0xc0016cfe80) github.com/grpc-ecosystem/go-grpc-middleware/v2@v2.0.0-rc.5/interceptors/server.go:35 +0x31f google.golang.org/grpc.chainStreamInterceptors.func1({0x1269760, 0xc000147b80}, {0x14f3848, 0xc00023eb40}, 0x1026fc0?, 0xc00195f550?) google.golang.org/grpc@v1.56.1/server.go:1474 +0x8f google.golang.org/grpc.(*Server).processStreamingRPC(0xc0000f2000, {0x14f6d18, 0xc00011ab60}, 0xc0004fc900, 0xc000394420, 0x1de5700, 0x0) google.golang.org/grpc@v1.56.1/server.go:1638 +0x1363 google.golang.org/grpc.(*Server).handleStream(0xc0000f2000, {0x14f6d18, 0xc00011ab60}, 0xc0004fc900, 0x0) google.golang.org/grpc@v1.56.1/server.go:1718 +0x9f0 google.golang.org/grpc.(*Server).serveStreams.func1.1() google.golang.org/grpc@v1.56.1/server.go:959 +0x98 created by google.golang.org/grpc.(*Server).serveStreams.func1 google.golang.org/grpc@v1.56.1/server.go:957 +0x18c ``` ## Steps to Reproduce (for bugs) 1. Do not set any authorised keys in config. 2. Send `GetSubTree` request without a bearer token. ## Your Environment * Version used: 6eefe974
ironbee added the
bug
triage
labels 2023-07-12 11:32:39 +00:00
Owner

Fixed via #510.

Fixed via #510.
fyrchik added the
frostfs-node
label 2023-07-12 12:12:21 +00:00
fyrchik added this to the v0.37.0 milestone 2023-07-12 12:12:53 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#514
No description provided.