[Audit] Refactor vCard parsing and serialization complexity hotspots #12

Closed
opened 2026-07-13 20:11:32 +02:00 by zemion · 1 comment
Owner

Xenon flags vCard parsing/serialization above the configured complexity threshold.

Source report: /mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949/xenon.txt

Observed hotspots:

  • src/govoplan_addresses/backend/vcard.py:185 _parse_card rank F
  • src/govoplan_addresses/backend/vcard.py:318 contact_to_vcard rank D

Acceptance criteria:

  • Split line/property parsing and serialization into focused helpers.
  • Preserve vCard compatibility tests.
  • Add fixtures for edge cases before changing parsing behavior.
<!-- codex-security-audit-fingerprint:security-audit-20260713-addresses-vcard-complexity --> Xenon flags vCard parsing/serialization above the configured complexity threshold. Source report: `/mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949/xenon.txt` Observed hotspots: - `src/govoplan_addresses/backend/vcard.py:185 _parse_card` rank F - `src/govoplan_addresses/backend/vcard.py:318 contact_to_vcard` rank D Acceptance criteria: - Split line/property parsing and serialization into focused helpers. - Preserve vCard compatibility tests. - Add fixtures for edge cases before changing parsing behavior.
Author
Owner

Codex State: done

Summary

  • Refactored vCard parsing and serialization into smaller draft/apply/emit helpers.

Changed Files

  • Split _parse_card into line parsing, metadata, identity, contact detail, email/phone/address, payload, and identity-check helpers; split contact_to_vcard into identity, email, phone, address, note/tag, and URL emit helpers; added direct vCard fixture tests for folded lines and escaped text.

Verification

  • py_compile for vcard.py and tests/test_vcard.py; git diff --check for touched files; PYTHONPATH=/mnt/DATA/git/govoplan-addresses/src:/mnt/DATA/git/govoplan-core/src python -m unittest tests.test_vcard tests.test_addresses_service (7 tests OK).

Next / Blocked

  • Local xenon/radon are not installed in this environment; rerun the full audit battery after rebuild to confirm the complexity rank is below threshold.
## Codex State: done ### Summary - Refactored vCard parsing and serialization into smaller draft/apply/emit helpers. ### Changed Files - `Split _parse_card into line parsing, metadata, identity, contact detail, email/phone/address, payload, and identity-check helpers; split contact_to_vcard into identity, email, phone, address, note/tag, and URL emit helpers; added direct vCard fixture tests for folded lines and escaped text.` ### Verification - `py_compile for vcard.py and tests/test_vcard.py; git diff --check for touched files; PYTHONPATH=/mnt/DATA/git/govoplan-addresses/src:/mnt/DATA/git/govoplan-core/src python -m unittest tests.test_vcard tests.test_addresses_service (7 tests OK).` ### Next / Blocked - Local xenon/radon are not installed in this environment; rerun the full audit battery after rebuild to confirm the complexity rank is below threshold.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-addresses#12
No description provided.