Skip to content

Commit b846144

Browse files
committed
fix(spp_statistics_dashboard): add nosemgrep annotations for sudo() calls
Both sudo() usages are intentional: - ir.config_parameter.sudo(): standard Odoo pattern for system params - res.partner.sudo(): needed for queue_job cron context, reads IDs only
1 parent cdef2d9 commit b846144

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

spp_statistics_dashboard/models/dashboard_data.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ def _get_dashboard_areas(self):
266266
by admin level (comma-separated integers). If not set, includes
267267
all areas.
268268
"""
269+
# nosemgrep: semgrep.odoo-sudo-without-context - standard pattern for reading system parameters
269270
param = self.env["ir.config_parameter"].sudo().get_param("spp_statistics_dashboard.area_levels", "")
270271
domain = []
271272
if param.strip():
@@ -311,6 +312,9 @@ def _build_scope(self, area, program):
311312
# System-wide scope: query all registrant IDs directly and use
312313
# explicit scope. We can't use CEL scope because the scope resolver's
313314
# env.get() check on the AbstractModel executor returns falsy.
315+
# sudo() is needed because this runs as a queue_job (cron user context).
316+
# Only reads IDs, no sensitive data is exposed.
317+
# nosemgrep: semgrep.odoo-sudo-on-sensitive-models, semgrep.odoo-sudo-without-context
314318
all_ids = self.env["res.partner"].sudo().search([("is_registrant", "=", True)]).ids
315319
return {
316320
"scope_type": "explicit",

0 commit comments

Comments
 (0)