Description
The CreateStoreExecute method in client/client.go calls request.GetBody().Name without checking whether GetBody() returns nil, which can cause a panic.
Also there are other methods with the same issue - go through them and make sure any that need fixing is fixed.
Recommendation
Add validation to check if request.GetBody() is nil before accessing Name. If nil, return a FgaRequiredParamError with param "body" to provide a graceful error instead of a nil-dereference panic. Add tests to cover the scenarios that body is nil for all relevant methods
References
Location
File: client/client.go
Lines: ~691-705 (CreateStoreExecute function)
Description
The
CreateStoreExecutemethod inclient/client.gocallsrequest.GetBody().Namewithout checking whetherGetBody()returns nil, which can cause a panic.Also there are other methods with the same issue - go through them and make sure any that need fixing is fixed.
Recommendation
Add validation to check if
request.GetBody()is nil before accessingName. If nil, return aFgaRequiredParamErrorwith param "body" to provide a graceful error instead of a nil-dereference panic. Add tests to cover the scenarios that body is nil for all relevant methodsReferences
Location
File:
client/client.goLines: ~691-705 (CreateStoreExecute function)