hasura / hasura/graphql-engine

Hasura action webhook timeout error contains sensitive action handler authentication header from Hasura process environment

Open
#8,062 2 comments 0 reactions 0 assignees View on GitHub
k/question
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.1.1
CLI Version (for CLI related issue):

### Environment

Docker (Image: `hasura/graphql-engine:v2.1.1.cli-migrations-v2`)

### What is the expected behaviour?
- Hasura action GQL errors returned to a client shall never contain potentially sensitive data
- HTTP request errors and exceptions should obfuscate any header values configured for a Hasura action, like:

```json
{
"name": "my-secret-header",
"value_from_env": "MY_SECRET"
}
```

### Keywords

- `webhook`, `error`, `header`

### What is the current behaviour?

An action handler webhook timeout causes a GQL client to receive an error response that contains a sensitive action handler authentication header value (not obfuscated). See full error response example below.

### How to reproduce the issue?

1. Configure a Hasura action (synchronous, 60 second timeout) that employs an action handler authentication scheme according to: https://hasura.io/docs/latest/graphql/core/actions/action-handlers.html#restrict-access-to-your-action-handler
2. Simulate an action handler webhook timeout (e.g. Set a debugger breakpoint in the remote server's action handler.)
3. Use the Hasura console or otherwise invoke the Hasura action's GQL request; After the timeout, view the resulting error response containing the sensitive header value configured in step 1.

### Screenshots or Screencast

### Please provide any traces or logs that could help here.
Full example hasura action (GQL) error response containing authentication header (`my-secret-header`):

```json
{
"errors": [
{
"extensions": {
"internal": {
"error": {
"type": "http_exception",
"message": "Response timeout",
"request": {
"secure": false,
"path": "",
"responseTimeout": "ResponseTimeoutMicro 60000000",
"queryString": "",
"method": "POST",
"requestHeaders": {
"Content-Type": "application/json",
"X-B3-ParentSpanId": "",
"X-B3-TraceId": "",
"x-hasura-role": "",
"X-B3-SpanId": "",
"my-secret-header": ""
},
"host": "",
"port": 0
}
},
"response": null,
"request": {
"body": {
"request_query": "",
"session_variables": {
"x-hasura-role": "admin"
},
"input": {
"arg": "value"
},
"action": {
"name": ""
}
},
"transformed_request": null,
"url": "",
"headers": [
{
"name": "my-secret-header",
"value_from_env": "MY_SECRET"
},
{
"value": "",
"name": "x-hasura-role"
}
]
}
},
"path": "$",
"code": "unexpected"
},
"message": "http exception when calling webhook"
}
]
}
```

### Any possible solutions?

### Can you identify the location in the source code where the problem exists?

### If the bug is confirmed, would you be willing to submit a PR?

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Hasura action webhook timeout path and the serialization of its internal HTTP request error. Reproduce the timeout using an action handler authentication header, then verify that the GraphQL error no longer exposes configured header values while still reporting the timeout.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, graphql, haskell
Domain
api, backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.