Skip to main content

Slack Request Permission

License: MIT Python 3.7 Django

Installation

  • Compatibility
Python Version > 3.5
Django Version > 2.0
  • Install using
pip install slack-request-permission

Introduction

Every slack app that needs to interact with any server needs to be verified (verify if the sender is actually slack).

This package offers you:

Out-of-the-box

To use out of the box permission class, all you have to do is add the class into permission classes of Django Rest Framework.

class RandomSlackRequestView(APIView):
    permission_classes = (IsSlackAppRequest,)

In settings.py

SLACK_APP_VERSION = 'v0'
SLACK_APP_SIGNING_SECRET = {YOUR_SLACK_APP_SIGNING_SECRET}

The view will verify that the incoming request is from slack before running anything.

Framework

There might come a use case where you have different slack apps with different signing_secrets interacting with your backend. In that case, you can create your own custom permission class

from slack_request_validator.abstract_permission import AbstractIsSlackAppRequest

class MySlackApp1Permission(AbstractIsSlackAppRequest):
    SLACK_APP_VERSION = 'v0'
    SLACK_APP_SIGNING_SECRET = {MySlackApp1_SIGNING_SECRET}


class MySlackApp2Permission(AbstractIsSlackAppRequest):
    SLACK_APP_VERSION = 'v0'
    SLACK_APP_SIGNING_SECRET = {MySlackApp2_SIGNING_SECRET}

These permissions can be then used inside any Django Rest Framework's View

class MySlackApp1View(APIView):
    permission_classes = (MySlackApp1Permission,)


class MySlackApp2View(APIView):
    permission_classes = (MySlackApp2Permission,)

Standalone-Method

There might be cases when you don't want to use permission classes. You can directly use the method that verifies slack request

This method returns either True or False

True # If slack request is correct
False # If slack request is incorrect
from slack_request_validator.utils import verify_slack_request

slack_version = 'v0'
slack_app_signing_secret = {YOUR_SLACK_APP_SIGNING_SECRET}
verify_slack_request(request=request, slack_app_version=slack_version, slack_app_signing_secret=slack_app_signing_secret)

Metadata

Release files for slack-request-permission 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slack-request-permission 1.0.6
File Size Uploaded Provenance Actions
slack-request-permission-1.0.6.tar.gz 4.3 kB Without provenance Details for slack-request-permission-1.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for slack-request-permission 1.0.6
File Interpreter ABI Platform Actions
slack_request_permission-1.0.6-py3-none-any.whl Python 3 none any Details for slack_request_permission-1.0.6-py3-none-any.whl

Total release size: 9.5 kB

Release files / slack-request-permission-1.0.6.tar.gz

Download URL slack-request-permission-1.0.6.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9fba3d3e9fa33b126b3097dd9544e40e3071092fa7e3877c73f669f543bcde88
BLAKE2b-256 checksum
How to use checksums
5b3b841d12ad5c6d0466095b0a242670233019d500d414c8017d4ce00ad7947b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Release files / slack_request_permission-1.0.6-py3-none-any.whl

Download URL slack_request_permission-1.0.6-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3fe951993e028d9dd56bca6bdf985d20701e80f812ddcef60966ba0ad3bf3620
BLAKE2b-256 checksum
How to use checksums
370f0f38875993ec89480b21536eb307b2aa16741e551b70cfe8901951e90c76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

Security for slack-request-permission 1.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page