aboutsummaryrefslogtreecommitdiff
path: root/lib/dead_drop.js
diff options
context:
space:
mode:
authorRubén Beltrán del Río <ben@nsovocal.com>2017-02-19 01:59:26 -0600
committerGitHub <noreply@github.com>2017-02-19 01:59:26 -0600
commite5fdb2d460feed6beda8cac764b15f173b67159d (patch)
tree8dd6321a5966b29c69d9750495dc9b72bfdceb8b /lib/dead_drop.js
parent7404eac982a0d928866aeddaa1a0ea4d1f2d3870 (diff)
Check the Account SID (#3)
* Add twilio config to readme * Modify wording of main menu. * Modify wording of recording message * Add account sid setting to readme * Add the twilio account sid to config * Add check for accountSid * Update paw to send AccountSid
Diffstat (limited to 'lib/dead_drop.js')
-rw-r--r--lib/dead_drop.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/dead_drop.js b/lib/dead_drop.js
index 6f97645..3336444 100644
--- a/lib/dead_drop.js
+++ b/lib/dead_drop.js
@@ -45,10 +45,24 @@ module.exports = internals.DeadDrop = class DeadDrop {
_initializeServer() {
+ const self = this;
+
this._app = Koa();
this._app.use(KoaBodyParser());
+ this._app.use(function * (next) {
+
+ const accountSid = this.request.body.AccountSid || this.request.query.AccountSid;
+
+ if (accountSid === self.twilioAccountSid) {
+ yield next;
+ }
+ else {
+ this.throw('Unauthorized', 401);
+ }
+ });
+
this._initializeMainMenuRoutes();
this._initializeRecordingMenuRoutes();
this._initializeRecordingsRoutes();