--- title: "ADR 0014: GitHub access checks deny by default and trust only the PR author path" --- * Status: accepted * Code: [`pkg/provider/github/acl.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/provider/github/acl.go), [`pkg/provider/github/detect.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/provider/github/detect.go), [`pkg/provider/github/profiler.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/provider/github/profiler.go) ## Context `IsAllowed` decides whether the sender of an event may run CI. After the repository policy (see [ADR 0010]({{< relref "0010-repository-policy-evaluation.md" >}})), `aclCheckAll` tries, in order: sender owns the repo, the same-repo pull request shortcut, public org membership, repository collaborator, then the `OWNERS` file on the default branch. `aclAllowedOkToTestFromAnOwner` then looks for an `/ok-to-test` from an allowed user. ## Decision * `CheckPolicyAllowing` returns false when a policy team is not found (HTTP 404) or when any API error occurs. Denial is chosen over ignoring the team because the check is security related; the reason string tells the user to correct the setting. An API error also stops the loop instead of trying the remaining teams. * The same-repo shortcut (`checkPullRequestForSameURL`) lets bot-authored PRs such as Dependabot run without collaborator, org or `OWNERS` access when the head URL equals the base URL and the branches differ. It is only used for pull request, check run and check suite events (`canUseSameRepoPullRequestShortcut`), where the sender is expected to be the PR author. Comment events are excluded and log at debug level. `HeadURL` is filled by `getPullRequest()` before `aclCheckAll`; if it is empty the shortcut declines and the membership checks run. * `checkSenderOrgMembership` only sees members the user made public. A 404 from the org members call means the owner is a user, not an organization, and is treated as "not a member" rather than an error. * `OWNERS` and `OWNERS_ALIASES` are read from the default branch. A missing `OWNERS` returns false; a missing `OWNERS_ALIASES` is ignored. Absence is detected by matching `"cannot find"` in the error from `getFileFromDefaultBranch`. * In `aclAllowedOkToTestFromAnOwner` the `remember-ok-to-test` setting decides the scope: when off, an issue comment event only checks that one comment and a pull request event is never rescued; when on, every earlier `/ok-to-test` comment on the pull request is evaluated. * `wrapAPI` logs a 404 at debug level and other errors at error level, since a missing `OWNERS` file is an expected state. * On a commit comment event `detectTriggerTypeFromPayload` does not return `OkToTest`: the command is meant for pull requests, and only authorized users may run CI on pushed commits. Such a comment falls through to `triggertype.Comment` so an `on-comment` annotation can still match it instead of the event being rejected. ## Consequences * Adding an event type to the same-repo shortcut widens who can run CI without membership; it must be an event whose sender is the PR author. * Error handling for absent files depends on the `"cannot find"` message text.