Repository navigation
Conversation
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.
Fixes: #5727
Summary
DataManager.loadValuesnow hides exactly the columns that use an attribute the current user may not read. Before, a column that was not a single attribute path (a literal, a parameter, an expression over several attributes, a subquery or a whole entity) moved the masking to another column: an allowed column came backnull, and a denied one came back with its value.What was done
QueryParser.QueryPath#getSelectedItemIndexgives the position of the main select-clause item (result column) that contains the path, or-1when the path is not in one.QueryParserAstBasedfills it in.LoadValuesAccessContext#getSelectedIndexesuses this position instead of counting selected paths. A column is hidden when a denied attribute appears anywhere in it: alone, inside an expression or inside a subquery. The same denied index is no longer added twice.LoadValuesConstraintno longer stops checking the remaining columns at a selected path without a property path (a whole-entity column).JpqlExecutionService#resolveHiddenSelectedIndexes(@Secret/@ExcludeFromAicolumns) andEnumCaptionResultLocalizeruse the same column position. A column gets an enum caption only when its only attribute path is an enum attribute.DataManagerLoadValuesAttributeAccessTest(security-data) for literal, parameter, entity, expression and subquery columns;QueryParserAstBasedTest#testGetQueryPathsSelectedItemIndex; new cases inJpqlExecutionServiceExcludeFromAiColumnTestandEnumCaptionResultLocalizerTest.Behavior changes (release notes)
QueryParserAstBased#createQueryPathhas a newselectedItemIndexparameter.QueryParserthat createsQueryPathwith the old 4-argument constructor reports no column position, so denied columns of its queries are not hidden. Use the new 5-argument constructor.Out of scope
whereorhavingclause is still neither hidden nor refused; loadValues does not check denied attributes selected by a subquery in the where or having clause #5987 makes such queries refused, together with the paths of custom parsers that report no column position.Checklist
./gradlew :data:test :security-data:test :aitools:test./gradlew -PspotbugsEnabled :data:spotbugsMain :security-data:spotbugsMain :aitools:spotbugsMain— no findings🤖 Generated with Claude Code