security(demo): archive default-credential demo users in spp_mis_demo_v2/spp_grm_demo/spp_drims_sl(_demo)#356
Conversation
…nstall spp_mis_demo_v2, spp_grm_demo, spp_drims_sl and spp_drims_sl_demo each ship res.users with the well-known password "demo" in their data section, so they are created on every install — including a production database without demo data, where the credentials are a login vector (spp_drims_sl's user_admin_dmc even holds base.group_system). Same class as #341, extended to these bundles. Each module gains a post_init_hook that archives its default-credential users when the database has no demo data, leaving them active on demo/eval instances. The helper is self-contained per module (no dependency on the unmerged #341 spp_demo helper); spp_drims_sl_demo reuses spp_drims_sl's helper via its existing dependency. spp_mis_demo_v2's hook composes the archiving with its existing demo-variable activation. spp_mis_demo_v2 and spp_grm_demo drop Production/Stable (demo-only bundles). test_change_request_workflow_states drives the demo CR generator's tiered approval, which requires the designated demo validators; its setUpClass now reactivates them (running the generator is an explicit demo action). Generator runtime and the security hook are unchanged. Refs #345
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 19.0 #356 +/- ##
==========================================
- Coverage 74.28% 69.22% -5.06%
==========================================
Files 372 119 -253
Lines 25385 11810 -13575
==========================================
- Hits 18857 8176 -10681
+ Misses 6528 3634 -2894
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
CI status note. All module test jobs pass (incl. |
Closes #345. Follow-up from #341 (which fixed the same class in
spp_demo+spp_farmer_registry_demo), extended to the remaining demo bundles.Problem
Four modules ship
res.usersrecords with the well-known passworddemoin theirdata/demo_users.xml, listed under the manifestdatasection — so they are created on every install, including a production database installed without demo data, where the well-known credentials are a live login vector.spp_drims_sl'suser_admin_dmc(admin.dmc@drims.gov.lk) even holdsbase.group_system.demo)spp_mis_demo_v2demo_local_registrar…demo_cycle_approver)spp_grm_demodemo_grm_manager,demo_grm_officer)spp_drims_sluser_admin_dmc→base.group_system)spp_drims_sl_demokumari,rajitha,silva,perera,fernando,secretary)Fix (same pattern as #341)
Each module gains a
post_init_hookthat archives (active=False) its default-credential users when the database has no demo data (ir.module.module.demois False), and leaves them active on demo/evaluation instances. Odoo runspost_init_hookon install, and these user records carry no demo-gatedactivetoggle, so the hook is the mechanism that neutralizes them on a production-style install.Self-contained helpers (no dependency on #341). The
spp_demohelper #341 adds does not exist on19.0yet, so reusing it would couple this PR to #341. Instead each module carries its own small archive helper;spp_drims_sl_demoreusesspp_drims_sl's via its existing dependency.spp_mis_demo_v2's hook composes the archiving with its existing demo-variable activation (the manifest keeps a singlepost_init_hook).spp_mis_demo_v2andspp_grm_demoalso dropProduction/Stable→Alpha(they are demo-only bundles);spp_drims_sl(_demo)were alreadyAlpha. Eachdemo_users.xmlgains a security header comment. Deliberately not doing adata→demorestructure — the demo generators need these users to exist on eval DBs, matching #341's rationale.Tests
New
test_demo_user_safety.pyper module (archived when demo disabled; active when enabled;demo_data_enabledmatches the module flag; manifest wires the hook;spp_drims_sladditionally assertsuser_admin_dmcis in the set and holdsbase.group_system).One pre-existing test,
spp_mis_demo_v2'stest_change_request_workflow_states, drives the demo CR generator's tiered approval — which only the designated demo validators can perform (admin is not a tier approver). Since the hook archives those validators on the (demo-less) test DB, itssetUpClassnow reactivates them; running the generator is an explicit demo action. Generator runtime and the security hook are unchanged — no real install re-enables the default-credential users.Suites green locally:
spp_mis_demo_v2279,spp_grm_demo36,spp_drims_sl9,spp_drims_sl_demo13. README/index regeneration left to CI's pinned oca-gen (fragments changed).Merge-web note
Disjoint from the 18 open security PRs and from #341/#336.
spp_mis_demo_v2also appears in the held reland #282 (which is stale on this module: it bumps to19.0.2.1.0while base is19.0.2.1.3); this PR bumps to19.0.2.1.4. Whichever lands second re-merges metadata.Draft — awaiting human security review before undraft/merge.