+
Skip to content

Should a payload's repo be validated by something besides URL? #1

Open
@ackspony

Description

@ackspony

Currently, a webhook can be validated by the repository URL (to ensure the event it's for the expected repo), using the Webhook\UrlCallbackRule class

This can potentially cause unwanted/unexpected disruption if a repository name is changed, or an organization's name is changed.

There may be no way to mitigate the use-case of a repository name changing, as the payload does not seem to have any list of "old" names, etc.

To mitigate the use-case of an organization name changing, a new CallbackRule child class could be created to validate the name property from the repository object of the payload (RepoNameCallbackRule). This would simplify deployment process for the endpoint, as only the name of the repo would need to be configured.

{
  "ref": "refs/heads/some-branch",
  ...
  "repository": {
      "id": 123456,
      "node_id": "aGVsbG8=",
      "name": "my-repo",
      "full_name": "my-org-or-username/my-repo",
  }
  ...
}

Finally, perhaps it never made sense to validate by a repo "url" anyway? A new CallbackRule child class should be created to validate the full_name property from the repository object of the payload (RepoFullNameCallbackRule).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载