mirror of
https://github.com/goharbor/harbor.git
synced 2025-02-22 23:01:33 +01:00
Ignore the arguments when logging the job detail
As the arguments of a job may contain sensitive information, ignore them when logging the job detail. Fixes #8404 Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
parent
4f7e225e69
commit
8325f0769f
@ -17,6 +17,7 @@ package cworker
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gocraft/work"
|
"github.com/gocraft/work"
|
||||||
@ -30,7 +31,6 @@ import (
|
|||||||
"github.com/goharbor/harbor/src/jobservice/worker"
|
"github.com/goharbor/harbor/src/jobservice/worker"
|
||||||
"github.com/gomodule/redigo/redis"
|
"github.com/gomodule/redigo/redis"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -66,7 +66,10 @@ type workerContext struct{}
|
|||||||
|
|
||||||
// log the job
|
// log the job
|
||||||
func (rpc *workerContext) logJob(job *work.Job, next work.NextMiddlewareFunc) error {
|
func (rpc *workerContext) logJob(job *work.Job, next work.NextMiddlewareFunc) error {
|
||||||
jobInfo, _ := utils.SerializeJob(job)
|
jobCopy := *job
|
||||||
|
// as the args may contain sensitive information, ignore them when logging the detail
|
||||||
|
jobCopy.Args = nil
|
||||||
|
jobInfo, _ := utils.SerializeJob(&jobCopy)
|
||||||
logger.Infof("Job incoming: %s", jobInfo)
|
logger.Infof("Job incoming: %s", jobInfo)
|
||||||
|
|
||||||
return next()
|
return next()
|
||||||
|
Loading…
Reference in New Issue
Block a user