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

Headers are not being parsed correctly in Windows #600

Open
square-foot opened this issue Aug 24, 2022 · 2 comments
Open

Headers are not being parsed correctly in Windows #600

square-foot opened this issue Aug 24, 2022 · 2 comments
Labels

Comments

@square-foot
Copy link

square-foot commented Aug 24, 2022

I am running the 32bit version of the webhook exectuable

When I run the following hooks.json

[
  { 
    "id": "doscript", 
    "execute-command": "c:/apps/Webhook/scr.bat" ,  
    "include-command-output-in-response": true,
    "pass-arguments-to-command": [{
      "source": "entire-headers"
    }
  ]
  
  } 
]

I get this in the verbose output

executing c:/apps/Webhook/scr.bat (c:/apps/Webhook/scr.bat) with arguments ["c:/apps/Webhook/scr.bat" "{\"Accept\":\"*/*\",\"Accept-Encoding\":\"gzip, deflate, br\",\"Accept-Language\":\"en-US,en;q=0.5\",\"Connection\":\"keep-alive\",\"Referer\":\"https://retractedExample.com/\",\"Sec-Fetch-Dest\":\"script\",\"Sec-Fetch-Mode\":\"no-cors\",\"Sec-Fetch-Site\":\"cross-site\",\"User-Agent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0\"}"]

But it passes only a partial string to scr.bat. See below:

"{"Accept":"*/*","Accept-Encoding":"gzip 

If I change the pass-aguments-to-command to the following

  "pass-arguments-to-command": [{
      "source": "headers",
      "name": "Referer"
    }
  ]

Then it does not find the "Referer" header! Though internally it has got the entire headers it is unable to parse it beyond the word "gzip" (Maybe there is some hidden character sent by the browser that is spoiling the show)

@square-foot
Copy link
Author

I checked this in the 64 bit version of Windows. Same problem.
I checked this in Ubuntu. It is able to correctly send the entire headers (using "source": "entire-headers") on the argument list to the called function but Linux version of Webhook is still NOT retrieving the "Referer" header

@square-foot
Copy link
Author

square-foot commented Aug 24, 2022

I peered into the code here in line 34 of https://github.com/adnanh/webhook/blob/master/internal/hook/hook.go and I found that the correct way to specify a single header as source is "header" and not "headers"

So now this is working in Win32, Win64 and Ubuntu.

"pass-arguments-to-command": [{
      "source": "header",
      "name": "Referer"
    }
  ]

But the "entire-headers" is NOT working in either Win64 or Win32. It is truncating after 40 chars. Is that deliberate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants