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

feat: Add file path protection to rulesets #2415

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

grahamhar
Copy link
Contributor

@grahamhar grahamhar commented Oct 7, 2024

Resolves #2371


I have not been able to add tests as this feature is only available with paid plans. I will look to add tests that can be run when under an Enterprise when I am back in the office and have access to do this. Here is the doc that shows the push type rules are restricted.

image

Before the change?

  • Rules could not be added to rulesets to protect pushes to specific files

After the change?

  • rules can now be added to rulesets to prevent pushes to named files

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

@grahamhar
Copy link
Contributor Author

grahamhar commented Nov 2, 2024

I have tested the changes on an account with paid features so this is now good for review.

@grahamhar
Copy link
Contributor Author

@kfcampbell would it be possible to get feedback on this PR please.

@@ -101,6 +101,8 @@ The `rules` block supports the following:

* `tag_name_pattern` - (Optional) (Block List, Max: 1) Parameters to be used for the tag_name_pattern rule. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. Conflicts with `branch_name_pattern` as it only applied to rulesets with target `tag`. (see [below for nested schema](#rules.tag_name_pattern))

* `file_path_restriction` -(Optional) (Block List, Max 1) Parameters to be used for the file_path_restriction rule. When enabled restricts access to files within the repository. (See [Below for nested schema](#rules.file_path_restriction))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* `file_path_restriction` -(Optional) (Block List, Max 1) Parameters to be used for the file_path_restriction rule. When enabled restricts access to files within the repository. (See [Below for nested schema](#rules.file_path_restriction))
* `file_path_restriction` - (Optional) (Block List, Max 1) Parameters to be used for the file_path_restriction rule. When enabled restricts access to files within the repository. (See [Below for nested schema](#rules.file_path_restriction))

@stevehipwell
Copy link
Contributor

@grahamhar you might want to rebase as you have conflicts due to the GitHub SDK having been bumped to the next major version.

@grahamhar
Copy link
Contributor Author

@grahamhar you might want to rebase as you have conflicts due to the GitHub SDK having been bumped to the next major version.

Thanks for

@grahamhar you might want to rebase as you have conflicts due to the GitHub SDK having been bumped to the next major version.

Thanks for the review @stevehipwell I think everything is addressed now.

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

Successfully merging this pull request may close these issues.

[FEAT]: add file_path_restriction conditionals to repository rulesets
2 participants