-
Notifications
You must be signed in to change notification settings - Fork 114
Improve security by adding request signing #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
81e511d
Added request signing
Roach 3e90bd6
Fixed a line length to apease Flake
Roach 3a1e220
Fixed example
Roach ff023bc
Updated README
Roach 4d21a95
Updated timestamp check and exceptions
Roach 6d1a3f7
updated tests
Roach 88633b6
removed unused warts
Roach 8cc8f20
rearranged things to reflect the order of checks
Roach d0f023f
Singing Secret -> Signing Secret
Roach 0272d12
corrected response code
Roach fdb4aba
Update README.rst
Roach 7087dc2
Updated screenshot
Roach 78ea92c
Fixed test request signature creation
Roach 84db73b
Merge branch 'roach/request-signing' of github.com:slackapi/python-sl…
Roach daa32e5
Fixed Flask exception handling test
Roach eda43d3
Added hash matching for Python 2.7.6
Roach 6bc0c4b
Add 2.7.6 to tox environments
Roach 906aea6
Appeasing Tox
Roach 281fbd9
Making hash comparisons work in 2.7.6, 2.7.7 and 3.6.5…
Roach 7c449fd
Flake8 ignore for long URL
Roach bb23712
Update test_server.py
Roach 5bafd9c
Added more tests
Roach 46c08bd
Merge branch 'roach/request-signing' of github.com:slackapi/python-sl…
Roach 60058be
More tests
Roach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ sudo: false | |
| dist: trusty | ||
| language: python | ||
| python: | ||
| - "2.7.6" | ||
| - "2.7" | ||
| - "3.3" | ||
| - "3.4" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,27 @@ | ||
| import time | ||
| import pytest | ||
| from slackeventsapi import SlackEventAdapter | ||
|
|
||
| ADAPTER = SlackEventAdapter('vFO9LARnLI7GflLR8tGqHgdy') | ||
|
|
||
| ADAPTER = SlackEventAdapter('SIGNING_SECRET') | ||
|
|
||
| def test_event_emission(client): | ||
| # Events should trigger an event | ||
| data = pytest.reaction_event_fixture | ||
|
|
||
| @ADAPTER.on('reaction_added') | ||
| def event_handler(event): | ||
| assert event["reaction"] == 'grinning' | ||
|
|
||
| data = pytest.reaction_event_fixture | ||
| timestamp = int(time.time()) | ||
| signature = pytest.create_signature(ADAPTER.signing_secret, timestamp, data) | ||
|
|
||
| res = client.post( | ||
| '/slack/events', | ||
| data=data, | ||
| content_type='application/json' | ||
| content_type='application/json', | ||
| headers={ | ||
| 'X-Slack-Request-Timestamp': timestamp, | ||
| 'X-Slack-Signature': signature | ||
| } | ||
| ) | ||
|
|
||
| assert res.status_code == 200 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this
**kwargsused now that we aren't using any optional flags?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. Removed.