m-lab / alertmanager-github-receiver

Prometheus Alertmanager webhook receiver that creates GitHub issues from alerts
Apache License 2.0
48 stars 23 forks source link

Detect permission problems #35

Open cjyar opened 4 years ago

cjyar commented 4 years ago

According to https://developer.github.com/v3/issues/#create-an-issue:

Only users with push access can set labels for new issues. Labels are silently dropped otherwise.

Scenario:

It seems like there are a few things we should/could do:

  1. Warn users that they need to have push permissions for the service account.
  2. Detect insufficient permissions and warn the user.
  3. Refuse to create duplicate issues.
stephen-soltesz commented 4 years ago

re: 1) https://github.com/m-lab/alertmanager-github-receiver#create-github-access-token outlines what permissions are needed for the access token. Unfortunately, "push" is not mentioned on the token allocation page. A note in our readme that points to the link you put here would be welcome.

re: 2) yes, if the client doesn't have sufficient permissions it should not create any issues. That addresses 3) also.