Skip to content

build(deps): bump xmlutil serialization to 1.0.1 and harden data layer parsers - #1741

Merged
dkhawk merged 2 commits into
mainfrom
chore/update-xmlutil-serialization
Aug 5, 2026
Merged

build(deps): bump xmlutil serialization to 1.0.1 and harden data layer parsers#1741
dkhawk merged 2 commits into
mainfrom
chore/update-xmlutil-serialization

Conversation

@dkhawk

@dkhawk dkhawk commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Dependency Update: Bump io.github.pdvrieze.xmlutil:serialization in gradle/libs.versions.toml from 0.91.3 to 1.0.1.
  • XML DSL Migration: Migrate the XML {} configuration DSL in GpxParser.kt and KmlParser.kt by promoting isCollectingNSAttributes = true from defaultPolicy {} to the top-level XML {} builder per xmlutil 1.0.0+ DSL changes.
  • KML Exception Hierarchy: Update expected exception for malformed KML coordinate tests in KmlParserTest.kt from XmlParsingException to XmlException per the updated xmlutil 1.0.x error hierarchy.
  • Security Hardening (Coordinates): Enforce coordinate finiteness invariants in Coordinates (GeoJSON), LatLngAlt (KML), and Wpt (GPX) init blocks to prevent NaN/Infinity coordinate poisoning from reaching LatLng or LatLngBounds.Builder.
  • Security Hardening (Styles): Sanitize non-finite numeric style properties (stroke-width, fill-opacity, stroke-opacity, width, scale) in GeoJsonMapper.kt and KmlMapper.kt to safe default visual styles rather than crashing or rendering invalid alpha/width values.
  • Adversarial Test Suite: Add comprehensive SecurityHardeningTest.kt unit test suite covering adversarial coordinate poisoning and non-finite style attribute injection across GeoJSON, KML, and GPX formats.

Reviewers

Test Plan

  • All 7 new adversarial unit tests in SecurityHardeningTest.kt pass cleanly.
  • All existing parser unit tests in GpxParserTest.kt and KmlParserTest.kt pass cleanly.
  • All 200 unit test tasks across all modules (:library, :clustering, :heatmaps, :data, :ui, :visual-testing) pass (./gradlew testDebugUnitTest).

…r parsers

- Update io.github.pdvrieze.xmlutil:serialization in libs.versions.toml from 0.91.3 to 1.0.1.

- Migrate XML {} configuration DSL in GpxParser and KmlParser by promoting isCollectingNSAttributes to the top-level XML {} builder per xmlutil 1.0.0+ DSL changes.

- Update expected exception for malformed KML coordinate tests in KmlParserTest from XmlParsingException to XmlException per xmlutil 1.0.x error hierarchy.

- Harden GeoJSON, KML, and GPX coordinate models (Coordinates, LatLngAlt, Wpt) by enforcing finiteness checks in init blocks and serializers to prevent NaN/Infinity poisoning from reaching LatLng/LatLngBounds.

- Sanitize non-finite numeric style properties (stroke-width, fill-opacity, stroke-opacity, width, scale) in GeoJsonMapper and KmlMapper to safe visual defaults.

- Add comprehensive SecurityHardeningTest suite covering adversarial coordinate poisoning and non-finite style injection across all three spatial formats.
@dkhawk
dkhawk requested review from LoyalAbbas and kikoso August 5, 2026 15:39
@googlemaps-bot

googlemaps-bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Overall Project 42.99% -0.14% 🍏
Files changed 88.74% 🍏

Module Coverage
data 49.12% -0.28% 🍏
Files
Module File Coverage
data KmlMapper.kt 87.12% 🍏
KmlParser.kt 85.71% 🍏
GpxParser.kt 81.82% 🍏
GeoJsonMapper.kt 80.61% -0.59% 🍏
GeoJsonObjects.kt 80.3% -5.3% 🍏
LatLngAlt.kt 80% -16.47% 🍏
LatLngAltSerializer.kt 79.47% -0.66% 🍏
GpxModel.kt 74.21% -2.78% 🍏

)
) {
init {
require(lat.isFinite() && lon.isFinite() && (ele == null || ele.isFinite())) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to think for a millisecond what was "ele", not sure if it could be worth adding the entire name.

@kikoso kikoso left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

dkhawk added a commit that referenced this pull request Aug 5, 2026
- Sync with latest origin/main containing PR #1740 (Gradle 9.6.1 / CI fixes), PR #1739 (LatLonQuad GroundOverlays), PR #1730 (clustering updateItem fix), and PR #1741 (XML serialization hardening).

- Preserve all backwards-compatible @deprecated com.google.maps.android.ktx typealiases and forwarding bridges for 6.0.0-rc01.

- Add play-services-location and mockito-kotlin dependencies to libs.versions.toml for KTX location module tests.
@dkhawk

dkhawk commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@kikoso Thanks for the feedback!

To address readability without breaking binary or source API compatibility for existing callers:

  • Kept @XmlSerialName("ele") val ele: Double? = null in the Wpt primary constructor so positional/named arguments and .ele property access remain 100% backwards-compatible.
  • Added val elevation: Double? get() = ele as a computed readability alias property on Wpt.
  • Added comprehensive class and parameter KDoc to Wpt documenting ele as elevation in meters.
  • Updated Wpt's init block validation check to use elevation == null || elevation.isFinite() so it is self-documenting.

@dkhawk
dkhawk force-pushed the chore/update-xmlutil-serialization branch from b087bd9 to 71a8201 Compare August 5, 2026 17:26
@kikoso

kikoso commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Ready to be merged IMO!

@dkhawk
dkhawk merged commit 7c36b51 into main Aug 5, 2026
12 checks passed
@dkhawk
dkhawk deleted the chore/update-xmlutil-serialization branch August 5, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants