Skip to content

[16.0][FIX] base_geoengine: validate the column of indirect geo domains - #495

Open
leNeo wants to merge 1 commit into
OCA:16.0from
leNeo:16.0-fix-base_geoengine-indirect-domain-column
Open

leNeo wants to merge 1 commit into
OCA:16.0from
leNeo:16.0-fix-base_geoengine-indirect-domain-column

Conversation

@leNeo

@leNeo leNeo commented Nov 6, 2026 •

Copy link
Copy Markdown

Fixes #472.

In an indirect geo domain ({"model.column": domain}), the column part of the key was interpolated as is into the generated SQL. Domains come from RPC, so any user allowed to search a model with a GeoField could inject SQL through that key. Only the name of an actual GeoField of the related model is now accepted; anything else raises a ValueError, as Odoo does for an invalid field in a leaf.

Adds two regression tests: a non-geo column, which previously raised a SQL error, and an injection attempt (the_geom) OR (1=1), which previously executed. Both now raise ValueError; full module suite green locally with PostGIS.

Thanks @lesdekock for the report and the suggested allowlist approach. Forward-ports to 17.0, 18.0 and 19.0 will follow.

In an indirect geo domain such as
    ("the_point", "geo_intersect", {"dummy.zip.the_geom": [...]})
the part of the key after the last dot was interpolated as is into the
generated SQL. Since domains come from RPC calls, any user allowed to
search a model with a GeoField could inject SQL through that key, e.g.
{"dummy.zip.the_geom) OR (1=1": [...]}.

Only accept the name of an actual GeoField of the related model and
raise a ValueError otherwise, as Odoo does for an invalid field in a
leaf. Add regression tests for a non-geo column and for an injection
attempt.

Fixes OCA#472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants