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

Forward the User's ID to Hasura when making requests from the Node backend #1131

Open
freeqaz opened this issue Feb 16, 2023 · 1 comment
Open

Comments

@freeqaz
Copy link
Member

freeqaz commented Feb 16, 2023

This is important because it prevents IDORs due to the Confused Deputy problem instead of us relying on properly querying for if the user is authorized every time. It's possible to set the X-Hasura-Real-User-Id header or we can forward the user's JWT directly.

For example:

query GetUsersProjects($user_id: uuid!) {
    projects(where: {organization: {organization_users: {user: {kratos_id: {_eq: $user_id}}}}}) {
        id
    }
}

That can become:

query GetUsersProjects() {
    projects {
        id
    }
}

And it will still function the same.

@freeqaz freeqaz converted this from a draft issue Feb 16, 2023
@freeqaz freeqaz changed the title Forward the User's JWT to Hasura when making requests from the Node backend Forward the User's ID to Hasura when making requests from the Node backend Feb 16, 2023
@freeqaz
Copy link
Member Author

freeqaz commented Feb 16, 2023

We should try to standardize our access to Hasura so that you have to call unsafeRunQueryAsAdmin(query) to opt-in to admin access.

@breadchris breadchris moved this from 🆕 New to 📋 Backlog in LunaTrace Planning Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant