[Git][debian-gis-team/pygeoapi][master] 3 commits: New upstream version 0.23.5
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Tue Jul 14 16:07:11 BST 2026
Bas Couwenberg pushed to branch master at Debian GIS Project / pygeoapi
Commits:
c44f7f4f by Bas Couwenberg at 2026-07-14T16:51:22+02:00
New upstream version 0.23.5
- - - - -
737234b0 by Bas Couwenberg at 2026-07-14T16:51:49+02:00
Update upstream source from tag 'upstream/0.23.5'
Update to upstream version '0.23.5'
with Debian dir 2412b418090f20ba58583918603a4ac412fd942d
- - - - -
15c25755 by Bas Couwenberg at 2026-07-14T16:52:25+02:00
New upstream release.
- - - - -
5 changed files:
- debian/changelog
- docs/source/conf.py
- pygeoapi/__init__.py
- pygeoapi/provider/ogr.py
- tests/provider/test_ogr_gpkg_provider.py
Changes:
=====================================
debian/changelog
=====================================
@@ -1,4 +1,4 @@
-pygeoapi (0.23.4-1) UNRELEASED; urgency=medium
+pygeoapi (0.23.5-1) UNRELEASED; urgency=medium
* Initial Debian packaging (closes: #1140752)
=====================================
docs/source/conf.py
=====================================
@@ -112,7 +112,7 @@ today_fmt = '%Y-%m-%d'
# built documents.
#
# The short X.Y version.
-version = '0.23.4'
+version = '0.23.5'
# The full version, including alpha/beta/rc tags.
release = version
=====================================
pygeoapi/__init__.py
=====================================
@@ -30,7 +30,7 @@
#
# =================================================================
-__version__ = '0.23.4'
+__version__ = '0.23.5'
import click
try:
=====================================
pygeoapi/provider/ogr.py
=====================================
@@ -322,7 +322,7 @@ class OGRProvider(BaseProvider):
LOGGER.debug('processing properties')
attribute_filter = ' and '.join(
- map(lambda x: f'{x[0]} = \'{x[1]}\'', properties)
+ map(lambda x: f'{x[0]} = {sanitize_attribute_value(x[1])}', properties) # noqa
)
LOGGER.debug(attribute_filter)
@@ -410,7 +410,9 @@ class OGRProvider(BaseProvider):
LOGGER.debug(f'Fetching identifier {identifier}')
layer = self._get_layer()
- layer.SetAttributeFilter(f"{self.id_field} = '{identifier}'")
+ identifier2 = sanitize_attribute_value(identifier)
+
+ layer.SetAttributeFilter(f'{self.id_field} = {identifier2}')
ogr_feature = self._get_next_feature(layer, identifier)
result = self._ogr_feature_to_json(
@@ -902,3 +904,25 @@ def _ignore_gdal_error(inst, fn, *args, **kwargs) -> Any:
"""
value = getattr(inst, fn)(*args, **kwargs)
return value
+
+
+def sanitize_attribute_value(value) -> str:
+ """
+ Sanitize an attribute value used in an
+ OGR layer SetAttributeFilter function
+
+ :param value: `str` of attribute value
+
+ :returns: `str` of sanitized attribute value
+ """
+
+ if value is None:
+ return 'NULL'
+
+ if isinstance(value, bool):
+ return '1' if value else '0'
+
+ if isinstance(value, (int, float)):
+ return f"'{value}'"
+
+ return "'" + str(value).replace("'", "''") + "'"
=====================================
tests/provider/test_ogr_gpkg_provider.py
=====================================
@@ -80,6 +80,14 @@ def test_get(config_poi_portugal):
assert result['id'] == 536678593
assert 'cafe' in result['properties']['fclass']
+ with pytest.raises(ProviderItemNotFoundError):
+ item_id = 'foo%27%20OR%20%271%27%3D%271'
+ p.get(item_id)
+
+ with pytest.raises(ProviderItemNotFoundError):
+ item_id = "x' OR (SELECT substr(sql,1,1) FROM sqlite_master WHERE name='secret_table')='C" # noqa
+ p.get(item_id)
+
def test_get_not_existing_feature_raise_exception(
config_poi_portugal
@@ -397,3 +405,23 @@ def test_query_with_property_filtering(config_gpkg_4326):
assert 'straatnaam' in feature['properties']
assert feature['properties']['straatnaam'] == 'Arnhemseweg'
+
+ feature_collection = p.query(
+ properties=[
+ ('straatnaam', "Arnhemseweg' OR '1'='1")
+ ]
+ )
+
+ assert feature_collection.get('type') == 'FeatureCollection'
+ features = feature_collection.get('features')
+ assert len(features) == 0
+
+ feature_collection = p.query(
+ properties=[
+ ('straatnaam', "doesnotexist' OR '1'='1")
+ ]
+ )
+
+ assert feature_collection.get('type') == 'FeatureCollection'
+ features = feature_collection.get('features')
+ assert len(features) == 0
View it on GitLab: https://salsa.debian.org/debian-gis-team/pygeoapi/-/compare/7e62e7fdd6f512e61974bf3bae556fb14db79a7e...15c2575509a85e9a1c81438db497b18b739363f1
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pygeoapi/-/compare/7e62e7fdd6f512e61974bf3bae556fb14db79a7e...15c2575509a85e9a1c81438db497b18b739363f1
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20260714/67b636a1/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list