mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-02 11:58:12 +03:00
fix: github prepend their hashes with sha256=
because of course they do
This commit is contained in:
@@ -65,15 +65,17 @@ function ConvertGitHubURL(url: string) {
|
||||
* @name POST /webhook
|
||||
*/
|
||||
app.post("/webhook", bodyParser.text({ type: "*/*" }), async (req, res) => {
|
||||
console.log(req.body);
|
||||
|
||||
const hash = crypto
|
||||
.createHmac("SHA256", ProcessEnv.webhookSecret)
|
||||
.update(req.body as string)
|
||||
.digest("hex");
|
||||
|
||||
if (hash !== req.header("X-Hub-Signature-256")) {
|
||||
console.log(`Signatures didn't match.`);
|
||||
if (`sha256=${hash}` !== req.header("X-Hub-Signature-256")) {
|
||||
console.log(
|
||||
`Signatures didn't match. ours="sha256=${hash}" theirs=${req.header(
|
||||
"X-Hub-Signature-256"
|
||||
)}`
|
||||
);
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
description: `Invalid Signature.`,
|
||||
|
||||
Reference in New Issue
Block a user