Skip to content

Auth: REST + Webhook Auth operation context missing #8771

Closed as not planned
Closed as not planned
@fkowal

Description

@fkowal

Is your proposal related to a problem?

Inconsistent behavior of webhook request for REST api. #7910
I am unable to pass queryParam from ENV variable (secret required by external system)

Solution

Consistent webhook that provides the context for REST & graphql queries

Given:

query sample_query($arg: String) {
   run_action_that_requires_a_query_param_secret { ... } 
}
and a REST endpoint /api/rest/endpoint/sample_query_path/:arg that executed the above query

HASURA_GRAPHQL_AUTH_HOOK=GET

Example request: `{hasuraUrl}/api/rest/endpoint/sample_query_path/argValue`
Auth request1: `{authEndpoint}?path=/api/rest/endpoint/sample_query_path/argValue&type=rest|graphql`
Auth request2: `{authEndpoint}?operationName=sample_query&[arg=argValue]&type=rest|graphql <- optional arg values

HASURA_GRAPHQL_AUTH_HOOK=POST

Auth request1: { headers, request: { operationName: sample_query, variables: { arg: "argValue" }} <- consitent with running the above sample query directly via `/v1/graphql`}

Auth request2: { headers, type: "rest", path: "/api/rest/endpoint/sample_query_path/:arg", variables: {arg: "argValue"}}}

Auth request3: { headers, request: { type: "rest", path: "/api/rest/endpoint/sample_query_path/:arg", variables: {arg: "argValue"}}}

When the operation name is available to the auth webhook
I would be able to pass the x-hasura-external-api-secret and use it via ${session_variables[...]} in the action
But only when operationName / path should have access to this

If the feature is approved, would you be willing to submit a PR?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    k/enhancementNew feature or improve an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions