-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add jwt_signature_pk_urls
to state
#866
base: develop
Are you sure you want to change the base?
Conversation
jwt_signature_pk_urls
to state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. I have concerns about security in the process of token verification.
Let's sync and discuss this.
mpc-recovery/src/oauth.rs
Outdated
let json: HashMap<String, String> = response.json().await?; | ||
Ok(json.into_values().collect()) | ||
jwt_signature_pk_urls: &[String], | ||
) -> Result<Vec<String>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to create a map of keys: "provider" -> "[keys]".
Otherwise, somebody will create a token using provider1
, but verify it with key 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
@@ -98,6 +98,21 @@ impl OidcToken { | |||
|
|||
Ok((header, claims, signature.into())) | |||
} | |||
|
|||
// NOTE: code taken directly from our implementation of token.decode but without the verification step | |||
pub fn decode_unverified(&self) -> anyhow::Result<(jwt::Header, IdTokenClaims, String)> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's reuse it in decode
} | ||
} | ||
|
||
fn parse_jwks_format(obj: &serde_json::Map<String, Value>) -> Result<Vec<String>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's test this
This PR:
jwt_signature_pk_url
fromSignNodeState
andLeadeState
withjwt_signature_pk_urls
as comma separated listget_public_keys
to fetch and handle public key responses with both firebase format and standard jwks format e.g. googleThe purpose is to add support to mpc for non firebase issuers e.g. google, apple etc. When a new issuer is added we need to ensure their public keys are also being fetched by appending their jwks url to this new env