-
-
Notifications
You must be signed in to change notification settings - Fork 33k
gh-139478: Add warning about lack of validation for xml.sax.saxutils.XMLGenerator
#139479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d1e4e12
87080f7
e845206
4b4c15a
cbe0c12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,11 @@ or as base classes. | |
content: if ``False`` (the default) they are emitted as a pair of start/end | ||
tags, if set to ``True`` they are emitted as a single self-closed tag. | ||
|
||
.. note:: | ||
:class:`!XMLGenerator` is only intended to be used as a ``handler`` | ||
with SAX parser functions from the :mod:`!xml.sax` module. Using XMLGenerator | ||
on untrusted user inputs is not the intended use. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "is only intended to be used": Ok, but what are the consequences if the class is misused? It's unclear to me what are the risks.
Comment on lines
+75
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this form it simply reiterates what was said in the previous paragraph. Even if this was not intended, people use XMLGenerator for generating XML. If it worked for them, it is fine. They should be aware about pitfalls. But I suggest adding such notes/warnings in other places that are used to generate XML first or simultaneously with XMLGenerator. They all should use unified wording. We can keep a short reminder that this is not intended use of XMLGenerator, the rest of the note should be similar to other notes. I propose also to add helpers to validate names (#139489). Since this is a new feature, we cannot refer it the documentation changes that will be backported, but keep in mind that we can add references later. |
||
|
||
.. versionchanged:: 3.2 | ||
Added the *short_empty_elements* parameter. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
:mod:`xml.sax.saxutils`: Add warning about lack of | ||
validation for :class:`~xml.sax.saxutils.XMLGenerator`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.