[#1258] audit: Fix panic in LogRequest method
All checks were successful
DCO action / DCO (pull_request) Successful in 11m49s
Vulncheck / Vulncheck (pull_request) Successful in 12m48s
Build / Build Components (1.22) (pull_request) Successful in 14m58s
Build / Build Components (1.21) (pull_request) Successful in 15m34s
Tests and linters / gopls check (pull_request) Successful in 16m12s
Tests and linters / Lint (pull_request) Successful in 16m41s
Tests and linters / Staticcheck (pull_request) Successful in 16m35s
Tests and linters / Tests (1.21) (pull_request) Successful in 21m57s
Tests and linters / Tests (1.22) (pull_request) Successful in 21m55s
Tests and linters / Tests with -race (pull_request) Successful in 22m30s
Pre-commit hooks / Pre-commit (pull_request) Successful in 32m31s
All checks were successful
DCO action / DCO (pull_request) Successful in 11m49s
Vulncheck / Vulncheck (pull_request) Successful in 12m48s
Build / Build Components (1.22) (pull_request) Successful in 14m58s
Build / Build Components (1.21) (pull_request) Successful in 15m34s
Tests and linters / gopls check (pull_request) Successful in 16m12s
Tests and linters / Lint (pull_request) Successful in 16m41s
Tests and linters / Staticcheck (pull_request) Successful in 16m35s
Tests and linters / Tests (1.21) (pull_request) Successful in 21m57s
Tests and linters / Tests (1.22) (pull_request) Successful in 21m55s
Tests and linters / Tests with -race (pull_request) Successful in 22m30s
Pre-commit hooks / Pre-commit (pull_request) Successful in 32m31s
* Make `LogRequest` process `req=nil` to avoid panic. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
eadcea8df0
commit
e377a92d97
1 changed files with 5 additions and 1 deletions
|
@ -18,7 +18,11 @@ type Target interface {
|
||||||
}
|
}
|
||||||
|
|
||||||
func LogRequest(log *logger.Logger, operation string, req Request, target Target, status bool) {
|
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) {
|
func LogRequestWithKey(log *logger.Logger, operation string, key []byte, target Target, status bool) {
|
||||||
|
|
Loading…
Reference in a new issue