mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-16 07:15:13 +01:00
Cherry-pick -- Fix security issue found by gas
This commit is contained in:
parent
7649cc5f1b
commit
9a95f14918
@ -42,6 +42,6 @@ func (s *SecretAuthorizer) Modify(req *http.Request) error {
|
|||||||
if req == nil {
|
if req == nil {
|
||||||
return errors.New("the request is null")
|
return errors.New("the request is null")
|
||||||
}
|
}
|
||||||
secret.AddToRequest(req, s.secret)
|
err := secret.AddToRequest(req, s.secret)
|
||||||
return nil
|
return err
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,9 @@ func (s *Sweeper) ClearOutdatedScheduledJobs() error {
|
|||||||
r, err := conn.Do("SET", utils.KeyPeriodicLock(s.namespace), time.Now().Unix(), "EX", 30, "NX")
|
r, err := conn.Do("SET", utils.KeyPeriodicLock(s.namespace), time.Now().Unix(), "EX", 30, "NX")
|
||||||
defer func() {
|
defer func() {
|
||||||
//Make sure it can be unlocked if it is not expired yet
|
//Make sure it can be unlocked if it is not expired yet
|
||||||
conn.Do("DEL", utils.KeyPeriodicLock(s.namespace))
|
if _, err := conn.Do("DEL", utils.KeyPeriodicLock(s.namespace)); err != nil {
|
||||||
|
logger.Errorf("Unlock key '%s' failed with error: %s\n", utils.KeyPeriodicLock(s.namespace), err.Error())
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user