Fix include fields section behaviour in the config#1282
Merged
Aniruddh25 merged 12 commits intomainfrom Mar 2, 2023
Merged
Conversation
added 2 commits
February 28, 2023 01:41
Aniruddh25
reviewed
Mar 1, 2023
Aniruddh25
reviewed
Mar 1, 2023
Aniruddh25
reviewed
Mar 1, 2023
Aniruddh25
reviewed
Mar 1, 2023
Aniruddh25
approved these changes
Mar 1, 2023
Collaborator
Aniruddh25
left a comment
There was a problem hiding this comment.
Thanks for catching this and the quick fix!
Aniruddh25
approved these changes
Mar 1, 2023
aaronburtle
reviewed
Mar 1, 2023
aaronburtle
approved these changes
Mar 1, 2023
Contributor
aaronburtle
left a comment
There was a problem hiding this comment.
Looks good, just had a question about the set of fields being null.
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.
Why make this change?
Fixes: #1208.
Need to see some test cases first!
What are we going to conclude from below examples:
If
includeis not specified: it will resolve to all the fields presentIf
excludeis not specified, it will resolve to an empty arrayConsider the following cases for the fields section for a particular role/action combination for an entity:
"fields":{ "include": [] }Since include is explicitly specified as an empty array, we won't resolve it to wildcard. (We were doing this before during config validation but not during authorization resolution stage). No field will be accessible for this configuration.
"fields":{ "include": [], "exclude":[] }Again since include/exclude both are empty arrays- behavior is identical to first case.
"fields":{ }In this case, included/excluded are not declared at all, and both would assume their default values, i.e., include will resolve to all the fields present in the entity and exclude will be empty. All the fields will be accessible in this configuration.
"fields":{ "excluded": ["some_field"] }In this case, included is not declared at all, so, it would assume its default value, i.e., it will resolve to all the fields present in the entity. All the fields except 'some_field' will be accessible in this configuration. This is the very case which was mentioned in the linked issue "Not all the columns required by policy are accessible." error #1208.
What is this change?
includeis resolved to contain all fields only when it is null (not declared in the config). The behavior was the same even before during authorization resolution stage, but during config validation, we were missing this resolution.How was this tested?
ConfigValidationUnitTests.csclass.