Skip to content

feat(codeowners): ProjectOwnership validation blocks codeowner paths#27643

Merged
AniketDas-Tekky merged 2 commits intomasterfrom
block-codeowners-API-1968
Jul 21, 2021
Merged

feat(codeowners): ProjectOwnership validation blocks codeowner paths#27643
AniketDas-Tekky merged 2 commits intomasterfrom
block-codeowners-API-1968

Conversation

@AniketDas-Tekky
Copy link
Copy Markdown
Contributor

Codeowners should only be able to be added through importing a codeowners file. In order to prevent a user from modifying their issue owners to add a codeowners path, ProjectOwnershipSerializer now validates that there are no "codeowners" matcher types in the raw lines.

Bonus: made matcher types constants in grammar.py

Fixes API-1968

Codeowners should only be able to be added through importing a codeowners file. In order to prevent a user from modifying their issue owners to add a codeowners path, ProjectOwnershipSerializer now validates that there are no "codeowners" matcher types in the raw lines.

Bonus: made matcher types constants in grammar.py

Fixes API-1968
Copy link
Copy Markdown
Member

@MeredithAnya MeredithAnya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be nice to update the Matcher docstring to mention codeowners and module matcher types, in addition to a note about the codeowners matcher being invalid for issue owner syntax


@staticmethod
def _validate_no_codeowners(rules: List[Rule]):
"""codeowner matcher types cannot be added via ProjectOwnership, only via github"""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might just be me catching up here, but you can still add a codeowner file via the API directly right? which would just be using the ProjectCodeOwners table instead.

only via github is a little confusing to me because we have gitlab too (supposedly) and i thought manually as well

Copy link
Copy Markdown
Member

@MeredithAnya MeredithAnya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@AniketDas-Tekky AniketDas-Tekky merged commit 76b3988 into master Jul 21, 2021
@AniketDas-Tekky AniketDas-Tekky deleted the block-codeowners-API-1968 branch July 21, 2021 23:15
@github-actions github-actions bot locked and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants