mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-22 16:48:30 +01:00
Merge pull request #5521 from wy65701436/cherry-pick-gas
Cherry-pick -- Fix security issue found by gas
This commit is contained in:
commit
5faf41e4a7
@ -42,6 +42,6 @@ func (s *SecretAuthorizer) Modify(req *http.Request) error {
|
||||
if req == nil {
|
||||
return errors.New("the request is null")
|
||||
}
|
||||
secret.AddToRequest(req, s.secret)
|
||||
return nil
|
||||
err := secret.AddToRequest(req, s.secret)
|
||||
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")
|
||||
defer func() {
|
||||
//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 {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user