hmac
This commit is contained in:
@@ -59,7 +59,6 @@ app.get('/articles/:articleName', (req, res) => {
|
||||
|
||||
// Webhook handler
|
||||
app.post('/api', (req, res) => {
|
||||
console.log(req)
|
||||
const signature = req.headers['x-gitea-signature'];
|
||||
const payload = JSON.stringify(req.body);
|
||||
|
||||
@@ -75,7 +74,7 @@ app.post('/api', (req, res) => {
|
||||
const bufferSignature = Buffer.from(signature);
|
||||
const bufferDigest = Buffer.from(digest);
|
||||
|
||||
console.log(bufferDigest.length, bufferSignature.length)
|
||||
console.log(bufferDigest.length, bufferSignature.length, hmac, digest)
|
||||
|
||||
if (bufferSignature.length === bufferDigest.length && crypto.timingSafeEqual(bufferSignature, bufferDigest)) {
|
||||
// Secret is valid, update the repository
|
||||
|
||||
Reference in New Issue
Block a user