Skip to content

fix(security): let Tier-3 registry read reach the registrant form's models - #454

Open
kneckinator wants to merge 2 commits into
19.0from
fix/tier3-registry-read-acls
Open

fix(security): let Tier-3 registry read reach the registrant form's models#454
kneckinator wants to merge 2 commits into
19.0from
fix/tier3-registry-read-acls

Conversation

@kneckinator

@kneckinator kneckinator commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Restores the model read access that the Tier-2 → Tier-3 registry-role swap in #353 (security batch 2, PR #422) silently revokes.

The mechanism

spp_registry.group_registry_viewer (Tier-2) carries implied_ids = [group_registry_read] (spp_registry/security/groups.xml:36). Tier-2 strictly contains Tier-3, so re-pointing a role from viewer to read can only lose ACLs. #353's migration states registrant read is unchanged — true for the models granted to both tiers, but several modules that extend the registrant form grant their models to the viewer tier alone. A role scoped to Tier-3 then gets an AccessError simply opening a registrant.

What actually breaks

Determined per model against a live database (ir.model.access.check as a base.group_user + group_registry_read user), not by reading ACL files:

Module Models restored Why it is a registrant-form dependency
spp_consent all 9 views/registrant_view.xml extends the registrant form
spp_programs spp.cycle, spp.cycle.membership views/registrant_view.xml renders cycle_id in the entitlement lists
spp_irrigation spp.irrigation.asset views/irrigation_view.xml renders irrigation_asset_ids

res.partner.bank is deliberately not included. It is viewer-only within this repo, so a repo-local ACL diff flags it — but odoo/addons/base/security/ir.model.access.csv:77 already grants it to base.group_user, so every internal user can read it and nothing is lost. spp_banking needs no change. Any earlier analysis naming it (including review notes on #353) is wrong on that point.

Not restored, and correctly dropped — none has a registrant-form path: spp.disable.registrant.wizard, spp.queue.background.task (utility models in spp_registry) and the three spp.dci.* models.

Tests

One regression test per module asserting a Tier-3 user can read that module's registrant-form models. Each was confirmed to fail without the ACL rows and pass with them — the first draft of the spp_banking test passed either way, which is what exposed the res.partner.bank false positive.

Full suites on the merged tree: spp_consent 157, spp_programs 685, spp_irrigation 33 — 0 failures, 0 errors.

⚠ Merge order

spp_programs goes 19.0.2.3.0 → 19.0.2.3.3, skipping 2.3.1 and 2.3.2 which PR #422 claims. This assumes #422 merges first. If this PR needs to land first instead, spp_programs must be renumbered here and #422 rebased onto it — the two orders cannot both be safe.

19.0 moved to spp_programs 19.0.2.3.0 (deduplication, #445) after this branch was opened, so 19.0 has been merged in and the numbering re-based on it. The earlier 2.2.4 would have been a version regression, and — the real hazard — the new access-control entries would never have been applied to a database already upgraded to 2.3.0, since Odoo only replays data for a higher manifest version. Same correction was applied to #422.

Deployment-wise the dependency runs the other way: #353 should not reach production without this, or Tier-3-scoped Program Viewer / CR Requestor / CR Local Validator / CR HQ Validator roles lose the registrant form.

Notes

  • Two entries added here are named access_spp_cycle_registry_read / access_spp_cycle_membership_registry_read. An earlier revision of this branch generated them with a doubled word (..._registry_registry_read); they were renamed before merge, so no identifier is orphaned.

  • The pre-existing access_spp_irrigation_asset_registry_read entry is misnamed — it grants the Tier-2 viewer group, not Tier-3 read. Renaming it would orphan the xmlid on upgraded databases, so the new entry uses access_spp_irrigation_asset_tier3_read instead.

  • A sweep test asserting the roles lose no unlisted ACL belongs with spp_change_request_v2/tests/test_cr_roles_registry_scope.py, which security(roles): scope program/CR roles to Tier-3 registry read (drop registry-search menu) #353 introduces and which does not exist on 19.0. It should be added to security: batch 2 — CR + programs chain (#264, #261, #338, #336, #353, #343, #365) #422 once this merges, or in a small follow-up after both.

  • docker-compose.yml now mounts docker/postgresql.conf with :ro,z. Without the SELinux relabel flag the database container cannot read it from a fresh git worktree, breaking scripts/test_single_module.sh there.

…odels

spp_registry.group_registry_viewer (Tier-2) implies group_registry_read
(Tier-3), so any model granted only to the viewer tier becomes
unreadable for a role scoped to the read tier. Several modules that
extend the registrant form grant their models to the viewer tier alone,
so such a role gets an AccessError merely opening a registrant.

Verified per model against a live database rather than by reading ACL
files: spp_consent's nine models, spp_programs' spp.cycle and
spp.cycle.membership (the entitlement lists render cycle_id) and
spp_irrigation's spp.irrigation.asset are genuinely unreachable.
res.partner.bank is not, despite being viewer-only here — Odoo core
already grants it to base.group_user — so spp_banking needs no change.

spp_programs skips 19.0.2.2.2 and .2.2.3, which the security batch-2
branch claims; this assumes that branch merges first.

Also mounts docker/postgresql.conf with :ro,z. Without the SELinux
relabel flag the database container cannot read it from a fresh git
worktree, which breaks scripts/test_single_module.sh there.
@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.84%. Comparing base (82ac4c1) to head (1b06e11).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             19.0     #454      +/-   ##
==========================================
+ Coverage   76.28%   76.84%   +0.56%     
==========================================
  Files         654      672      +18     
  Lines       44035    43564     -471     
==========================================
- Hits        33592    33477     -115     
+ Misses      10443    10087     -356     
Flag Coverage Δ
spp_api_v2 79.99% <ø> (ø)
spp_api_v2_change_request 66.53% <ø> (ø)
spp_api_v2_cycles 71.03% <ø> (ø)
spp_api_v2_data 77.77% <ø> (ø)
spp_api_v2_entitlements 70.23% <ø> (ø)
spp_api_v2_gis 74.60% <ø> (ø)
spp_api_v2_products 65.86% <ø> (?)
spp_api_v2_programs 92.22% <ø> (ø)
spp_api_v2_service_points 71.03% <ø> (ø)
spp_api_v2_simulation 71.19% <ø> (ø)
spp_api_v2_vocabulary 57.75% <ø> (?)
spp_approval ?
spp_base_common 91.07% <ø> (ø)
spp_case_entitlements 100.00% <ø> (ø)
spp_case_programs 100.00% <ø> (ø)
spp_consent 88.65% <ø> (?)
spp_data_classification ?
spp_irrigation 100.00% <ø> (?)
spp_programs 66.73% <ø> (ø)
spp_registry 87.79% <ø> (ø)
spp_security 69.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 67 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

19.0 released spp_programs 19.0.2.3.0 (deduplication, #445), above the
19.0.2.2.4 this branch claimed. Left alone the manifest would regress
and the new Tier-3 access-control entries would never be applied to a
database already upgraded to 2.3.0.

This branch's spp_programs entry moves to 19.0.2.3.3, above the
19.0.2.3.1 / 19.0.2.3.2 that the security batch-2 branch (#422) takes,
so the two stack cleanly with #422 merging first.

The access-control file conflict is a both-sides append: 19.0's
deduplication wizard entries and this branch's Tier-3 registry-read
entries are both kept. The two new entries are also renamed from
access_spp_cycle_registry_registry_read /
access_spp_cycle_membership_registry_registry_read, which doubled a word
through a generation slip; nothing references the old identifiers and
neither has shipped.
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.

1 participant