Skip to content

fix(check): refuse an association used as an XPath condition (#2793) - #2827

Merged
ako merged 1 commit into
mainfrom
claude/issue-triage-prioritization-24rqgv
Dec 4, 2026
Merged

ako merged 1 commit into
mainfrom
claude/issue-triage-prioritization-24rqgv

Conversation

@ako

@ako ako commented Dec 4, 2026

Copy link
Copy Markdown
Owner

Fixes #2793 (upstream mendixlabs#2042).

Problem

[Module.Assoc] and not(Module.Assoc) read like "has one" and "has none". check accepted them in an access rule, a retrieve and a page datasource. mxbuild rejects each one with CE0161 "Error(s) in XPath constraint.", including inside a nested predicate.

Measured (11.12.6, security level Production)

XPath mx check
[not(M.Doc_Org)], [M.Doc_Org] CE0161
[M.Doc_Org/M.Org[M.Org_Holder]], [… and not(M.Org_Holder)] CE0161
[not(M.Doc_Org/M.Org)], [M.Doc_Org/M.Org[not(M.Org_Holder/M.Holder)]] 0 errors

At security level Off, mx does not validate access-rule XPaths at all, so the bad rule reports 0 errors there.

Fix

xpathBareAssociationTerms parses the constraint and walks condition positions: the group root, and/or operands, not() arguments and path-step predicates. A path made only of module-qualified steps, with an odd step count and no predicate on the last step, ends on an association, so no project is needed to tell. Each such path is reported as MDL047, the existing rule for the other association test XPath lacks (= empty), with the path-to-entity fix. The check runs from the microflow retrieve, access-rule and datasource validators.

Tests

  • TestXPathBareAssociationTerms_Issue2793: 16 hit and legal forms.
  • TestBareAssociationReachesEveryCheck_Issue2793: retrieve (with control), access rule, page datasource.
  • Revert proof: with the wiring removed, both tests fail.
  • make ci-local passed. Finding recorded, make check-findings OK.

Generated by Claude Code

`[M.Assoc]` and `not(M.Assoc)` in an access rule, a retrieve or a page
datasource passed check and failed mxbuild with CE0161. Parse the
constraint, walk condition positions, and report a path that ends on an
association as MDL047 with the path-to-entity fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011oK82qrr1WnXxq1eRn7qRJ
@ako
ako merged commit 1f4ac6d into main Dec 4, 2026
18 checks passed
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.

[up#2042] check accepts not(Module.Assoc) in an Module1-rule XPath; mxbuild rejects it with CE0161

2 participants