[REVIEW] dms: _get_permission_domain sentinel fix vs _search override#26
Open
dnplkndll wants to merge 3 commits into
Open
[REVIEW] dms: _get_permission_domain sentinel fix vs _search override#26dnplkndll wants to merge 3 commits into
dnplkndll wants to merge 3 commits into
Conversation
…earch override Alternative to the _search() override: 19.0's Domain engine coerces the `permission_<op> = user.id` ir.rule sentinel to the Boolean field type before the search method runs, so `value == self.env.uid` no longer detects the per-user permission check. Detect it by su + non-root uid and build the domain from env.uid instead. Restores the rule-based read isolation without a parallel _search filter (net -10 lines).
b628ef8 to
171bd86
Compare
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.
Isolated review of the alternative to the new
_searchoverride (victoralmau flagged the override on OCA#475).This PR's diff = the swap in isolation (+8 / −18, net −10): remove the
_searchoverride; fix the sentinel detection in the existing_get_permission_domain.Why the override existed
19.0's Domain engine coerces the
permission_<op> = user.idir.rule sentinel to the Boolean field's type before the field'ssearch=method runs (observed live:op=in value=OrderedSet([True])instead ofvalue=8). Sovalue == self.env.uidno longer detects the per-user permission check,_get_permission_domainfalls through toreturn Domain.TRUE, and the ir.rule stops filteringsearch()→ read-isolation leak.The alternative
During ir.rule eval the env is
su=Truebutenv.uidis still the acting user. Detect the rule context bysu and uid != SUPERUSER_IDand build the domain fromenv.uid(which_get_access_groups_queryalready uses) instead of the coerced value. Enforcement stays in the existing rule→search-method path — no parallel_searchfilter.Proof (dev-runner 19.0, fresh DB, --without-demo=all)
permission_<op>rules are positive= user.id; no other code searches these fields under sudo.Not for upstream as-is — comparison artifact for deciding which fix lands on OCA#475.