Skip to content

Harden XML parsing against invalid tokens (batch 1/4)#785

Merged
abrignoni merged 1 commit into
mainfrom
harden-xml-batch1
Jun 20, 2026
Merged

Harden XML parsing against invalid tokens (batch 1/4)#785
abrignoni merged 1 commit into
mainfrom
harden-xml-batch1

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Follow-up to the settingsSecure invalid-XML fix: applies the same recovery to other converted ET.parse artifacts so a malformed XML file (raw control characters, unescaped &) no longer errors the artifact.

Each file gains a local _parse_xml(file_found) helper that, on ParseError, strips XML-1.0-invalid control chars, escapes bare ampersands, and re-parses; if still unparseable it logs and returns an empty element (so the artifact yields no rows for that file instead of crashing).

Batch 1 (7 prefs/settings XML parsers): gmail, kijijiLocalUserInfo, usageHistory, atrackerdetect, ulrUserprefs, suggestions, setupWizardinfo.

Tested: each _parse_xml recovers a file containing a control char + bare ampersand (returns the real root), parses normal files unchanged, no recursion, loader builds (417), pylint clean. More batches to follow for the remaining ET.parse artifacts.

@abrignoni abrignoni merged commit a5c9d2b into main Jun 20, 2026
1 check passed
@abrignoni abrignoni deleted the harden-xml-batch1 branch June 20, 2026 20:23
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.

1 participant