Skip to content

Fido: Fix request with FidoAppIdExtension#3544

Open
p1gp1g wants to merge 1 commit into
microg:masterfrom
p1gp1g:fido/fix-fidoAppIdExtension
Open

Fido: Fix request with FidoAppIdExtension#3544
p1gp1g wants to merge 1 commit into
microg:masterfrom
p1gp1g:fido/fix-fidoAppIdExtension

Conversation

@p1gp1g

@p1gp1g p1gp1g commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

The JSON key is appid, and if it was present we were trying to get appId which always failed with an exception "No value for appId"

It caused a crash with Gitlab for example

The JSON key is `appid`, and if it was present we were trying to get `appId`
which always failed with an exception "No value for appId"
@@ -182,7 +182,7 @@ fun JSONObject.parseTokenBinding() = when (TokenBindingStatus.fromString(getStri
fun JSONObject.parseAuthenticationExtensions(): AuthenticationExtensions {
val builder = AuthenticationExtensions.Builder()
if (has("fidoAppIdExtension")) builder.setFido2Extension(FidoAppIdExtension(getJSONObject("fidoAppIdExtension").getString("appId")))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (has("fidoAppIdExtension")) builder.setFido2Extension(FidoAppIdExtension(getJSONObject("fidoAppIdExtension").getString("appId")))
if (has("fidoAppIdExtension")) builder.setFido2Extension(FidoAppIdExtension(getJSONObject("fidoAppIdExtension").getString("appid")))

This one also needs to be fixed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find any doc regarding fidoAppIdExtension, do you have one?

Also, I think it may be worth catching issues here, because we don't check if fidoAppIdExtension object has a appid field - and we can't be sure there isn't any type error

Suggested change
if (has("fidoAppIdExtension")) builder.setFido2Extension(FidoAppIdExtension(getJSONObject("fidoAppIdExtension").getString("appId")))
if (has("fidoAppIdExtension")) runCatching {
builder.setFido2Extension(FidoAppIdExtension(getJSONObject("fidoAppIdExtension").getString("appid")))
}

Note that we can probably do a runCatching for the other appid field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants