Merge pull request #5521 from wy65701436/cherry-pick-gas

Cherry-pick -- Fix security issue found by gas
This commit is contained in:
Wenkai Yin 2018-08-03 16:50:58 +08:00 committed by GitHub
commit 5faf41e4a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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