read-the-docs 使用 github webhook 结果为 400:"Payload not valid, invalid or missing signature"
read-the-docs with github webhook results in 400: "Payload not valid, invalid or missing signature"
我已按照 https://docs.readthedocs.io/en/stable/webhooks.html 上的说明进行操作,并向 github 添加了一个 webhook 以触发我构建的 readthedocs,但是 readthedocs 拒绝有效负载:
Response
Status:
400
Content-Type:
text/html; charset=utf-8
Allow:
POST, OPTIONS
详情:
{
"detail": "Payload not valid, invalid or missing signature"
}
这是请求的 header:
Host:
...
Connection:
close
Accept:
*/*
Max-Forwards:
10
User-Agent:
GitHub-Hookshot/903858c
X-Github-Event:
push
X-Github-Delivery:
2be06d44-552f-11e9-91f6-d1c2bea59bd2
X-Original-Host:
readthedocs.org
X-Original-Url:
/api/v2/webhook/.../.../
X-Arr-Ssl:
2048|256|C=GB, S=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Domain Validation Secure Server CA|OU=Domain Control Validated, OU=EssentialSSL Wildcard, CN=*.readthedocs.org
X-Arr-Log-Id:
fef5ee2e-6edd-4386-ad1f-79400cee2d46
Content-Type:
application/json
有效载荷:
{
"after": "..."
"base_ref": null,
"before": "..."
"commits": [
{
"added": [],
"author": {
"email": "..."
"name": "..."
"username": "..."
},
"committer": {
"email": "..."
"name": "..."
"username": "..."
},
"distinct": true,
"id": "..."
"message": "..."
"modified": [
...
],
"removed": [],
"timestamp": "..."
"tree_id": "..."
"url": "..."
}
],
"compare": "..."
"created": false,
"deleted": false,
"forced": false,
"head_commit": {
"added": [],
"author": {
"email": "..."
"name": "..."
"username": "..."
},
"committer": {
"email": "..."
"name": "..."
"username": "..."
},
"distinct": true,
"id": "..."
"message": "..."
"modified": [
...
],
"removed": [],
"timestamp": "..."
"tree_id": "..."
"url": "..."
},
"organization": {
"avatar_url": "..."
"description": null,
"events_url": "..."
"hooks_url": "..."
"id": ...,
"issues_url": "..."
"login": "..."
"members_url": "..."
"node_id": "..."
"public_members_url": "..."
"repos_url": "..."
"url": "..."
},
"pusher": {
"email": "..."
"name": "..."
},
"ref": "..."
"repository": {
"archive_url": "..."
"archived": false,
"assignees_url": "..."
"blobs_url": "..."
"branches_url": "..."
"clone_url": "..."
"collaborators_url": "..."
"comments_url": "..."
"commits_url": "..."
"compare_url": "..."
"contents_url": "..."
"contributors_url": "..."
"created_at": ...,
"default_branch": "..."
"deployments_url": "..."
"description": "..."
"downloads_url": "..."
"events_url": "..."
"fork": false,
"forks": 0,
"forks_count": 0,
"forks_url": "..."
"full_name": "..."
"git_commits_url": "..."
"git_refs_url": "..."
"git_tags_url": "..."
"git_url": "..."
"has_downloads": true,
"has_issues": true,
"has_pages": false,
"has_projects": true,
"has_wiki": true,
"homepage": "..."
"hooks_url": "..."
"html_url": "..."
"id": ...,
"issue_comment_url": "..."
"issue_events_url": "..."
"issues_url": "..."
"keys_url": "..."
"labels_url": "..."
"language": "..."
"languages_url": "..."
"license": {
"key": "..."
"name": "..."
"node_id": "..."
"spdx_id": "..."
"url": "..."
},
"master_branch": "..."
"merges_url": "..."
"milestones_url": "..."
"mirror_url": null,
"name": "..."
"node_id": "..."
"notifications_url": "..."
"open_issues": 8,
"open_issues_count": 8,
"organization": "..."
"owner": {
"avatar_url": "..."
"email": null,
"events_url": "..."
"followers_url": "..."
"following_url": "..."
"gists_url": "..."
"gravatar_id": "..."
"html_url": "..."
"id": ...,
"login": "..."
"name": "..."
"node_id": "..."
"organizations_url": "..."
"received_events_url": "..."
"repos_url": "..."
"site_admin": false,
"starred_url": "..."
"subscriptions_url": "..."
"type": "..."
"url": "..."
},
"private": false,
"pulls_url": "..."
"pushed_at": ...,
"releases_url": "..."
"size": ...,
"ssh_url": "..."
"stargazers": 4,
"stargazers_count": 4,
"stargazers_url": "..."
"statuses_url": "..."
"subscribers_url": "..."
"subscription_url": "..."
"svn_url": "..."
"tags_url": "..."
"teams_url": "..."
"trees_url": "..."
"updated_at": "..."
"url": "..."
"watchers": 4,
"watchers_count": 4
},
"sender": {
"avatar_url": "..."
"events_url": "..."
"followers_url": "..."
"following_url": "..."
"gists_url": "..."
"gravatar_id": "..."
"html_url": "..."
"id": ...,
"login": "..."
"node_id": "..."
"organizations_url": "..."
"received_events_url": "..."
"repos_url": "..."
"site_admin": false,
"starred_url": "..."
"subscriptions_url": "..."
"type": "..."
"url": "..."
}
}
我之前也使用过 read-the-docs(有效)并比较了相应的 webhook,但我找不到任何差异。
从 readthedocs.org 和 github.com 中删除钩子然后将其添加回去(注意 url 的 id 部分已更改)解决了问题。
我已按照 https://docs.readthedocs.io/en/stable/webhooks.html 上的说明进行操作,并向 github 添加了一个 webhook 以触发我构建的 readthedocs,但是 readthedocs 拒绝有效负载:
Response
Status:
400
Content-Type:
text/html; charset=utf-8
Allow:
POST, OPTIONS
详情:
{
"detail": "Payload not valid, invalid or missing signature"
}
这是请求的 header:
Host:
...
Connection:
close
Accept:
*/*
Max-Forwards:
10
User-Agent:
GitHub-Hookshot/903858c
X-Github-Event:
push
X-Github-Delivery:
2be06d44-552f-11e9-91f6-d1c2bea59bd2
X-Original-Host:
readthedocs.org
X-Original-Url:
/api/v2/webhook/.../.../
X-Arr-Ssl:
2048|256|C=GB, S=Greater Manchester, L=Salford, O=COMODO CA Limited, CN=COMODO RSA Domain Validation Secure Server CA|OU=Domain Control Validated, OU=EssentialSSL Wildcard, CN=*.readthedocs.org
X-Arr-Log-Id:
fef5ee2e-6edd-4386-ad1f-79400cee2d46
Content-Type:
application/json
有效载荷:
{
"after": "..."
"base_ref": null,
"before": "..."
"commits": [
{
"added": [],
"author": {
"email": "..."
"name": "..."
"username": "..."
},
"committer": {
"email": "..."
"name": "..."
"username": "..."
},
"distinct": true,
"id": "..."
"message": "..."
"modified": [
...
],
"removed": [],
"timestamp": "..."
"tree_id": "..."
"url": "..."
}
],
"compare": "..."
"created": false,
"deleted": false,
"forced": false,
"head_commit": {
"added": [],
"author": {
"email": "..."
"name": "..."
"username": "..."
},
"committer": {
"email": "..."
"name": "..."
"username": "..."
},
"distinct": true,
"id": "..."
"message": "..."
"modified": [
...
],
"removed": [],
"timestamp": "..."
"tree_id": "..."
"url": "..."
},
"organization": {
"avatar_url": "..."
"description": null,
"events_url": "..."
"hooks_url": "..."
"id": ...,
"issues_url": "..."
"login": "..."
"members_url": "..."
"node_id": "..."
"public_members_url": "..."
"repos_url": "..."
"url": "..."
},
"pusher": {
"email": "..."
"name": "..."
},
"ref": "..."
"repository": {
"archive_url": "..."
"archived": false,
"assignees_url": "..."
"blobs_url": "..."
"branches_url": "..."
"clone_url": "..."
"collaborators_url": "..."
"comments_url": "..."
"commits_url": "..."
"compare_url": "..."
"contents_url": "..."
"contributors_url": "..."
"created_at": ...,
"default_branch": "..."
"deployments_url": "..."
"description": "..."
"downloads_url": "..."
"events_url": "..."
"fork": false,
"forks": 0,
"forks_count": 0,
"forks_url": "..."
"full_name": "..."
"git_commits_url": "..."
"git_refs_url": "..."
"git_tags_url": "..."
"git_url": "..."
"has_downloads": true,
"has_issues": true,
"has_pages": false,
"has_projects": true,
"has_wiki": true,
"homepage": "..."
"hooks_url": "..."
"html_url": "..."
"id": ...,
"issue_comment_url": "..."
"issue_events_url": "..."
"issues_url": "..."
"keys_url": "..."
"labels_url": "..."
"language": "..."
"languages_url": "..."
"license": {
"key": "..."
"name": "..."
"node_id": "..."
"spdx_id": "..."
"url": "..."
},
"master_branch": "..."
"merges_url": "..."
"milestones_url": "..."
"mirror_url": null,
"name": "..."
"node_id": "..."
"notifications_url": "..."
"open_issues": 8,
"open_issues_count": 8,
"organization": "..."
"owner": {
"avatar_url": "..."
"email": null,
"events_url": "..."
"followers_url": "..."
"following_url": "..."
"gists_url": "..."
"gravatar_id": "..."
"html_url": "..."
"id": ...,
"login": "..."
"name": "..."
"node_id": "..."
"organizations_url": "..."
"received_events_url": "..."
"repos_url": "..."
"site_admin": false,
"starred_url": "..."
"subscriptions_url": "..."
"type": "..."
"url": "..."
},
"private": false,
"pulls_url": "..."
"pushed_at": ...,
"releases_url": "..."
"size": ...,
"ssh_url": "..."
"stargazers": 4,
"stargazers_count": 4,
"stargazers_url": "..."
"statuses_url": "..."
"subscribers_url": "..."
"subscription_url": "..."
"svn_url": "..."
"tags_url": "..."
"teams_url": "..."
"trees_url": "..."
"updated_at": "..."
"url": "..."
"watchers": 4,
"watchers_count": 4
},
"sender": {
"avatar_url": "..."
"events_url": "..."
"followers_url": "..."
"following_url": "..."
"gists_url": "..."
"gravatar_id": "..."
"html_url": "..."
"id": ...,
"login": "..."
"node_id": "..."
"organizations_url": "..."
"received_events_url": "..."
"repos_url": "..."
"site_admin": false,
"starred_url": "..."
"subscriptions_url": "..."
"type": "..."
"url": "..."
}
}
我之前也使用过 read-the-docs(有效)并比较了相应的 webhook,但我找不到任何差异。
从 readthedocs.org 和 github.com 中删除钩子然后将其添加回去(注意 url 的 id 部分已更改)解决了问题。