Skip to content

Wildcard action support in config#577

Merged
jarupatj merged 28 commits into
mainfrom
dev/agarwalayush/WildcardActionSupport
Jul 20, 2022
Merged

Wildcard action support in config#577
jarupatj merged 28 commits into
mainfrom
dev/agarwalayush/WildcardActionSupport

Conversation

@ayush3797

@ayush3797 ayush3797 commented Jul 20, 2022

Copy link
Copy Markdown
Contributor

Why is this required?
This change is required to support wildcard (*) action in the config file for an enitity role combination. Previously, we used to get this error when we had wildcard as an action:

System.Private.CoreLib.dll!System.ThrowHelper.ThrowKeyNotFoundException<System.__Canon>(System.__Canon key) Line 213	C#
 	System.Private.CoreLib.dll!System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>>.this[string].get(string key) Line 199	C#
 	Azure.DataGateway.Service.dll!Azure.DataGateway.Service.Authorization.AuthorizationResolver.SetEntityPermissionMap(Azure.DataGateway.Config.RuntimeConfig runtimeConfig) Line 301	C#
 	Azure.DataGateway.Service.dll!Azure.DataGateway.Service.Authorization.AuthorizationResolver.AuthorizationResolver(Azure.DataGateway.Service.Configurations.RuntimeConfigProvider runtimeConfigProvider, Azure.DataGateway.Service.Services.ISqlMetadataProvider sqlMetadataProvider) Line 45	C#

How was this done?
Whenever we get a wildcard action for an entity/role combination, we translate it into the 4 allowed CRUD operations i.e. create,read,update,delete. While setting the AuthorizationResolver.EntityPermissionMap, we include mappings for all the 4 operations instead of the wildcard operation.

How was this tested?
Included negative/positive tests for different authorization stages in AuthorizationResolverUnitTests.cs file where the wildcard is present as an action.

@ayush3797 ayush3797 linked an issue Jul 20, 2022 that may be closed by this pull request
Comment thread DataGateway.Service/Authorization/AuthorizationResolver.cs Outdated
Comment thread DataGateway.Service/Configurations/RuntimeConfigValidator.cs Outdated
Comment thread DataGateway.Service/Authorization/AuthorizationResolver.cs Outdated
Comment thread DataGateway.Service/Authorization/AuthorizationResolver.cs Outdated
Comment thread DataGateway.Service/Authorization/AuthorizationResolver.cs
Comment thread DataGateway.Service.Tests/Authorization/AuthorizationResolverUnitTests.cs Outdated
Comment thread DataGateway.Service.Tests/Authorization/AuthorizationResolverUnitTests.cs Outdated
Comment thread DataGateway.Service.Tests/Authorization/AuthorizationResolverUnitTests.cs Outdated
jarupatj and others added 3 commits July 20, 2022 13:32
Co-authored-by: Aniruddh Munde <anmunde@microsoft.com>
Co-authored-by: aaronburtle <93220300+aaronburtle@users.noreply.github.com>

@Aniruddh25 Aniruddh25 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@aaronburtle aaronburtle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good!

@jarupatj jarupatj enabled auto-merge (squash) July 20, 2022 23:48
@jarupatj jarupatj merged commit 6855adb into main Jul 20, 2022
@jarupatj jarupatj deleted the dev/agarwalayush/WildcardActionSupport branch July 21, 2022 00:00
@ayush3797 ayush3797 self-assigned this Mar 2, 2023
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.

Engine fail to start successfully if the action contains wildcard

4 participants