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

not all events have X-Hub-Signature in header #6

Open
boegel opened this issue Oct 7, 2022 · 1 comment
Open

not all events have X-Hub-Signature in header #6

boegel opened this issue Oct 7, 2022 · 1 comment

Comments

@boegel
Copy link
Owner

boegel commented Oct 7, 2022

Some events don't have X-Hub-Signature in the header, which leads to a crash when trying to process that event:

Traceback (most recent call last):
  File "/mnt/shared/home/boegel/.local/lib/python3.6/site-packages/pyghee/lib.py", line 168, in process_event
    event_info = get_event_info(request)
  File "/mnt/shared/home/boegel/.local/lib/python3.6/site-packages/pyghee/lib.py", line 33, in get_event_info
    'signature-sha1': request.headers['X-Hub-Signature'],
  File "/mnt/shared/home/boegel/.local/lib/python3.6/site-packages/werkzeug/datastructures.py", line 1397, in __getitem__
    return _unicodify_header_value(self.environ[f"HTTP_{key}"])
KeyError: 'HTTP_X_HUB_SIGNATURE'

The code in get_event_info should be relaxed to take into account that X-Hub-Signature may not be available, and then the verification of the event should be skipped as well.

Example header of an event that doesn't have X-Hub-Signature:

Host: smee.io
Accept-Encoding: gzip, deflate
Content-Type: application/json
Accept: */*
User-Agent: GitHub-Hookshot/abbd694
Max-Forwards: 10
X-Github-Delivery: 2cf57940-467b-11ed-9c28-567cfbfec556
X-Github-Event: pull_request_review
X-Github-Hook-Id: 332675046
X-Github-Hook-Installation-Target-Id: 157959
X-Github-Hook-Installation-Target-Type: integration
X-Arr-Log-Id: fca3918d-3d34-46d1-ac16-e09fb5b8d787
Client-Ip: 140.82.115.102:31601
X-Client-Ip: 140.82.115.102
Disguised-Host: smee.io
X-Site-Deployment-Id: smee-io-production
Was-Default-Hostname: smee-io-production.azurewebsites.net
X-Forwarded-Proto: https
X-Appservice-Proto: https
X-Arr-Ssl: 2048|256|CN=GeoTrust Global TLS RSA4096 SHA256 2022 CA1, O="DigiCert, Inc.", C=US|CN=smee.io
X-Forwarded-Tlsversion: 1.2
X-Forwarded-For: 140.82.115.102:31601
X-Original-Url: /7PIXBDoqczjEVXaf
X-Waws-Unencoded-Url: /7PIXBDoqczjEVXaf
X-Client-Port: 31601
Content-Length: 27462
Timestamp: 1665173037426
Connection: close

Payload:

{'action': 'edited',
 'changes': {'body': {'from': "I've discussed this extensively with @trz42, "
                              'and tested this thoroughly.\r\n'
                              '\r\n'
                              "There's many things that can be improved, like "
                              'error handling, code organization, etc., but '
                              'since this i) works (under normal '
                              'circumstances), ii) is an *excellent* basis to '
                              'continue working on, I feel this is ready to go '
                              'in.\r\n'
                              '\r\n'
                              '@trz42: Thanks *a lot* for all the effort on '
                              'this!'}},
 'installation': {'id': 21231682,
                  'node_id': 'MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMjEyMzE2ODI='},
 'organization': {'avatar_url': 'https://avatars.githubusercontent.com/u/64691137?v=4',
                  'description': '',
                  'events_url': 'https://api.github.com/orgs/EESSI/events',
                  'hooks_url': 'https://api.github.com/orgs/EESSI/hooks',
                  'id': 64691137,
                  'issues_url': 'https://api.github.com/orgs/EESSI/issues',
                  'login': 'EESSI',
                  'members_url': 'https://api.github.com/orgs/EESSI/members{/member}',
                  'node_id': 'MDEyOk9yZ2FuaXphdGlvbjY0NjkxMTM3',
                  'public_members_url': 'https://api.github.com/orgs/EESSI/public_members{/member}',
                  'repos_url': 'https://api.github.com/orgs/EESSI/repos',
                  'url': 'https://api.github.com/orgs/EESSI'},
 'pull_request': {'_links': {'comments': {'href': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/issues/24/comments'},
                             'commits': {'href': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/pulls/24/commits'},
                             'html': {'href': 'https://github.com/EESSI/eessi-bot-software-layer/pull/24'},
                             'issue': {'href': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/issues/24'},
                             'review_comment': {'href': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/pulls/comments{/number}'},
                             'review_comments': {'href': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/pulls/24/comments'},
                             'self': {'href': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/pulls/24'},
                             'statuses': {'href': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/statuses/007c6d53431727a796f06c342bb362fd7436043c'}},
                  'active_lock_reason': None,
                  'assignee': None,
                  'assignees': [],
                  'author_association': 'CONTRIBUTOR',
                  'auto_merge': None,
                  'base': {'label': 'EESSI:main',
                           'ref': 'main',
                           'repo': {'allow_auto_merge': False,
                                    'allow_forking': True,
                                    'allow_merge_commit': True,
                                    'allow_rebase_merge': True,
                                    'allow_squash_merge': True,
                                    'allow_update_branch': False,
                                    'archive_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/{archive_format}{/ref}',
                                    'archived': False,
                                    'assignees_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/assignees{/user}',
                                    'blobs_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/git/blobs{/sha}',
                                    'branches_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/branches{/branch}',
                                    'clone_url': 'https://github.com/EESSI/eessi-bot-software-layer.git',
                                    'collaborators_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/collaborators{/collaborator}',
                                    'comments_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/comments{/number}',
                                    'commits_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/commits{/sha}',
                                    'compare_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/compare/{base}...{head}',
                                    'contents_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/contents/{+path}',
                                    'contributors_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/contributors',
                                    'created_at': '2021-12-10T21:42:37Z',
                                    'default_branch': 'main',
                                    'delete_branch_on_merge': False,
                                    'deployments_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/deployments',
                                    'description': 'Bot to help with requests '
                                                   'to add software '
                                                   'installations to the EESSI '
                                                   'software layer',
                                    'disabled': False,
                                    'downloads_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/downloads',
                                    'events_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/events',
                                    'fork': False,
                                    'forks': 2,
                                    'forks_count': 2,
                                    'forks_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/forks',
                                    'full_name': 'EESSI/eessi-bot-software-layer',
                                    'git_commits_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/git/commits{/sha}',
                                    'git_refs_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/git/refs{/sha}',
                                    'git_tags_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/git/tags{/sha}',
                                    'git_url': 'git://github.com/EESSI/eessi-bot-software-layer.git',
                                    'has_downloads': True,
                                    'has_issues': True,
                                    'has_pages': False,
                                    'has_projects': True,
                                    'has_wiki': True,
                                    'homepage': None,
                                    'hooks_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/hooks',
                                    'html_url': 'https://github.com/EESSI/eessi-bot-software-layer',
                                    'id': 437121425,
                                    'is_template': False,
                                    'issue_comment_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/issues/comments{/number}',
                                    'issue_events_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/issues/events{/number}',
                                    'issues_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/issues{/number}',
                                    'keys_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/keys{/key_id}',
                                    'labels_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/labels{/name}',
                                    'language': 'Python',
                                    'languages_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/languages',
                                    'license': None,
                                    'merge_commit_message': 'PR_TITLE',
                                    'merge_commit_title': 'MERGE_MESSAGE',
                                    'merges_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/merges',
                                    'milestones_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/milestones{/number}',
                                    'mirror_url': None,
                                    'name': 'eessi-bot-software-layer',
                                    'node_id': 'R_kgDOGg3xkQ',
                                    'notifications_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/notifications{?since,all,participating}',
                                    'open_issues': 16,
                                    'open_issues_count': 16,
                                    'owner': {'avatar_url': 'https://avatars.githubusercontent.com/u/64691137?v=4',
                                              'events_url': 'https://api.github.com/users/EESSI/events{/privacy}',
                                              'followers_url': 'https://api.github.com/users/EESSI/followers',
                                              'following_url': 'https://api.github.com/users/EESSI/following{/other_user}',
                                              'gists_url': 'https://api.github.com/users/EESSI/gists{/gist_id}',
                                              'gravatar_id': '',
                                              'html_url': 'https://github.com/EESSI',
                                              'id': 64691137,
                                              'login': 'EESSI',
                                              'node_id': 'MDEyOk9yZ2FuaXphdGlvbjY0NjkxMTM3',
                                              'organizations_url': 'https://api.github.com/users/EESSI/orgs',
                                              'received_events_url': 'https://api.github.com/users/EESSI/received_events',
                                              'repos_url': 'https://api.github.com/users/EESSI/repos',
                                              'site_admin': False,
                                              'starred_url': 'https://api.github.com/users/EESSI/starred{/owner}{/repo}',
                                              'subscriptions_url': 'https://api.github.com/users/EESSI/subscriptions',
                                              'type': 'Organization',
                                              'url': 'https://api.github.com/users/EESSI'},
                                    'private': False,
                                    'pulls_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/pulls{/number}',
                                    'pushed_at': '2022-10-07T20:03:35Z',
                                    'releases_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/releases{/id}',
                                    'size': 68,
                                    'squash_merge_commit_message': 'COMMIT_MESSAGES',
                                    'squash_merge_commit_title': 'COMMIT_OR_PR_TITLE',
                                    'ssh_url': '[email protected]:EESSI/eessi-bot-software-layer.git',
                                    'stargazers_count': 0,
                                    'stargazers_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/stargazers',
                                    'statuses_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/statuses/{sha}',
                                    'subscribers_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/subscribers',
                                    'subscription_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/subscription',
                                    'svn_url': 'https://github.com/EESSI/eessi-bot-software-layer',
                                    'tags_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/tags',
                                    'teams_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/teams',
                                    'topics': [],
                                    'trees_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/git/trees{/sha}',
                                    'updated_at': '2021-12-24T15:32:32Z',
                                    'url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer',
                                    'use_squash_pr_title_as_default': False,
                                    'visibility': 'public',
                                    'watchers': 0,
                                    'watchers_count': 0,
                                    'web_commit_signoff_required': False},
                           'sha': '61023b6965f1dccd059343b7bfc657335ec430de',
                           'user': {'avatar_url': 'https://avatars.githubusercontent.com/u/64691137?v=4',
                                    'events_url': 'https://api.github.com/users/EESSI/events{/privacy}',
                                    'followers_url': 'https://api.github.com/users/EESSI/followers',
                                    'following_url': 'https://api.github.com/users/EESSI/following{/other_user}',
                                    'gists_url': 'https://api.github.com/users/EESSI/gists{/gist_id}',
                                    'gravatar_id': '',
                                    'html_url': 'https://github.com/EESSI',
                                    'id': 64691137,
                                    'login': 'EESSI',
                                    'node_id': 'MDEyOk9yZ2FuaXphdGlvbjY0NjkxMTM3',
                                    'organizations_url': 'https://api.github.com/users/EESSI/orgs',
                                    'received_events_url': 'https://api.github.com/users/EESSI/received_events',
                                    'repos_url': 'https://api.github.com/users/EESSI/repos',
                                    'site_admin': False,
                                    'starred_url': 'https://api.github.com/users/EESSI/starred{/owner}{/repo}',
                                    'subscriptions_url': 'https://api.github.com/users/EESSI/subscriptions',
                                    'type': 'Organization',
                                    'url': 'https://api.github.com/users/EESSI'}},
                  'body': 'This is a larger pull request. Among a few smaller '
                          'changes (e.g., adding ability to specify port on '
                          'which the bot listens, makes PR #22 obsolete, '
                          'sorry) it adds functionality to monitor the status '
                          'of jobs, then checks the result of finished jobs '
                          'and updates the PR accordingly.\r\n'
                          '\r\n'
                          'The monitoring implements option 1 in #12. This is '
                          'a bit inelegant -- it only uses `squeue` because '
                          "`sacct` wasn't available on the CitC cluster on AWS "
                          'and uses `pandas` to read in the output from '
                          '`squeue` which might be overkill. An improvement '
                          'would be to enable the bot monitoring jobs even '
                          'after it has crashed (see #23). A future version of '
                          'the bot could have different implementations for '
                          'monitoring the jobs and then select the best one '
                          'based on what is available on a cluster (`sacct` or '
                          '`squeue`). Also, one might have a look into '
                          '[PySlurm/pyslurm](https://github.com/PySlurm/pyslurm) '
                          'to verify if this monitoring can be done more '
                          'elegantly.\r\n'
                          '\r\n'
                          'The result of a finished job is checked (existence '
                          'of slurm output file, existence of tar.gz file, '
                          'existence of certain pattern in slurm output file). '
                          'This is relatively clean.\r\n'
                          '\r\n'
                          'Then the bot adds a comment to the PR with '
                          'information about the result of the build job. This '
                          'implements #13.\r\n'
                          '\r\n'
                          'This PR also addresses #17.',
                  'closed_at': '2022-10-07T20:03:35Z',
                  'comments_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/issues/24/comments',
                  'commits_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/pulls/24/commits',
                  'created_at': '2022-06-16T20:51:02Z',
                  'diff_url': 'https://github.com/EESSI/eessi-bot-software-layer/pull/24.diff',
                  'draft': False,
                  'head': {'label': 'trz42:check-build-job-status',
                           'ref': 'check-build-job-status',
                           'repo': {'allow_auto_merge': False,
                                    'allow_forking': True,
                                    'allow_merge_commit': True,
                                    'allow_rebase_merge': True,
                                    'allow_squash_merge': True,
                                    'allow_update_branch': False,
                                    'archive_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/{archive_format}{/ref}',
                                    'archived': False,
                                    'assignees_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/assignees{/user}',
                                    'blobs_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/git/blobs{/sha}',
                                    'branches_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/branches{/branch}',
                                    'clone_url': 'https://github.com/trz42/eessi-bot-software-layer.git',
                                    'collaborators_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/collaborators{/collaborator}',
                                    'comments_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/comments{/number}',
                                    'commits_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/commits{/sha}',
                                    'compare_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/compare/{base}...{head}',
                                    'contents_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/contents/{+path}',
                                    'contributors_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/contributors',
                                    'created_at': '2022-05-13T07:10:32Z',
                                    'default_branch': 'main',
                                    'delete_branch_on_merge': False,
                                    'deployments_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/deployments',
                                    'description': 'Bot to help with requests '
                                                   'to add software '
                                                   'installations to the EESSI '
                                                   'software layer',
                                    'disabled': False,
                                    'downloads_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/downloads',
                                    'events_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/events',
                                    'fork': True,
                                    'forks': 0,
                                    'forks_count': 0,
                                    'forks_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/forks',
                                    'full_name': 'trz42/eessi-bot-software-layer',
                                    'git_commits_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/git/commits{/sha}',
                                    'git_refs_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/git/refs{/sha}',
                                    'git_tags_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/git/tags{/sha}',
                                    'git_url': 'git://github.com/trz42/eessi-bot-software-layer.git',
                                    'has_downloads': True,
                                    'has_issues': False,
                                    'has_pages': False,
                                    'has_projects': True,
                                    'has_wiki': True,
                                    'homepage': None,
                                    'hooks_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/hooks',
                                    'html_url': 'https://github.com/trz42/eessi-bot-software-layer',
                                    'id': 491794437,
                                    'is_template': False,
                                    'issue_comment_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/issues/comments{/number}',
                                    'issue_events_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/issues/events{/number}',
                                    'issues_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/issues{/number}',
                                    'keys_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/keys{/key_id}',
                                    'labels_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/labels{/name}',
                                    'language': 'Python',
                                    'languages_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/languages',
                                    'license': None,
                                    'merge_commit_message': 'PR_TITLE',
                                    'merge_commit_title': 'MERGE_MESSAGE',
                                    'merges_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/merges',
                                    'milestones_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/milestones{/number}',
                                    'mirror_url': None,
                                    'name': 'eessi-bot-software-layer',
                                    'node_id': 'R_kgDOHVAwBQ',
                                    'notifications_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/notifications{?since,all,participating}',
                                    'open_issues': 0,
                                    'open_issues_count': 0,
                                    'owner': {'avatar_url': 'https://avatars.githubusercontent.com/u/12829274?v=4',
                                              'events_url': 'https://api.github.com/users/trz42/events{/privacy}',
                                              'followers_url': 'https://api.github.com/users/trz42/followers',
                                              'following_url': 'https://api.github.com/users/trz42/following{/other_user}',
                                              'gists_url': 'https://api.github.com/users/trz42/gists{/gist_id}',
                                              'gravatar_id': '',
                                              'html_url': 'https://github.com/trz42',
                                              'id': 12829274,
                                              'login': 'trz42',
                                              'node_id': 'MDQ6VXNlcjEyODI5Mjc0',
                                              'organizations_url': 'https://api.github.com/users/trz42/orgs',
                                              'received_events_url': 'https://api.github.com/users/trz42/received_events',
                                              'repos_url': 'https://api.github.com/users/trz42/repos',
                                              'site_admin': False,
                                              'starred_url': 'https://api.github.com/users/trz42/starred{/owner}{/repo}',
                                              'subscriptions_url': 'https://api.github.com/users/trz42/subscriptions',
                                              'type': 'User',
                                              'url': 'https://api.github.com/users/trz42'},
                                    'private': False,
                                    'pulls_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/pulls{/number}',
                                    'pushed_at': '2022-10-07T19:42:02Z',
                                    'releases_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/releases{/id}',
                                    'size': 154,
                                    'squash_merge_commit_message': 'COMMIT_MESSAGES',
                                    'squash_merge_commit_title': 'COMMIT_OR_PR_TITLE',
                                    'ssh_url': '[email protected]:trz42/eessi-bot-software-layer.git',
                                    'stargazers_count': 0,
                                    'stargazers_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/stargazers',
                                    'statuses_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/statuses/{sha}',
                                    'subscribers_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/subscribers',
                                    'subscription_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/subscription',
                                    'svn_url': 'https://github.com/trz42/eessi-bot-software-layer',
                                    'tags_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/tags',
                                    'teams_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/teams',
                                    'topics': [],
                                    'trees_url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer/git/trees{/sha}',
                                    'updated_at': '2022-09-08T11:29:58Z',
                                    'url': 'https://api.github.com/repos/trz42/eessi-bot-software-layer',
                                    'use_squash_pr_title_as_default': False,
                                    'visibility': 'public',
                                    'watchers': 0,
                                    'watchers_count': 0,
                                    'web_commit_signoff_required': False},
                           'sha': '007c6d53431727a796f06c342bb362fd7436043c',
                           'user': {'avatar_url': 'https://avatars.githubusercontent.com/u/12829274?v=4',
                                    'events_url': 'https://api.github.com/users/trz42/events{/privacy}',
                                    'followers_url': 'https://api.github.com/users/trz42/followers',
                                    'following_url': 'https://api.github.com/users/trz42/following{/other_user}',
                                    'gists_url': 'https://api.github.com/users/trz42/gists{/gist_id}',
                                    'gravatar_id': '',
                                    'html_url': 'https://github.com/trz42',
                                    'id': 12829274,
                                    'login': 'trz42',
                                    'node_id': 'MDQ6VXNlcjEyODI5Mjc0',
                                    'organizations_url': 'https://api.github.com/users/trz42/orgs',
                                    'received_events_url': 'https://api.github.com/users/trz42/received_events',
                                    'repos_url': 'https://api.github.com/users/trz42/repos',
                                    'site_admin': False,
                                    'starred_url': 'https://api.github.com/users/trz42/starred{/owner}{/repo}',
                                    'subscriptions_url': 'https://api.github.com/users/trz42/subscriptions',
                                    'type': 'User',
                                    'url': 'https://api.github.com/users/trz42'}},
                  'html_url': 'https://github.com/EESSI/eessi-bot-software-layer/pull/24',
                  'id': 969773208,
                  'issue_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/issues/24',
                  'labels': [],
                  'locked': False,
                  'merge_commit_sha': 'f3bc06c59b2972fb6c5a0a59416ff5e4e55e343e',
                  'merged_at': '2022-10-07T20:03:35Z',
                  'milestone': None,
                  'node_id': 'PR_kwDOGg3xkc45zZCY',
                  'number': 24,
                  'patch_url': 'https://github.com/EESSI/eessi-bot-software-layer/pull/24.patch',
                  'requested_reviewers': [],
                  'requested_teams': [],
                  'review_comment_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/pulls/comments{/number}',
                  'review_comments_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/pulls/24/comments',
                  'state': 'closed',
                  'statuses_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/statuses/007c6d53431727a796f06c342bb362fd7436043c',
                  'title': 'Check build job status and comment on PR',
                  'updated_at': '2022-10-07T20:03:56Z',
                  'url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/pulls/24',
                  'user': {'avatar_url': 'https://avatars.githubusercontent.com/u/12829274?v=4',
                           'events_url': 'https://api.github.com/users/trz42/events{/privacy}',
                           'followers_url': 'https://api.github.com/users/trz42/followers',
                           'following_url': 'https://api.github.com/users/trz42/following{/other_user}',
                           'gists_url': 'https://api.github.com/users/trz42/gists{/gist_id}',
                           'gravatar_id': '',
                           'html_url': 'https://github.com/trz42',
                           'id': 12829274,
                           'login': 'trz42',
                           'node_id': 'MDQ6VXNlcjEyODI5Mjc0',
                           'organizations_url': 'https://api.github.com/users/trz42/orgs',
                           'received_events_url': 'https://api.github.com/users/trz42/received_events',
                           'repos_url': 'https://api.github.com/users/trz42/repos',
                           'site_admin': False,
                           'starred_url': 'https://api.github.com/users/trz42/starred{/owner}{/repo}',
                           'subscriptions_url': 'https://api.github.com/users/trz42/subscriptions',
                           'type': 'User',
                           'url': 'https://api.github.com/users/trz42'}},
 'repository': {'allow_forking': True,
                'archive_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/{archive_format}{/ref}',
                'archived': False,
                'assignees_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/assignees{/user}',
                'blobs_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/git/blobs{/sha}',
                'branches_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/branches{/branch}',
                'clone_url': 'https://github.com/EESSI/eessi-bot-software-layer.git',
                'collaborators_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/collaborators{/collaborator}',
                'comments_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/comments{/number}',
                'commits_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/commits{/sha}',
                'compare_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/compare/{base}...{head}',
                'contents_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/contents/{+path}',
                'contributors_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/contributors',
                'created_at': '2021-12-10T21:42:37Z',
                'default_branch': 'main',
                'deployments_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/deployments',
                'description': 'Bot to help with requests to add software '
                               'installations to the EESSI software layer',
                'disabled': False,
                'downloads_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/downloads',
                'events_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/events',
                'fork': False,
                'forks': 2,
                'forks_count': 2,
                'forks_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/forks',
                'full_name': 'EESSI/eessi-bot-software-layer',
                'git_commits_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/git/commits{/sha}',
                'git_refs_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/git/refs{/sha}',
                'git_tags_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/git/tags{/sha}',
                'git_url': 'git://github.com/EESSI/eessi-bot-software-layer.git',
                'has_downloads': True,
                'has_issues': True,
                'has_pages': False,
                'has_projects': True,
                'has_wiki': True,
                'homepage': None,
                'hooks_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/hooks',
                'html_url': 'https://github.com/EESSI/eessi-bot-software-layer',
                'id': 437121425,
                'is_template': False,
                'issue_comment_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/issues/comments{/number}',
                'issue_events_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/issues/events{/number}',
                'issues_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/issues{/number}',
                'keys_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/keys{/key_id}',
                'labels_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/labels{/name}',
                'language': 'Python',
                'languages_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/languages',
                'license': None,
                'merges_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/merges',
                'milestones_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/milestones{/number}',
                'mirror_url': None,
                'name': 'eessi-bot-software-layer',
                'node_id': 'R_kgDOGg3xkQ',
                'notifications_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/notifications{?since,all,participating}',
                'open_issues': 16,
                'open_issues_count': 16,
                'owner': {'avatar_url': 'https://avatars.githubusercontent.com/u/64691137?v=4',
                          'events_url': 'https://api.github.com/users/EESSI/events{/privacy}',
                          'followers_url': 'https://api.github.com/users/EESSI/followers',
                          'following_url': 'https://api.github.com/users/EESSI/following{/other_user}',
                          'gists_url': 'https://api.github.com/users/EESSI/gists{/gist_id}',
                          'gravatar_id': '',
                          'html_url': 'https://github.com/EESSI',
                          'id': 64691137,
                          'login': 'EESSI',
                          'node_id': 'MDEyOk9yZ2FuaXphdGlvbjY0NjkxMTM3',
                          'organizations_url': 'https://api.github.com/users/EESSI/orgs',
                          'received_events_url': 'https://api.github.com/users/EESSI/received_events',
                          'repos_url': 'https://api.github.com/users/EESSI/repos',
                          'site_admin': False,
                          'starred_url': 'https://api.github.com/users/EESSI/starred{/owner}{/repo}',
                          'subscriptions_url': 'https://api.github.com/users/EESSI/subscriptions',
                          'type': 'Organization',
                          'url': 'https://api.github.com/users/EESSI'},
                'private': False,
                'pulls_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/pulls{/number}',
                'pushed_at': '2022-10-07T20:03:35Z',
                'releases_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/releases{/id}',
                'size': 68,
                'ssh_url': '[email protected]:EESSI/eessi-bot-software-layer.git',
                'stargazers_count': 0,
                'stargazers_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/stargazers',
                'statuses_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/statuses/{sha}',
                'subscribers_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/subscribers',
                'subscription_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/subscription',
                'svn_url': 'https://github.com/EESSI/eessi-bot-software-layer',
                'tags_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/tags',
                'teams_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/teams',
                'topics': [],
                'trees_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/git/trees{/sha}',
                'updated_at': '2021-12-24T15:32:32Z',
                'url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer',
                'visibility': 'public',
                'watchers': 0,
                'watchers_count': 0,
                'web_commit_signoff_required': False},
 'review': {'_links': {'html': {'href': 'https://github.com/EESSI/eessi-bot-software-layer/pull/24#pullrequestreview-1134422745'},
                       'pull_request': {'href': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/pulls/24'}},
            'author_association': 'CONTRIBUTOR',
            'body': "I've discussed this extensively with @trz42, and tested "
                    'this thoroughly (see for example '
                    'https://github.com/boegel/software-layer/pull/7 and '
                    'https://github.com/boegel/software-layer/pull/8).\r\n'
                    '\r\n'
                    "There's many things that can be improved, like error "
                    'handling, code organization, etc., but since this i) '
                    'works (under normal circumstances), ii) is an *excellent* '
                    'basis to continue working on, I feel this is ready to go '
                    'in.\r\n'
                    '\r\n'
                    '@trz42: Thanks *a lot* for all the effort on this!',
            'commit_id': '007c6d53431727a796f06c342bb362fd7436043c',
            'html_url': 'https://github.com/EESSI/eessi-bot-software-layer/pull/24#pullrequestreview-1134422745',
            'id': 1134422745,
            'node_id': 'PRR_kwDOGg3xkc5DnerZ',
            'pull_request_url': 'https://api.github.com/repos/EESSI/eessi-bot-software-layer/pulls/24',
            'state': 'approved',
            'submitted_at': '2022-10-07T20:02:51Z',
            'user': {'avatar_url': 'https://avatars.githubusercontent.com/u/620876?v=4',
                     'events_url': 'https://api.github.com/users/boegel/events{/privacy}',
                     'followers_url': 'https://api.github.com/users/boegel/followers',
                     'following_url': 'https://api.github.com/users/boegel/following{/other_user}',
                     'gists_url': 'https://api.github.com/users/boegel/gists{/gist_id}',
                     'gravatar_id': '',
                     'html_url': 'https://github.com/boegel',
                     'id': 620876,
                     'login': 'boegel',
                     'node_id': 'MDQ6VXNlcjYyMDg3Ng==',
                     'organizations_url': 'https://api.github.com/users/boegel/orgs',
                     'received_events_url': 'https://api.github.com/users/boegel/received_events',
                     'repos_url': 'https://api.github.com/users/boegel/repos',
                     'site_admin': False,
                     'starred_url': 'https://api.github.com/users/boegel/starred{/owner}{/repo}',
                     'subscriptions_url': 'https://api.github.com/users/boegel/subscriptions',
                     'type': 'User',
                     'url': 'https://api.github.com/users/boegel'}},
 'sender': {'avatar_url': 'https://avatars.githubusercontent.com/u/620876?v=4',
            'events_url': 'https://api.github.com/users/boegel/events{/privacy}',
            'followers_url': 'https://api.github.com/users/boegel/followers',
            'following_url': 'https://api.github.com/users/boegel/following{/other_user}',
            'gists_url': 'https://api.github.com/users/boegel/gists{/gist_id}',
            'gravatar_id': '',
            'html_url': 'https://github.com/boegel',
            'id': 620876,
            'login': 'boegel',
            'node_id': 'MDQ6VXNlcjYyMDg3Ng==',
            'organizations_url': 'https://api.github.com/users/boegel/orgs',
            'received_events_url': 'https://api.github.com/users/boegel/received_events',
            'repos_url': 'https://api.github.com/users/boegel/repos',
            'site_admin': False,
            'starred_url': 'https://api.github.com/users/boegel/starred{/owner}{/repo}',
            'subscriptions_url': 'https://api.github.com/users/boegel/subscriptions',
            'type': 'User',
            'url': 'https://api.github.com/users/boegel'}}
@boegel
Copy link
Owner Author

boegel commented Oct 7, 2022

It seems like this event was delivered for a repo that the app isn't supposed to get event deliveries for...
Not sure how that's possible, but the X-Hub-Signature field isn't there because the webhook doing the delivery is not configured with a webhook secret.

PyGHee should be tweaked to discard these events, since their payload can't be validated.

And maybe you should be able to configure PyGHee with a list of repositories that you want to accept event deliveries from as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant