Repository navigation
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.