Skip to content

Correction for output mediator passed to WriteHeader #5184 - #5186

Merged
joachimmetz merged 1 commit into
log2timeline:mainfrom
kev365:fix-kml-writeheader
Jul 30, 2026
Merged

Correction for output mediator passed to WriteHeader #5184#5186
joachimmetz merged 1 commit into
log2timeline:mainfrom
kev365:fix-kml-writeheader

Conversation

@kev365

@kev365 kev365 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Fixes #5184.

ExportEvents passed the plaso.output.mediator module to WriteHeader instead of
the OutputMediator it had just created, so psort.py -o kml failed with
AttributeError: module 'plaso.output.mediator' has no attribute 'encoding'.

Also adds the end-to-end test for the kml output format, modelled on
output_rawpy.

A note on the reference output: KMLOutputModule.WriteFieldValues returns early for
events without latitude and longitude, and test_data/psort_test.plaso has no
geolocation data, so test_data/end_to_end/kml.log is the header and footer only:

<?xml version="1.0" encoding="utf-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Document></Document></kml>

That covers the defect, since it is in WriteHeader. It does not cover the placemark
path in WriteFieldValues, and there is currently no clean way to: android_airtag
appears to be the only parser that populates latitude and longitude, and the
AirGuard beacon table it reads stores latitude in the column named longitude and
longitude in the column named latitude
(reference). The plugin
does not compensate for that, so a placemark reference generated from
test_data/android/attd_db would record reversed coordinates. Noted for the record,
not addressed here.

Verified with the full end-to-end suite on Ubuntu 26.04, exit 0, including the new
output_kml case.

ExportEvents passed the plaso.output.mediator module to WriteHeader instead
of the OutputMediator instance, causing psort.py -o kml to fail with an
AttributeError. Also adds an end-to-end test for the kml output format.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.10%. Comparing base (c69255f) to head (9fcec2a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5186   +/-   ##
=======================================
  Coverage   85.10%   85.10%           
=======================================
  Files         456      456           
  Lines       41089    41089           
=======================================
  Hits        34967    34967           
  Misses       6122     6122           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joachimmetz joachimmetz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@joachimmetz

Copy link
Copy Markdown
Member

Thanks for the proposed changes

@joachimmetz
joachimmetz merged commit 91241a5 into log2timeline:main Jul 30, 2026
18 checks passed
@kev365
kev365 deleted the fix-kml-writeheader branch August 8, 2026 17:26
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.

psort -o kml fails with AttributeError in WriteHeader

2 participants