{"action":"created","comment":{"url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls/comments/207363919","pull_request_review_id":142941915,"id":207363919,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzM2MzkxOQ==","diff_hunk":"@@ -146,12 +118,104 @@ describe('SlackMessageAdapter', function () {\n \n   describe('#expressMiddleware()', function () {\n     beforeEach(function () {\n-      this.adapter = new SlackMessageAdapter(workingVerificationToken);\n+      this.adapter = new SlackMessageAdapter(workingSigningSecret);\n+      this.next = sinon.stub();\n+      this.dispatch = sinon.stub();\n+      this.res = sinon.stub({\n+        setHeader: function () { },\n+        end: function () { }\n+      });\n+      this.errFn = sinon.stub();\n     });\n+\n     it('should return a function', function () {\n       var middleware = this.adapter.expressMiddleware();\n       assert.isFunction(middleware);\n     });\n+    it('should error when body parser is used', function () {\n+      var middleware = this.adapter.expressMiddleware();\n+      var req = { body: { } };\n+      var res = this.res;\n+      var next = this.next;\n+      next.callsFake(function (err) {\n+        assert.equal(err.code, errorCodes.BODY_PARSER_NOT_PERMITTED);\n+      });\n+      middleware(req, res, next);\n+    });\n+    it('should succeed with basic requests', function (done) {\n+      var ts = Math.floor(Date.now() / 1000);\n+      var signature = createRequestSignature(workingSigningSecret, ts, workingRawBody);\n+      var adapter = this.adapter;\n+      var middleware = adapter.expressMiddleware();\n+      var dispatch = this.dispatch;\n+      var res = this.res;\n+      var next = this.next;\n+      adapter.dispatch = dispatch;\n+      // Create streamed request\n+      const fakeRequest = new Readable({\n+        read() {\n+          this.push(workingRawBody);\n+          this.push(null);\n+        }\n+      });\n+      fakeRequest.headers = {\n+        'x-slack-signature': signature,\n+        'x-slack-request-timestamp': ts,\n+        'content-type': contentType","path":"test/unit/test-adapter.js","position":177,"original_position":177,"commit_id":"7d607ba768990dbdf83553826f7585fd30f395f7","original_commit_id":"7d607ba768990dbdf83553826f7585fd30f395f7","user":{"login":"aoberoi","id":494795,"node_id":"MDQ6VXNlcjQ5NDc5NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/494795?v=4","gravatar_id":"","url":"https://api.github.com/users/aoberoi","html_url":"https://github.com/aoberoi","followers_url":"https://api.github.com/users/aoberoi/followers","following_url":"https://api.github.com/users/aoberoi/following{/other_user}","gists_url":"https://api.github.com/users/aoberoi/gists{/gist_id}","starred_url":"https://api.github.com/users/aoberoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoberoi/subscriptions","organizations_url":"https://api.github.com/users/aoberoi/orgs","repos_url":"https://api.github.com/users/aoberoi/repos","events_url":"https://api.github.com/users/aoberoi/events{/privacy}","received_events_url":"https://api.github.com/users/aoberoi/received_events","type":"User","site_admin":false},"body":"this can prob be a constant rather than a variable if the content-type is never changing (always urlencoded, never JSON).","created_at":"2018-08-02T20:32:44Z","updated_at":"2018-08-02T20:55:48Z","html_url":"https://github.com/slackapi/node-slack-interactive-messages/pull/58#discussion_r207363919","pull_request_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls/58","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls/comments/207363919"},"html":{"href":"https://github.com/slackapi/node-slack-interactive-messages/pull/58#discussion_r207363919"},"pull_request":{"href":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls/58"}}},"pull_request":{"url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls/58","id":205502032,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1NTAyMDMy","html_url":"https://github.com/slackapi/node-slack-interactive-messages/pull/58","diff_url":"https://github.com/slackapi/node-slack-interactive-messages/pull/58.diff","patch_url":"https://github.com/slackapi/node-slack-interactive-messages/pull/58.patch","issue_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/issues/58","number":58,"state":"open","locked":false,"title":"Decouples Express and adds request signing verification support","user":{"login":"shanedewael","id":3411005,"node_id":"MDQ6VXNlcjM0MTEwMDU=","avatar_url":"https://avatars1.githubusercontent.com/u/3411005?v=4","gravatar_id":"","url":"https://api.github.com/users/shanedewael","html_url":"https://github.com/shanedewael","followers_url":"https://api.github.com/users/shanedewael/followers","following_url":"https://api.github.com/users/shanedewael/following{/other_user}","gists_url":"https://api.github.com/users/shanedewael/gists{/gist_id}","starred_url":"https://api.github.com/users/shanedewael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shanedewael/subscriptions","organizations_url":"https://api.github.com/users/shanedewael/orgs","repos_url":"https://api.github.com/users/shanedewael/repos","events_url":"https://api.github.com/users/shanedewael/events{/privacy}","received_events_url":"https://api.github.com/users/shanedewael/received_events","type":"User","site_admin":false},"body":"###  Summary\r\n\r\nAddresses #31 and #57 \r\n\r\nCreates a breaking change that adds support for signing secrets (https://api.slack.com/docs/verifying-requests-from-slack) over legacy verification tokens.\r\n\r\nThis also decouples the adapter from express, which includes adding parsing on the adapter level and refactoring `express-middleware.js` into `http-handler`. \r\n\r\n### Requirements (place an `x` in each `[ ]`)\r\n\r\n* [x] I've read and understood the [Contributing guidelines](https://github.com/slackapi/node-slack-interactive-messages/blob/master/.github/contributing.md) and have done my best effort to follow them.\r\n* [x] I've read and agree to the [Code of Conduct](https://slackhq.github.io/code-of-conduct).\r\n","created_at":"2018-08-01T17:45:44Z","updated_at":"2018-08-02T20:55:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ee377ceccc56c32d24c7cd68321085ee6a2dc153","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls/58/commits","review_comments_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls/58/comments","review_comment_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls/comments{/number}","comments_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/issues/58/comments","statuses_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/statuses/7d607ba768990dbdf83553826f7585fd30f395f7","head":{"label":"shanedewael:add-request-signing","ref":"add-request-signing","sha":"7d607ba768990dbdf83553826f7585fd30f395f7","user":{"login":"shanedewael","id":3411005,"node_id":"MDQ6VXNlcjM0MTEwMDU=","avatar_url":"https://avatars1.githubusercontent.com/u/3411005?v=4","gravatar_id":"","url":"https://api.github.com/users/shanedewael","html_url":"https://github.com/shanedewael","followers_url":"https://api.github.com/users/shanedewael/followers","following_url":"https://api.github.com/users/shanedewael/following{/other_user}","gists_url":"https://api.github.com/users/shanedewael/gists{/gist_id}","starred_url":"https://api.github.com/users/shanedewael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shanedewael/subscriptions","organizations_url":"https://api.github.com/users/shanedewael/orgs","repos_url":"https://api.github.com/users/shanedewael/repos","events_url":"https://api.github.com/users/shanedewael/events{/privacy}","received_events_url":"https://api.github.com/users/shanedewael/received_events","type":"User","site_admin":false},"repo":{"id":143062765,"node_id":"MDEwOlJlcG9zaXRvcnkxNDMwNjI3NjU=","name":"node-slack-interactive-messages","full_name":"shanedewael/node-slack-interactive-messages","owner":{"login":"shanedewael","id":3411005,"node_id":"MDQ6VXNlcjM0MTEwMDU=","avatar_url":"https://avatars1.githubusercontent.com/u/3411005?v=4","gravatar_id":"","url":"https://api.github.com/users/shanedewael","html_url":"https://github.com/shanedewael","followers_url":"https://api.github.com/users/shanedewael/followers","following_url":"https://api.github.com/users/shanedewael/following{/other_user}","gists_url":"https://api.github.com/users/shanedewael/gists{/gist_id}","starred_url":"https://api.github.com/users/shanedewael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shanedewael/subscriptions","organizations_url":"https://api.github.com/users/shanedewael/orgs","repos_url":"https://api.github.com/users/shanedewael/repos","events_url":"https://api.github.com/users/shanedewael/events{/privacy}","received_events_url":"https://api.github.com/users/shanedewael/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/shanedewael/node-slack-interactive-messages","description":"Slack Buttons, Menus, and Dialogs made simpler for Node","fork":true,"url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages","forks_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/forks","keys_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/teams","hooks_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/hooks","issue_events_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/issues/events{/number}","events_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/events","assignees_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/assignees{/user}","branches_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/branches{/branch}","tags_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/tags","blobs_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/git/refs{/sha}","trees_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/statuses/{sha}","languages_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/languages","stargazers_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/stargazers","contributors_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/contributors","subscribers_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/subscribers","subscription_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/subscription","commits_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/commits{/sha}","git_commits_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/git/commits{/sha}","comments_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/comments{/number}","issue_comment_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/issues/comments{/number}","contents_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/contents/{+path}","compare_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/merges","archive_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/downloads","issues_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/issues{/number}","pulls_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/pulls{/number}","milestones_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/milestones{/number}","notifications_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/labels{/name}","releases_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/releases{/id}","deployments_url":"https://api.github.com/repos/shanedewael/node-slack-interactive-messages/deployments","created_at":"2018-07-31T20:18:05Z","updated_at":"2018-07-31T20:18:07Z","pushed_at":"2018-08-02T18:46:23Z","git_url":"git://github.com/shanedewael/node-slack-interactive-messages.git","ssh_url":"git@github.com:shanedewael/node-slack-interactive-messages.git","clone_url":"https://github.com/shanedewael/node-slack-interactive-messages.git","svn_url":"https://github.com/shanedewael/node-slack-interactive-messages","homepage":"","size":2342,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"slackapi:master","ref":"master","sha":"97a737e66f210a98fe65b5066ef08c18df4691ef","user":{"login":"slackapi","id":6962987,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5NjI5ODc=","avatar_url":"https://avatars3.githubusercontent.com/u/6962987?v=4","gravatar_id":"","url":"https://api.github.com/users/slackapi","html_url":"https://github.com/slackapi","followers_url":"https://api.github.com/users/slackapi/followers","following_url":"https://api.github.com/users/slackapi/following{/other_user}","gists_url":"https://api.github.com/users/slackapi/gists{/gist_id}","starred_url":"https://api.github.com/users/slackapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slackapi/subscriptions","organizations_url":"https://api.github.com/users/slackapi/orgs","repos_url":"https://api.github.com/users/slackapi/repos","events_url":"https://api.github.com/users/slackapi/events{/privacy}","received_events_url":"https://api.github.com/users/slackapi/received_events","type":"Organization","site_admin":false},"repo":{"id":88192152,"node_id":"MDEwOlJlcG9zaXRvcnk4ODE5MjE1Mg==","name":"node-slack-interactive-messages","full_name":"slackapi/node-slack-interactive-messages","owner":{"login":"slackapi","id":6962987,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5NjI5ODc=","avatar_url":"https://avatars3.githubusercontent.com/u/6962987?v=4","gravatar_id":"","url":"https://api.github.com/users/slackapi","html_url":"https://github.com/slackapi","followers_url":"https://api.github.com/users/slackapi/followers","following_url":"https://api.github.com/users/slackapi/following{/other_user}","gists_url":"https://api.github.com/users/slackapi/gists{/gist_id}","starred_url":"https://api.github.com/users/slackapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slackapi/subscriptions","organizations_url":"https://api.github.com/users/slackapi/orgs","repos_url":"https://api.github.com/users/slackapi/repos","events_url":"https://api.github.com/users/slackapi/events{/privacy}","received_events_url":"https://api.github.com/users/slackapi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/slackapi/node-slack-interactive-messages","description":"Slack Buttons, Menus, and Dialogs made simpler for Node","fork":false,"url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages","forks_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/forks","keys_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/keys{/key_id}","collaborators_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/teams","hooks_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/hooks","issue_events_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/issues/events{/number}","events_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/events","assignees_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/assignees{/user}","branches_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/branches{/branch}","tags_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/tags","blobs_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/git/refs{/sha}","trees_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/git/trees{/sha}","statuses_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/statuses/{sha}","languages_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/languages","stargazers_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/stargazers","contributors_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/contributors","subscribers_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/subscribers","subscription_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/subscription","commits_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/commits{/sha}","git_commits_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/git/commits{/sha}","comments_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/comments{/number}","issue_comment_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/issues/comments{/number}","contents_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/contents/{+path}","compare_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/compare/{base}...{head}","merges_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/merges","archive_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/downloads","issues_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/issues{/number}","pulls_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls{/number}","milestones_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/milestones{/number}","notifications_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/labels{/name}","releases_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/releases{/id}","deployments_url":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/deployments","created_at":"2017-04-13T17:56:56Z","updated_at":"2018-07-30T10:43:19Z","pushed_at":"2018-08-02T18:46:24Z","git_url":"git://github.com/slackapi/node-slack-interactive-messages.git","ssh_url":"git@github.com:slackapi/node-slack-interactive-messages.git","clone_url":"https://github.com/slackapi/node-slack-interactive-messages.git","svn_url":"https://github.com/slackapi/node-slack-interactive-messages","homepage":"","size":2293,"stargazers_count":51,"watchers_count":51,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":22,"open_issues":19,"watchers":51,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls/58"},"html":{"href":"https://github.com/slackapi/node-slack-interactive-messages/pull/58"},"issue":{"href":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/issues/58"},"comments":{"href":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/issues/58/comments"},"review_comments":{"href":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls/58/comments"},"review_comment":{"href":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/pulls/58/commits"},"statuses":{"href":"https://api.github.com/repos/slackapi/node-slack-interactive-messages/statuses/7d607ba768990dbdf83553826f7585fd30f395f7"}},"author_association":"NONE"}}
{"actor":{"display_login":"aoberoi"}}