-
Notifications
You must be signed in to change notification settings - Fork 272
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
Auto-convert V6 configuration instances into V7 configuration instances (for OpenSearch 2.x only) #4753
Open
nibix
wants to merge
7
commits into
opensearch-project:2.x
Choose a base branch
from
nibix:config-improvements-2.x
base: 2.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
1 task
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
nibix
force-pushed
the
config-improvements-2.x
branch
from
September 25, 2024 05:27
59758a7
to
51dbfb5
Compare
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
nibix
requested review from
cwperks,
DarshitChanpura,
peternied,
RyanL1997,
stephen-crawford,
reta and
willyborankin
as code owners
September 25, 2024 06:19
Signed-off-by: Nils Bandener <nils.bandener@eliatra.com>
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.
Description
This is secondary to #4546. Please review #4546 first.
This relates to the proposal "Behind the scenes conversion from V6 to V7" from #4493.
This converts the V6 config instances to V7 config instances "behind the scenes". This allows to save a lot of duplicate implementation regarding to privilege evaluation and possibly also further logic.
As an additional benefit, this makes it possible to use
SecurityDynamicConfiguration<>
instances in a generically type-safe manner. So far, one usually needs to useSecurityDynamicConfiguration<?>
instances and do unsafe casts.This only touches the runtime representation of the configuration. If there's a V6 configuration in the configuration index, it remains untouched. The possibility to update configuration in V6 format will remain.
This is only for OpenSearch 2.x. For the OpenSearch main branch, #4546 removes V6 config support alltogether.
Behind the scenes conversion
Some more detail on what is changed by this PR:
The configuration architecture consists of these levels:
ConfigurationRepository
which managesSecurityDynamicConfiguration<>
instances which contain as entry instances oforg.opensearch.security.securityconf.impl.v6.RoleV6
,org.opensearch.security.securityconf.impl.v6.RoleMappingsV6
,org.opensearch.security.securityconf.impl.v7.RoleV7
,org.opensearch.security.securityconf.impl.v7.RoleMappingsV7
, etc.DynamicConfigFactory
which consumesSecurityDynamicConfiguration<>
instances and createsConfigModel
andDynamicConfigModel
instances. If it finds V6 classes inSecurityDynamicConfiguration<>
, it createsConfigModelV6
instances, if it finds V7 classes, it createsConfigModelV7
instances.ConfigModelV6
andConfigModelV7
classes contain business logic which evaluates roles and permissions.PrivilegesEvaluator
.This PR changes the architecture at level 2:
ConfigurationRepository
is changed in this way: If it finds V6 instances likeorg.opensearch.security.securityconf.impl.v6.RoleV6
, it auto-converts these to V7 instances likeorg.opensearch.security.securityconf.impl.v7.RoleV7
. The V7 classes already have functionality for that which is already used for the securityadmin migration command.DynamicConfigFactory
does no longer need a distinction between two config versions.ConfigModelV6
becomes redundant.PrivilegeEvaluator
consumes the super interfaceConfigModel
, it does not notice anything about this change.Category: Refactoring
Why these changes are required? - Minimize duplicate logic for privilege evaluation
What is the old behavior before changes and new behavior after changes? - none
Category: Refactoring
Why these changes are required? - Minimize duplicate logic for privilege evaluation
What is the old behavior before changes and new behavior after changes? no behavior changes
Issues Resolved
Testing
LegacyConfigV6AutoConversionTest
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.