Skip to content

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

Open
@freeqaz

Description

@freeqaz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions