Skip to content

Commit

Permalink
Merge pull request #561 from panva/fix-validate-jws
Browse files Browse the repository at this point in the history
fix: validate signatures regardless of JWT payloads
  • Loading branch information
Sambego committed Oct 21, 2021
2 parents 3d051ad + b2406d4 commit 6285677
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/editor/jwt.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,15 @@ export function decode(jwt) {
if (!isValidBase64String(split[1])) {
result.warnings.push(strings.warnings.payloadBase64Invalid);
}
result.payload = JSON.parse(b64u.decode(split[1]));
} catch (e) {
result.errors = true;
}
result.payload = b64u.decode(split[1]);
} catch (e) {}

try {
if (!isValidJSON(b64u.decode(split[1]))) {
result.warnings.push(strings.warnings.payloadInvalidJSON);
result.payload = b64u.decode(split[1])
}
} catch (e) {
result.errors = true;
}
result.payload = JSON.parse(b64u.decode(split[1]))
} catch (e) {}

return result;
}
Expand Down

0 comments on commit 6285677

Please sign in to comment.