Repository navigation
fix: check access rule constraints with a token MxBuild rejects (CE0161) - #1844
Open
Joshua-TOF wants to merge 1 commit into
Open
Joshua-TOF wants to merge 1 commit into
Joshua-TOF wants to merge 1 commit into
Conversation
…61) (closes mendixlabs#1843) literalTypeProblem judged '[%CurrentUser%]' and returned early for every other token, and literalTypeProblems only looked up attributes, so these passed check -p and exec and failed mx check 11.14.0 (Production) with CE0161 "Error(s) in XPath constraint.": - a quoted token on a number ([Cnt = '[%DayLength%]']): now refused like '5'; - a date token or a [%UserRole_...%] token on a String; - a [%UserRole_...%] token on a DateTime; - '[%CurrentUser%]' compared with an association whose far end is not System.User or a specialization of it. A date token on a DateTime and '[%CurrentUser%]' on an association to System.User or Administration.Account stay silent, as measured. Tokens on a Boolean or enumeration, other tokens on a String or DateTime, an association the entity is not the FROM end of, and a far end whose generalization chain cannot be read stay silent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Closes #1843
What. A follow-up to fd51d9f (#1803).
check -pandexec's pre-flight now also report:[Cnt = '[%DayLength%]']), refused like'5';[%CurrentDateTime%],[%BeginOf…%],[%EndOf…%]) or a[%UserRole_…%]token on a String;[%UserRole_…%]token on a DateTime;'[%CurrentUser%]'compared with an association whose far end is not System.User or a specialization of it.Why. Each of these passed
check -pandexec, then failed the build with CE0161 "Error(s) in XPath constraint." at "Access rule of entity …".How. All changes are in
validate_access_rule_xpath.go:literalTypeProblemno longer returns early for tokens other than[%CurrentUser%]. On a number it lets the existing quoted-value rule judge them; on a String or DateTime,tokenTypeProblemjudges only the measured pairs.walkXPathLiteralComparisonsis now a thin wrapper overwalkXPathMemberComparisons, which also hands over qualified associations.currentUserAssociationProblemtakes an association's ends from the script or else the project's association catalog, and walks the far end's generalization chain. That chain comes from the script's declarations, or else the project.Left silent rather than risk a false error:
[id = '[%CurrentUser%]'].Testing.
validate_access_rule_xpath_test.gohas 7 new refused cases and 2 new legal twins: a specialization of System.User, and an unmeasured token on a String.[Cnt = '[%DayLength%]']moves from the legal list to the refused list, since it is measured as CE0161. All 67 subtests pass.go vetreports nothing;gofmtis clean.-run "XPath|Grant|Retrieve|Access|Security"subset ofmdl/executorfails the same 4TestDiffLocal_*tests onmainand on this branch: Windows temp-file cleanup.Mendix 11.14.0 validation. A fresh project at security level Production, one entity and one grant per case, 49 grants:
mx checkrejected 29 with CE0161.mainreports 21 of them; this branch reports 28.mx checkaccepted, which include'[%CurrentUser%]'on associations to System.User and to Administration.Account.[id = '[%CurrentUser%]']on a non-user entity.🤖 Generated with Claude Code