nhost / hasura-auth

Authentication for Hasura.
https://nhost.io
MIT License
373 stars 111 forks source link

feat: added endpoint to "elevate" permissions using webauthn #451

Closed dbarrosop closed 5 months ago

dbarrosop commented 7 months ago

The idea is to provide /elevate/webauthn and /elevate/webauthn/verify endpoints that work exactly like their /signin equivalents with the following differences:

  1. Elevate requires a valid access token in the Authorization header matching the email triggering the challenge.
  2. The session returned includes the added claim X-Nhost-Auth-Elevated: user-uuid

The idea is to allow users to add an extra security step to allow performing certain operations. For instance, a user could:

  1. Allow the role user to select settings or view their profile.
  2. In addition require the custom claim X-Nhost-Auth-Elevated: user-uuid to update/delete

Before submitting this PR:

Checklist

Breaking changes

Avoid breaking changes and regressions. If you feel it is unavoidable, make it explicit in your PR comment so we can review it and see how to handle it.

Tests

Documentation

Please make sure the documentation is updated accordingly, in particular:

changeset-bot[bot] commented 7 months ago

🦋 Changeset detected

Latest commit: 0c2ff8b95cfcadd12d64ed49a59455715f92d2de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ----------- | ----- | | hasura-auth | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR