Skip to content

HTTP 403 when creating a GitLab webhook on a repo without maintainer or owner access

Sentry Issue: ARKINDEX-BACKEND-3P

GitlabHttpError: 403: 403 Forbidden
(1 additional frame(s) were not displayed)
...
  File "gitlab/mixins.py", line 133, in list
    obj = self.gitlab.http_list(path, **data)
  File "__init__.py", line 572, in http_list
    return list(GitlabList(self, url, query_data, **kwargs))
  File "__init__.py", line 686, in __init__
    self._query(url, query_data, **kwargs)
  File "__init__.py", line 691, in _query
    **kwargs)
  File "__init__.py", line 510, in http_request
    response_body=result.content)

GitlabListError: 403: 403 Forbidden
(9 additional frame(s) were not displayed)
...
  File "contextlib.py", line 74, in inner
    return func(*args, **kwds)
  File "arkindex/dataimport/api.py", line 535, in create
  File "arkindex/dataimport/providers.py", line 209, in create_repo
  File "arkindex/dataimport/providers.py", line 237, in create_hook
  File "gitlab/exceptions.py", line 253, in wrapped_f
    raise error(e.error_message, e.response_code, e.response_body)

GitLab requires maintainer or owner access to manage project webhooks (see this table, row "Configure project hooks"). Should we restrict the available repositories to those with maintainer or owner access, or should we just avoid creating a webhook when we cannot? If there is no webhook, a git push will not trigger a build.