Description
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