Skip to content
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

Add AllowedApplicationOrigin environment variable for non url origins #127

Merged
merged 6 commits into from
Dec 6, 2023

Conversation

RobHarveyDev
Copy link
Contributor

@RobHarveyDev RobHarveyDev commented Nov 29, 2023

Issue #: N/A

Description of changes:
Adds a new environment variable and logic for handling origins that are not proper URLs (such as those used by Android apps).

The reason for this change is due to android apps sending android:apk-key-hash:some_hash instead of a URL. Currently the origin passed by the client is converted to a URL object which will fail with non-url origins. This behaviour is explained in the webauthn spec here

A web application with a companion native application might allow origin to be an operating system dependent identifier for the native application. For example, such a Relying Party might require that origin exactly equals some element of the list ["https://example.org", "example-os:appid:204ffa1a5af110ac483f131a1bef8a841a7adb0d8d135908bbd964ed05d2653b"].

This PR aims to avoid changing the current behaviour with allowedOrigins and adds this as an extra feature.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@RobHarveyDev
Copy link
Contributor Author

We have tested this by deploying the change to our own staging environment and adding a passkey from an android device

@ottokruse
Copy link
Contributor

Thanks for this PR!
We are all just back from a very hectic re:Invent week, so bear with us please while we have a closer look.

@ottokruse
Copy link
Contributor

Pushed a naming nitpick. Also removed the new URL(origin).origin and just did origin now, should also work and the former felt funny looking at it.

@ottokruse ottokruse merged commit 9e1641d into aws-samples:main Dec 6, 2023
@RobHarveyDev RobHarveyDev deleted the allow-application-origins branch December 6, 2023 11:50
@ottokruse
Copy link
Contributor

Published to npm in v0.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants