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

Auth Webhook Missing Request Data #10537

Open
its-a-feature opened this issue Sep 11, 2024 · 0 comments
Open

Auth Webhook Missing Request Data #10537

its-a-feature opened this issue Sep 11, 2024 · 0 comments
Labels
a/authn Issues related to "authentication" and capturing session claims from an API call k/bug Something isn't working v2

Comments

@its-a-feature
Copy link

Version Information

Server Version: v2.43.0
CLI Version (for CLI related issue):

Environment

Docker v2 engine

What is the current behaviour?

I'm having a slight issue with Hasura, and I'm hoping it's just something silly on my side. I'm using the latest Docker version with a POST auth hook. Everything is working great, but I'm trying to get some extra insight into the queries/mutations/subscriptions that are happening and logging it. For a POST auth hook, Hasura sends request data and client headers in the body of the request. That's all working fine, but when it comes to subscriptions, I seem to always get "request": null. For query and mutation those are filled out properly with the operation name, query itself, and the values. I know the subscriptions are properly formatted because I get the data back as expected, it's just when trying to get this request data for logging.

What is the expected behaviour?

For subscriptions, I would expect the request field to also not be null and to be filled out in the same way as query/mutation information. Specifically, in the auth webhook data, I'd expect to see {"operationName": "subscriptionNameHere", "query": "the actual raw subscription", "variables": "any variables used"}

How to reproduce the issue?

Set up a POST auth webhook with JWT and print the body of the message that's sent from Hasura to your auth webhook.

Screenshots or Screencast

Please provide any traces or logs that could help here.

Here's some logs that I see on my end. I specifically make a query for the current data and then immediately afterwards start a subscription for new data. I print out the raw hasura info and then a parsed version that's a bit easier to read.

2024-09-11T15:19:14Z INF raw hasura info func=github.com/its-a-feature/Mythic/authentication.ExtractToken line=181 raw body="{\"headers\":{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate\",\"Connection\":\"upgrade\",\"Content-Length\":\"522\",\"Content-Type\":\"application/json\",\"Host\":\"127.0.0.1:7443\",\"User-Agent\":\"Python/3.11 aiohttp/3.8.4\",\"X-Forwarded-For\":\"127.0.0.1\",\"X-Forwarded-Port\":\"7443\",\"X-Forwarded-Proto\":\"https\",\"X-Real-IP\":\"127.0.0.1\",\"apitoken\":\"eyJ...snip\",\"x-request-id\":\"36da4f52-b6cb-4c30-935d-9fd6b45b99d3\"},\"request\":{\"operationName\":\"CurrentCallbacks\",\"query\":\"query CurrentCallbacks {\\n  callback(where: {active: {_eq: true}}, order_by: {id: asc}) {\\n    ...callback_fragment\\n  }\\n}\\n\\nfragment callback_fragment on callback {\\n  architecture\\n  description\\n  domain\\n  external_ip\\n  host\\n  id\\n  display_id\\n  integrity_level\\n  ip\\n  extra_info\\n  sleep_info\\n  pid\\n  os\\n  user\\n  agent_callback_id\\n  operation_id\\n  process_name\\n  payload {\\n    os\\n    payloadtype {\\n      name\\n    }\\n    description\\n    uuid\\n  }\\n}\"}}"

2024-09-11T15:19:14Z INF hasura info func=github.com/its-a-feature/Mythic/authentication.ExtractToken hasura={"headers":{"Accept":"*/*","Accept-Encoding":"gzip, deflate","Connection":"upgrade","Content-Length":"522","Content-Type":"application/json","Host":"127.0.0.1:7443","User-Agent":"Python/3.11 aiohttp/3.8.4","X-Forwarded-For":"127.0.0.1","X-Forwarded-Port":"7443","X-Forwarded-Proto":"https","X-Real-IP":"127.0.0.1","apitoken":"eyJ..snip","x-request-id":"36da4f52-b6cb-4c30-935d-9fd6b45b99d3"},"request":{"operationName":"CurrentCallbacks","query":"query CurrentCallbacks {\n  callback(where: {active: {_eq: true}}, order_by: {id: asc}) {\n    ...callback_fragment\n  }\n}\n\nfragment callback_fragment on callback {\n  architecture\n  description\n  domain\n  external_ip\n  host\n  id\n  display_id\n  integrity_level\n  ip\n  extra_info\n  sleep_info\n  pid\n  os\n  user\n  agent_callback_id\n  operation_id\n  process_name\n  payload {\n    os\n    payloadtype {\n      name\n    }\n    description\n    uuid\n  }\n}","variables":null}} line=191

2024-09-11T15:19:14Z INF WebServer Logging error= ClientIP=127.0.0.1 file_id= func=github.com/its-a-feature/Mythic/webserver.Initialize.InitializeGinLogger.func2 graphql_name=CurrentCallbacks latency=4.199381ms line=120 method=POST path=/graphql/webhook protocol=HTTP/1.1 responseSize=231 source=apitoken statusCode=200 user_id=1 username=mythic_admin

2024-09-11T15:19:14Z INF raw hasura info func=github.com/its-a-feature/Mythic/authentication.ExtractToken line=181 raw body="{\"headers\":{\"Host\":\"127.0.0.1:7443\",\"Sec-WebSocket-Extensions\":\"permessage-deflate; client_max_window_bits\",\"Sec-WebSocket-Protocol\":\"graphql-ws, graphql-transport-ws\",\"User-Agent\":\"Python/3.11 websockets/10.4\",\"X-Forwarded-For\":\"127.0.0.1\",\"X-Forwarded-Port\":\"7443\",\"X-Forwarded-Proto\":\"https\",\"X-Real-IP\":\"127.0.0.1\",\"apitoken\":\"eyJ...snip\"},\"request\":null}"

2024-09-11T15:19:14Z INF hasura info func=github.com/its-a-feature/Mythic/authentication.ExtractToken hasura={"headers":{"Host":"127.0.0.1:7443","Sec-WebSocket-Extensions":"permessage-deflate; client_max_window_bits","Sec-WebSocket-Protocol":"graphql-ws, graphql-transport-ws","User-Agent":"Python/3.11 websockets/10.4","X-Forwarded-For":"127.0.0.1","X-Forwarded-Port":"7443","X-Forwarded-Proto":"https","X-Real-IP":"127.0.0.1","apitoken":"eyJ...snip"},"request":{"operationName":"","query":"","variables":null}} line=191

2024-09-11T15:19:14Z INF WebServer Logging error= ClientIP=127.0.0.1 file_id= func=github.com/its-a-feature/Mythic/webserver.Initialize.InitializeGinLogger.func2 graphql_name= latency=3.462411ms line=120 method=POST path=/graphql/webhook protocol=HTTP/1.1 responseSize=231 source=apitoken statusCode=200 user_id=1 username=mythic_admin

Any possible solutions/workarounds you're aware of?

None, I can't seem to get the subscription data sent to my auth webhook.

Keywords

auth, webhook, subscription, logging

@its-a-feature its-a-feature added the k/bug Something isn't working label Sep 11, 2024
@rakeshkky rakeshkky added v2 a/authn Issues related to "authentication" and capturing session claims from an API call labels Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a/authn Issues related to "authentication" and capturing session claims from an API call k/bug Something isn't working v2
Projects
None yet
Development

No branches or pull requests

2 participants