Repository navigation
feat(gitlab): a hub inside the group of its targets (security.writer_on_hub: guard) - #27
Merged
Merged
Conversation
…on_hub: guard) On GitLab a member of a group inherits its projects, so a hub kept in the group that holds its targets is reached by the writer. With security.writer_on_hub: guard, touchmark verifies that the writer cannot get content onto the hub's default branch instead of requiring that it cannot see the hub; refuse, the default, keeps today's behaviour. doctor grades hub-guard instead of hub-hidden for a writer that sees the hub (platform.HubGuard, GitLab): the writer below Maintainer, the default branch protected with no push or merge for it under the most permissive matching rule, merges that wait for a pipeline that succeeded and not a skipped one, and the CI file read from the default branch (ci_config_path <file>@<hub path>:<default branch>). Without that pin a writer pushing to a maintainer's merge request rewrites the CI file to drop the plan (checked live on CE 18.11). Other protected branches and tags the writer may use warn; doctor --hub-token grades the settings with a maintainer's token. Other drivers report hub-guard unknown. plan in a GitLab hub merge request pipeline exits 2 when the writer or a known author opened the merge request or pushed to its source branch since the branch was created, read from the push events, which name the pusher (platform.MergeRequestAuditor), and when it cannot tell. The setting, the writer and the known authors come from the default branch's hub.yml. setup gitlab accepts a hub inside the group of targets under guard, checks the writer's role (writer-guard), and sets the merge checks and the CI file pin. TestWriterOnHub runs it live. Closes #24.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #24.
A GitLab hub can now live in the group that holds its targets. The writer, a member of that group, then reaches the hub, and GitLab cannot lower an inherited role on one project. With
security.writer_on_hub: guardinhub.yml, touchmark verifies that the writer cannot get content onto the hub's default branch, instead of requiring that it cannot see the hub. The default,refuse, keeps today's behaviour, messages included.One addition to the issue: the CI file comes from the default branch
A merge request pipeline runs the CI file of its source branch. A writer that pushes to a maintainer's merge request could rewrite
.gitlab-ci.ymlto drop the plan that refuses its push, and "Pipelines must succeed" would pass. So the guard also requires the hub's CI/CD configuration file to be<file>@<hub path>:<default branch>(or<file>@<hub path>).Checked live on CE 18.11.12:
main's jobs, and the pipeline failed;[skip ci]push left the merge blocked;ci_config_pathand the merge checks;doctor --hub-tokengrades them.What changes
Config.
security.writer_on_hub:refuse(default) orguard, in the schema and the reference.doctor. Under guard, a writer that sees the hub gets
hub-guardinstead ofhub-hidden, from the new optionalplatform.HubGuard(GitLab):Other drivers report unknown.
doctor --hub-tokengrades the same settings with a maintainer's token.plan. In a GitLab hub merge request pipeline whose default branch's
hub.ymlsays guard, plan exits 2 when:known_authors;The pushes come from the source project's push events (
MergeRequestPushes, the new optionalplatform.MergeRequestAuditor), which name who pushed, also after someone else re-runs the pipeline. The setting, writer and known authors come from the default branch, so the merge request cannot turn the guard off.setup gitlab. Under guard:
writer-guardreplaceswriter-hidden(fails for a Maintainer writer);merge-checksturns on Pipelines must succeed and off skipped pipelines;ci-configpins the CI file, keeping a custom file name;hub-guard.Tests
hub.ymlturning it off, the default branch turning it off, no auditor, an anonymous reader);PinnedCIConfig.TestWriterOnHub(e2e GitLab).doctorgiveshub-guardok.main's plan.hub-guard.Docs