Skip to content

Add documentation for the new Best Practice Recommender security rules - #11851

Open
joerih wants to merge 3 commits into
mendix:developmentfrom
joerih:ctrl/3749-add-best-practice-recommender-security-documentation
Open

Add documentation for the new Best Practice Recommender security rules#11851
joerih wants to merge 3 commits into
mendix:developmentfrom
joerih:ctrl/3749-add-best-practice-recommender-security-documentation

Conversation

@joerih

@joerih joerih commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Make this a new page next to the already existing page about performance recommendations, and update the latter a bit to adapt it to this new structure.

Make this a new page next to the already existing page about performance
recommendations, and update the latter a bit to adapt it to this new
structure.
@joerih

joerih commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

This is the documentation of a new feature that will be released in version 11.15.0.

Comment on lines +121 to +133
### Constrain the Read Access of Anonymous Users [MXS010] {#mxs010}

The anonymous user role has read access to a [persistable entity](/refguide/persistability/) through an [access rule](/refguide/access-rules/) that has no [XPath constraint](/refguide/xpath-constraints/).

Without an XPath constraint, the access rule returns every object of the entity to every anonymous session. Data that was only ever meant to be visible to the visitor who submitted it, such as problem reports or form submissions, then becomes readable by all unauthenticated visitors. This is the most common way in which anonymous access leaks the data of unrelated users.

#### Steps to Fix

To fix the issue, add an XPath constraint to the access rule, so that it only returns the objects that the current anonymous session is allowed to see, for example by constraining on the owner of the object. If the objects cannot be narrowed down to the current session, remove the read access instead.

{{% alert color="info" %}}
This best practice is not reported for an access rule that also grants access to other user roles, because an XPath constraint applies to every module role of the access rule. Such an access rule is reported under [Do Not Share Module Roles Between Anonymous and Other User Roles](#mxs008) instead.
{{% /alert %}}

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.

Why do we recommend this - we say earlier on that putting an XPath constraint for an anonymous user is pointless as they will don't keep their user ID across sessions? But we now say it is a good idea.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree, I'm not sure today what to say on this, today. If an anonymous session does not have any identity, then it makes no sense doing something so that they later can find back their own persisted data... Indeed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, good question, this isn't explained very well. I've discussed it briefly with Jonathan, and the main purpose of this rule for constraining read access is to make sure the user at least thought about limiting access (because you can still write an XPath filter that does not look at the anonymous user id, but that restricts access in some other way).

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.

I've tried to explain the contradiction by adding something in ec38d82

@MarkvanMents

Copy link
Copy Markdown
Collaborator

@joerih and @knorrie - are you both happy with the changes I've made?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants