How to verify a post-receive hook request actually came from github?

前端 未结 5 1515
不知归路
不知归路 2020-12-08 16:19

Github offers a way to let a URL know when a project has been updated using webhooks.

How do I verify that a post sent to my server\'s post-receive hook act

5条回答
  •  春和景丽
    2020-12-08 17:24

    Take a look at GitHub's docs on the subject: they suggest using HTTPS and basic authentication.

    Specifically, set up your Payload URL in this format:

    https://yourUser:yourPass@yoursite.net/path

    If you have a number of users, you'd give each a different username & password. Assuming they keep that password private, you can then trust that an authenticating request really does come from GitHub and from that account.

    See also: https://github.com/blog/237-basic-auth-post-receives

提交回复
热议问题