mirror of
https://github.com/HeyPuter/puter.git
synced 2026-02-07 06:18:42 -06:00
dev: add verification for entri webhooks
This commit is contained in:
committed by
Neal Shah
parent
aac6ff14ac
commit
686053a0fe
@@ -27,6 +27,7 @@ const { Eq } = require("../om/query/query");
|
||||
const { Endpoint } = require("../util/expressutil");
|
||||
const { IncomingMessage } = require("node:http");
|
||||
const { Context } = require("../util/context");
|
||||
const { createHash } = require('crypto');
|
||||
|
||||
// async function generateJWT(applicationId, secret, domain, ) {
|
||||
|
||||
@@ -48,6 +49,10 @@ class EntriService extends BaseService {
|
||||
* @param {*} res
|
||||
*/
|
||||
handler: async (req, res) => {
|
||||
if (createHash('sha256').update(req.body.id + this.config.secret).digest('hex') !== req.headers["entri-signature"]) {
|
||||
res.status(401).send("Lol");
|
||||
return;
|
||||
}
|
||||
if (!req.body.data.records_propagated) {
|
||||
console.log("Failed to set domain records")
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user