reject CR and LF in vUri, vCalAddress and vInline values#1468
Conversation
|
@alhudz please see my comment regarding the treatment of a lone |
|
Yes, I think, it is good to put our heads together in an issue that lists the way to go forward and also all the places that need touching. That is to keep a record of the decisions. This is a really good find. We should give it proper attention and the documentation that it needs, so we can be sure people will understand the code and decisions in the years to come. Thank @alhudz would you like to open the issue? As a maintainer, I would chip in and do some edits, with a checklist of what I would like to see done to really assure this is thoroughly handled everywhere. Right now, splitting decision making across PRs calls in inconsistency over the long term. Thanks for the work so far! Note: For documentation:
TODO:
@alhudz You see, the issue is quite big and also, to solve this you do not need to do all the work. Could you open an issue to start us off? |
|
Opened #1471 to gather the line-break treatment in one place, with the RFC quotes, the affected paths and a checklist to start from. Left the structure loose so you can drop in the items you want tracked. Happy to hold off on further lone |
Description
vUri,vCalAddressandvInlinearestrsubclasses whoseto_ical()writes the value verbatim, with none of the escapingvTextapplies. A value carrying a lone\rtherefore lands raw in the content line, where the only guard isContentline.__new__'sassert "\n" not in value, which never looks at\r. Consumers that treat a bare CR as a line break read the tail as a separate property.repro:Calendar.from_jcal([..., ["url", {}, "uri", "http://e.com/a\rX-EVIL:1"], ...]).to_ical()expected: the malformed value is rejectedactual: the output containsURL:http://e.com/a\rX-EVIL:1, an injectedX-EVILcontent line on a bare-CR consumerThese value types cannot encode a newline the way
TEXTdoes, so the guard rejects rawCR/LFin__new__rather than escaping.vXmlReferenceinherits the check fromvUri.Checklist
/news, following the instructions in Change log entry format.📚 Documentation preview 📚: https://icalendar--1468.org.readthedocs.build/en/1468/