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

Scope the opened action of webhook to auth'ed issues #3163

Closed
karlcow opened this issue Jan 21, 2020 · 1 comment
Closed

Scope the opened action of webhook to auth'ed issues #3163

karlcow opened this issue Jan 21, 2020 · 1 comment
Assignees

Comments

@karlcow
Copy link
Member

karlcow commented Jan 21, 2020

This has to be done before #3140 and #3155

Currently the webhook will listen on any opened actions. It means that if we send POST requests coming from other repos. We will make the webhook busy for nothing. We need to scope it by checking the request is coming from the priviledged repo.

if issue['action'] == 'opened':
# we are setting labels on each new open issues
response = new_opened_issue(payload)

In this way the webhook will not process anything in the case of opened actions on private issues.

@karlcow karlcow self-assigned this Jan 21, 2020
@karlcow
Copy link
Member Author

karlcow commented Jan 21, 2020

Here an example of a payload that the webhook receives (removing unnecessary details.)

{
  "action": "opened",
  "issue": {
    "url": "https://api.github.com/repos/webcompat/web-bugs/issues/47772",
    "repository_url": "https://api.github.com/repos/webcompat/web-bugs",
    "number": 47772,
    "title": "fireflix.ws - site is not usable",
    "user": {

    },

}

karlcow added a commit to karlcow/webcompat.com that referenced this issue Jan 21, 2020
This adjusts the fixtures so that they will be compatible with the new scoping on webhooks.
karlcow added a commit to karlcow/webcompat.com that referenced this issue Jan 21, 2020
This will ease the reading when something goes wrong, by scoping which tests fails for which reason.
karlcow added a commit to karlcow/webcompat.com that referenced this issue Jan 21, 2020
…ed actions

Here we are making sure that we are adequately testing that we get the right repo url before attempting any actions such as labeling.
karlcow added a commit to karlcow/webcompat.com that referenced this issue Jan 21, 2020
…he issue

We want to limit the tagging by labels only to issues on the public repo. We do not want to necessary label them in the private repo.
karlcow added a commit to karlcow/webcompat.com that referenced this issue Jan 21, 2020
…ed actions

Here we are making sure that we are adequately testing that we get the right repo url before attempting any actions such as labeling.
karlcow added a commit to karlcow/webcompat.com that referenced this issue Jan 21, 2020
…he issue

We want to limit the tagging by labels only to issues on the public repo. We do not want to necessary label them in the private repo.
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