Skip to content

gh-156812: Check structural rules when serializing in xml.dom.minidom - #161830

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:minidom-doctype-quoting
Nov 24, 2026
Merged

serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:minidom-doctype-quoting

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

Only the structure is checked, not the characters.

A comment ending with - was fused with the closing --> into --->.

A processing instruction was not checked at all: ?> in the data silently closed it, and the reserved target xml produced a document which cannot be parsed.

The identifiers of the document type declaration were interpolated into single quotes without checks, so an identifier containing a quote or other illegal character produced XML which is not well-formed, and a public identifier without a system identifier produced the literal None.

…inidom

Only the structure is checked, not the characters.

A comment ending with '-' was fused with the closing '-->' into '--->'.
A processing instruction was not checked at all: '?>' in the data silently
closed it, and the reserved target 'xml' produced a document which cannot
be parsed.  The identifiers of the document type declaration were
interpolated into single quotes without checks, so an identifier containing
a quote or other illegal character produced XML which is not well-formed,
and a public identifier without a system identifier produced the literal
'None'.
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35823570 | 📁 Comparing c4f9ac7 against main (a872024)

  🔍 Preview build  

2 files changed
± library/xml.dom.minidom.html
± whatsnew/changelog.html

@serhiy-storchaka serhiy-storchaka added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 24, 2026
@serhiy-storchaka
serhiy-storchaka merged commit 79494e2 into python:main Nov 24, 2026
62 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@serhiy-storchaka
serhiy-storchaka deleted the minidom-doctype-quoting branch November 24, 2026 16:18
@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.15 due to a conflict.

Please backport manually with cherry_picker, see the devguide for more information.

cherry_picker 79494e2b0f7e9e1cc3a39fe035e67cea33c7ef0a 3.15

@miss-islington-app

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.14 due to a conflict.

Please backport manually with cherry_picker, see the devguide for more information.

cherry_picker 79494e2b0f7e9e1cc3a39fe035e67cea33c7ef0a 3.14

@bedevere-app

bedevere-app Bot commented Nov 26, 2026

Copy link
Copy Markdown

GH-162680 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 26, 2026
@bedevere-app

bedevere-app Bot commented Nov 26, 2026

Copy link
Copy Markdown

GH-162681 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 26, 2026
serhiy-storchaka added a commit that referenced this pull request Nov 26, 2026
…minidom (GH-161830) (GH-162680)

Only the structure is checked, not the characters.

A comment ending with '-' was fused with the closing '-->' into '--->'.
A processing instruction was not checked at all: '?>' in the data silently
closed it, and the reserved target 'xml' produced a document which cannot
be parsed.  The identifiers of the document type declaration were
interpolated into single quotes without checks, so an identifier containing
a quote or other illegal character produced XML which is not well-formed,
and a public identifier without a system identifier produced the literal
'None'.
(cherry picked from commit 79494e2)
serhiy-storchaka added a commit that referenced this pull request Nov 26, 2026
…minidom (GH-161830) (GH-162681)

Only the structure is checked, not the characters.

A comment ending with '-' was fused with the closing '-->' into '--->'.
A processing instruction was not checked at all: '?>' in the data silently
closed it, and the reserved target 'xml' produced a document which cannot
be parsed.  The identifiers of the document type declaration were
interpolated into single quotes without checks, so an identifier containing
a quote or other illegal character produced XML which is not well-formed,
and a public identifier without a system identifier produced the literal
'None'.
(cherry picked from commit 79494e2)
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