{"id":18341862,"url":"https://github.com/pabluk/flask-github-signature","last_synced_at":"2026-04-29T17:03:08.594Z","repository":{"id":57430349,"uuid":"305151166","full_name":"pabluk/flask-github-signature","owner":"pabluk","description":"A Flask view decorator to verify Github's webhook signatures","archived":false,"fork":false,"pushed_at":"2022-12-14T10:48:05.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-15T13:27:37.371Z","etag":null,"topics":["flask","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pabluk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-18T16:54:29.000Z","updated_at":"2022-12-12T21:46:25.000Z","dependencies_parsed_at":"2023-01-28T22:00:42.259Z","dependency_job_id":null,"html_url":"https://github.com/pabluk/flask-github-signature","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabluk%2Fflask-github-signature","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabluk%2Fflask-github-signature/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabluk%2Fflask-github-signature/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pabluk%2Fflask-github-signature/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pabluk","download_url":"https://codeload.github.com/pabluk/flask-github-signature/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248113363,"owners_count":21049832,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","python"],"created_at":"2024-11-05T20:28:48.033Z","updated_at":"2026-04-29T17:03:03.556Z","avatar_url":"https://github.com/pabluk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flask-github-signature\n\n[![Python package](https://github.com/pabluk/flask-github-signature/actions/workflows/python-package.yml/badge.svg)](https://github.com/pabluk/flask-github-signature/actions/workflows/python-package.yml)\n[![PyPI](https://img.shields.io/pypi/v/flask-github-signature)](https://pypi.org/project/flask-github-signature/)\n\n\nA Flask view decorator to verify [Github's webhook signatures](https://docs.github.com/en/free-pro-team@latest/developers/webhooks-and-events/securing-your-webhooks).\n\n# Installation\n\n## Using pip\n\nTo get the latest version from pypi.org:\n\n```console\npip install flask-github-signature\n```\n\n# Usage\n\n```console\nexport GH_WEBHOOK_SECRET=\"xyz\"\n```\n\n```python\n# app.py\nfrom flask import Flask\nfrom flask_github_signature import verify_signature\n\napp = Flask(__name__)\n\n\n@app.route(\"/webhook\", methods=[\"POST\"])\n@verify_signature\ndef webhook():\n    return \"Payload signature verified.\"\n```\n\nrun the previous Flask app with:\n\n```console\nflask run\n```\n\nand test it with:\n\n```console\ncurl --request POST \\\n  --header \"X-Hub-Signature-256: sha256=eba50596a17c2c8fbdbc5c68223422fe41d5310bea51ffdc461430bce0386c54\" \\\n  --header \"Content-Type: application/json\" \\\n  --data '{}' \\\n  http://localhost:5000/webhook\n```\n\n## Signing a test payload\n\nIf you want to test with another payload you can generate a signature using:\n```python\n\u003e\u003e\u003e import os\n\u003e\u003e\u003e from flask_github_signature import compute_signature\n\u003e\u003e\u003e \n\u003e\u003e\u003e secret = os.environ[\"GH_WEBHOOK_SECRET\"]\n\u003e\u003e\u003e compute_signature(secret, b'{\"message\": \"An example\"}')\n'04886433fda851ca66181cecbd9c283ba677468ba361b0a0a7ba57a867102b46'\n\u003e\u003e\u003e \n```\nwhen using a signature on a header don't forget to append `sha256=` to it.\n\n# Testing\n\nIf you want to test, play or contribute to this repo:\n\n```console\ngit clone git@github.com:pabluk/flask-github-signature.git\ncd flask-github-signature/\npip install -r requirements.txt\npip install -r requirements-dev.txt\npytest -v\n```\n\n```console\nblack --line-length=127 tests/ flask_github_signature/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpabluk%2Fflask-github-signature","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpabluk%2Fflask-github-signature","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpabluk%2Fflask-github-signature/lists"}