[#1258] audit: Fix panic in LogRequest method

* Make `LogRequest` process `req=nil` to avoid panic.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-07-19 11:23:02 +03:00
parent eadcea8df0
commit e377a92d97

View file

@ -18,7 +18,11 @@ type Target interface {
}
func LogRequest(log *logger.Logger, operation string, req Request, target Target, status bool) {
LogRequestWithKey(log, operation, req.GetVerificationHeader().GetBodySignature().GetKey(), target, status)
var key []byte
if req != nil {
key = req.GetVerificationHeader().GetBodySignature().GetKey()
}
LogRequestWithKey(log, operation, key, target, status)
}
func LogRequestWithKey(log *logger.Logger, operation string, key []byte, target Target, status bool) {