You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
base_geoengine: indirect geo-domain key interpolates an unvalidated column name into SQL #472
In the indirect (dict) form of a geo domain, the column half of the caller-supplied key is interpolated into SQL without validation or quoting. Because domains routinely arrive from client RPC, an authenticated user who can search/search_read a model carrying a GeoField can influence the generated SQL.
Where
base_geoengine/expressions.py, the dict-value branch:
rfind(".") splits on the last dot, so a key like res.partner.<payload> resolves rel_model to a real model (env[...] succeeds) while rel_col carries the payload straight into the f-string.
Why it is reachable
The module extends the operator allowlist at import (TERM_OPERATORS), so a domain containing e.g. geo_intersect passes Odoo's operator validation and reaches this code. Record rules do not help — the interpolation happens while the query is being built, before row filtering.
Affected
Present on 16.0, 17.0, 18.0 (expressions.py, the rel_col = key[i+1:] line on each), and carried into the 19.0 migration in #465.
Fix (proven downstream)
Validate that the column names a GeoField of the related model before it can reach SQL — an allowlist by construction:
rel_field=rel_model._fields.get(rel_col)
ifrel_fieldisNoneornotisinstance(rel_field, GeoField):
raiseValueError(
f"Invalid geo reference {key!r}: {rel_col!r} is not a"f" geo field of {rel_model._name!r}"
)
We carry a vendored derivative and shipped this with a regression test (a crafted non-GeoField suffix must raise rather than reach SQL). Happy to PR against whichever branches the maintainers want; flagging first in case you prefer to coordinate the fix across the stable series.
Thanks @lesdekock for flagging this.
I’ve opened #495 on 16.0, following your allowlist approach: the column must be an actual GeoField of the related model, otherwise a ValueError is raised. It comes with regression tests for a non-geo column and an injection attempt.
Forward-ports to 17.0, 18.0 and 19.0 will follow once merged.
Activity
leNeo commentedon Nov 6, 2026
Thanks @lesdekock for flagging this.
I’ve opened #495 on 16.0, following your allowlist approach: the column must be an actual GeoField of the related model, otherwise a ValueError is raised. It comes with regression tests for a non-geo column and an injection attempt.
Forward-ports to 17.0, 18.0 and 19.0 will follow once merged.
Your review would be very welcome.