[19.0][FIX] base_user_role_company: fix cross-company privilege escalation … #478
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.46) × (1 − Review Confidence (0.41)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 242 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.329
Real PR Conversation Timeline
1 comments
"Review active on #478"
general
weight: 0.35
dreispt
…and migrate 'role_line.company_id' to 'company_ids'
Issue description
Formerly the
res.users.group_idswas recomputed and written in DB when a user was browsing from a company to another. This implementation was letting a security risk:Fix
Opportunity:
Since v19.0, a new computed field
all_group_idsexist onres.groups. This field is called byir.model.access::_get_allowed_modelsand ir.rule::_compute_domain.Solution:
The fix inherits _compute_all_group_ids
to make it compatible with company-aware roles. It also adapts calls to @tool.ormcache, so the proper caches are used / unvalidated whenself.env.companieschanges.ir.ruleNote: there is nothing to do on
because the cache is already company-dependant.Necessary changes
, which was writing theres.users:group_ids: this is now obsolete, and only done atres.users::create/writefor UI purpose (and only base on user's maincompany_id): add the missing context keyallowed_company_ids, needed to compute the proper environment varself.env.companies. If not done, the navbar menu is generated based on the user's defaultcompany_idgroups (all_group_ids). In other word: the menu item were not dynamically changing when the user was browsing other companies.Side changes / other improvements
to acompany_ids` fields, more convenient