Cherry-pick -- Fix security issue found by gas

This commit is contained in:
wangyan 2018-08-03 01:16:53 -07:00
parent 7649cc5f1b
commit 9a95f14918
2 changed files with 5 additions and 3 deletions

View File

@ -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
} }

View File

@ -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