Remove unexpected control codes from ICS files #1537
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We are running Radicale 3.2.2 as packaged in Debian trixie (Debian package version 3.2.2-1). We have approximately 100 users mostly using Thunderbird.
We have run into a problem where users sometimes upload ICS files that are corrupted. They contain unexpected control codes (ie characters with codepoints below 32 that are not tab, carriage return or line feed). Radicale seems to accept these ICS files and store them verbatim on disk, then later return them to the client software. This leads to Thunderbird refusing to accept the XML that Radicale produces in a 207 Multi-Status response, with Thunderbird giving an "XML Parsing Error: not well-formed" error. Because there are multiple events in a single response a single malformed event can result in a number of well-formed events being effectively ignored by the client software.
We have developed the attached patch which strips out all unexpected control codes from ingested ICS files. When a corrupted ICS file is presented to Radicale by the client software it is fixed on ingest and before any further processing, including storing on disk. This has fixed the problem for us.
I don't believe the scrubbing performed here should negatively affect any well-formed file since they should never contain the control codes that the scrubbing removes.