Merge pull request #332 from jzelinskie/jwt-escape-infohash

middleware/jwt: escape infohash when debugging
This commit is contained in:
Jimmy Zelinskie 2017-06-06 14:23:26 -04:00 committed by GitHub
commit 3168f13b48

View file

@ -175,7 +175,7 @@ func validateJWT(ih bittorrent.InfoHash, jwtBytes []byte, cfgIss, cfgAud string,
if ihClaim, ok := claims.Get("infohash").(string); !ok || !validInfoHash(ihClaim, ih) { if ihClaim, ok := claims.Get("infohash").(string); !ok || !validInfoHash(ihClaim, ih) {
log.WithFields(log.Fields{ log.WithFields(log.Fields{
"exists": ok, "exists": ok,
"request": ih, "request": url.QueryEscape(ih.String()),
"claim": ihClaim, "claim": ihClaim,
}).Debugln("unequal or missing infohash when validating JWT") }).Debugln("unequal or missing infohash when validating JWT")
return errors.New("claim \"infohash\" is invalid") return errors.New("claim \"infohash\" is invalid")