Skip to content

feat(outside): allow exemptions in repo-level config - #932

Open
XakimovNosirbek wants to merge 2 commits into
ossf:mainfrom
XakimovNosirbek:feat/outside-repo-exemptions
Open

XakimovNosirbek wants to merge 2 commits into
ossf:mainfrom
XakimovNosirbek:feat/outside-repo-exemptions

Conversation

@XakimovNosirbek

Copy link
Copy Markdown

Fixes #525

Outside Collaborators exemptions can only be set in the org-level config today. In a loosely federated org, every exemption then has to go through the org admins, even though repo-level config can already override pushAllowed / adminAllowed. #525 has a concrete case of exactly this.

This adds exemptions to the repo-level outside.yaml:

exemptions:
  - user: octocat
    push: true
  • The repo-level entry has no repo field. It is converted to an exemption for the current repository only, with the name escaped by glob.QuoteMeta, so a repo can't exempt users in other repos.
  • It is appended to the org-level exemptions, and org entries still apply.
  • It goes through the same mergeInRepoConfig path as the other overrides, so it is ignored when the org sets disableRepoOverride: true. That keeps the original intent of the comment this removes: an org that wants every exemption visible centrally can still enforce that.
  • mergeConfig now copies the org slice before appending, so the org config isn't modified.
  • The README section and the issue text that suggests adding an exemption now mention the repo-level option.

Tests:

  • TestCheck: a repo-level exemption allows push, and is ignored with DisableRepoOverride.
  • TestMergeConfigRepoExemptions: merged list, escaping of a repo name with glob characters, no match on another repo, and the org slice is left untouched.

go test ./pkg/policies/outside/ and go vet pass.

Repo-level outside.yaml can now list exemptions. They only apply to that
repository and are ignored when the org sets disableRepoOverride.

Fixes ossf#525

Signed-off-by: XakimovNosirbek <68727555+XakimovNosirbek@users.noreply.github.com>
Signed-off-by: XakimovNosirbek <68727555+XakimovNosirbek@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Outside collaborators should be override-able at the repo-level

1 participant