fix: reject non-finite DID token iat/ext/nbf - #139
Open
SashaMIT wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Token.validatecomparedextandnbfwith>/<only. Pythonjson.loadsacceptsNaNandInfinityby default. Those comparisons are always false, soext: Infinitynever expired andnbf: NaNnever blocked use. A string such as"never"raisedTypeErrorinstead ofDIDTokenMalformed.Fail-closed:
iat/ext/nbfmust be finite numbers. Language-split of magiclabs/magic-admin-js#156. Distinct from that JS PR (this is the Python admin SDK).Threat-model: the attacker presents a signed DID token whose claim times are non-finite or non-numeric. They do not control the verifier clock. After decode, the signature can still be valid, and
validatestill returned success (or crashed) instead of rejecting the token.Versioning
Fixed Issues
Test instructions
Revert-tested: removing the
is_finitechecks inToken.validatemakestest_validate_raises_error_if_ext_is_not_finitefail (Infinityis accepted).Update CHANGELOG.md
Upcoming Changessection ofCHANGELOG.mdwith context related to this Pull Request.Made with Cursor