Merge pull request #3 from izqui/webhook-secret
Add webhook secret security measure
This commit is contained in:
commit
5cb709084d
|
@ -5,3 +5,4 @@ EXPOSE 8080
|
||||||
|
|
||||||
ENV NAME autobounty
|
ENV NAME autobounty
|
||||||
ENV STANDARD_BOUNTY 0.001
|
ENV STANDARD_BOUNTY 0.001
|
||||||
|
ENV WEBHOOK_SECRET test
|
||||||
|
|
3
index.js
3
index.js
|
@ -14,6 +14,7 @@ const Eth = require('ethjs-query');
|
||||||
|
|
||||||
const address = process.env.ADDRESS;
|
const address = process.env.ADDRESS;
|
||||||
const name = process.env.NAME;
|
const name = process.env.NAME;
|
||||||
|
const webhook_secret = process.env.WEBHOOK_SECRET;
|
||||||
|
|
||||||
const provider = new SignerProvider(process.env.NODE, {
|
const provider = new SignerProvider(process.env.NODE, {
|
||||||
signTransaction: (rawTx, cb) => cb(null, sign(rawTx, process.env.KEY)),
|
signTransaction: (rawTx, cb) => cb(null, sign(rawTx, process.env.KEY)),
|
||||||
|
@ -33,7 +34,7 @@ app.use(cors());
|
||||||
var issueData = {};
|
var issueData = {};
|
||||||
|
|
||||||
// Receive a POST request at the address specified by an env. var.
|
// Receive a POST request at the address specified by an env. var.
|
||||||
app.post('/' + address.toString(), jsonParser, function(req, res, next){
|
app.post(`/comment/${webhook_secret}`, jsonParser, function(req, res, next){
|
||||||
if (!req.body)
|
if (!req.body)
|
||||||
return res.sendStatus(400);
|
return res.sendStatus(400);
|
||||||
var commentBody = req.body.comment.body;
|
var commentBody = req.body.comment.body;
|
||||||
|
|
Loading…
Reference in New Issue