-
Notifications
You must be signed in to change notification settings - Fork 122
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
Hide meta repository from users #1115
Conversation
Motivation: The `meta` repository contains mirror and credential configurations, which are now accessed via REST APIs. Since authorization for the `meta` repository is no longer required, it can be completely hidden from users. Modifications: - Hid `meta` repositories in all projects. - Added a job to remove the `meta` repository's `RepositoryMetadata` from the `/metadata.json` file. Result: - You can no longer see or access the `meta` repository directly.
@@ -292,7 +292,8 @@ private CompletableFuture<Void> purgeRepository(PurgeRepositoryCommand c) { | |||
} | |||
|
|||
private CompletableFuture<CommitResult> push(RepositoryCommand<?> c, boolean normalizing) { | |||
if (c.projectName().equals(INTERNAL_PROJECT_DOGMA) || c.repositoryName().equals(Project.REPO_DOGMA) || | |||
if (c.projectName().equals(INTERNAL_PROJECT_DOGMA) || | |||
Project.internalRepos().contains(c.repositoryName()) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you replace all Project.internalRepos().contains()
with Project.isInternalRepo()
(a new static method) for brevity? We could introduce some naming rule in the future more easily as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. Addressed. 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍👍
@@ -201,8 +198,7 @@ public CompletableFuture<PushResultDto> push( | |||
Author author, | |||
CommitMessageDto commitMessage, | |||
@RequestConverter(ChangesRequestConverter.class) Iterable<Change<?>> changes) { | |||
final User user = AuthUtil.currentUser(ctx); | |||
checkPush(repository.name(), changes, user.isSystemAdmin()); | |||
checkMetaRepoPush(repository.name(), changes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove this validation as accessing meta
is prohibited by the decorator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A system admin can still do the push and I left it because of these lines:
https://github.com/line/centraldogma/pull/1115/files#diff-365d4212ade9fe684cd89a04b979999f32b398703bd3ebbfa99d51d10617c3b4R448
https://github.com/line/centraldogma/pull/1115/files#diff-365d4212ade9fe684cd89a04b979999f32b398703bd3ebbfa99d51d10617c3b4R455
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1115 +/- ##
============================================
+ Coverage 70.07% 70.38% +0.30%
- Complexity 4486 4518 +32
============================================
Files 453 454 +1
Lines 18161 18426 +265
Branches 2008 2026 +18
============================================
+ Hits 12727 12969 +242
- Misses 4345 4368 +23
Partials 1089 1089 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Thanks for reviewing. 😉 |
Motivation:
The
meta
repository contains mirror and credential configurations, which are now accessed via REST APIs. Since authorization for themeta
repository is no longer required, it can be completely hidden from users.Modifications:
meta
repositories in all projects.meta
repository'sRepositoryMetadata
from the/metadata.json
file.Result:
meta
repository directly.