Skip to content
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

Fix request verification in Slack event handler #166

Open
gigxz opened this issue Dec 8, 2021 · 0 comments
Open

Fix request verification in Slack event handler #166

gigxz opened this issue Dec 8, 2021 · 0 comments
Labels
component: plugin New plugin request, or feature request on an existing plugin priority: low low priority

Comments

@gigxz
Copy link
Collaborator

gigxz commented Dec 8, 2021

Incoming events from Slack should be verified using the signing secret. I couldn't get it working so it's disabled right now:

def verify_signature(request, timestamp, signature):
# FIXME! this isn't working for some reason
return True
signing_secret = SIGNING_SECRET
signing_secret = bytes(signing_secret, "utf-8")
body = request.body.decode("utf-8")
base = f"v0:{timestamp}:{body}".encode("utf-8")
request_hash = hmac.new(signing_secret, base, hashlib.sha256).hexdigest()
expected_signature = f"v0={request_hash}"
return hmac.compare_digest(signature, expected_signature)

@gigxz gigxz added component: plugin New plugin request, or feature request on an existing plugin priority: low low priority labels Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: plugin New plugin request, or feature request on an existing plugin priority: low low priority
Projects
None yet
Development

No branches or pull requests

1 participant