Skip to content

Commit 2d8a54d

Browse files
committed
Deprecate excise_empty_xmlns_declarations
1 parent 4b034b3 commit 2d8a54d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

signxml/processor.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import warnings
23
from typing import Any, List, Tuple
34
from xml.etree import ElementTree as stdlibElementTree
45

@@ -128,9 +129,14 @@ def _c14n(self, nodes, algorithm: CanonicalizationMethod, inclusive_ns_prefixes=
128129
inclusive_ns_prefixes=inclusive_ns_prefixes,
129130
)
130131
if exclusive is False and self.excise_empty_xmlns_declarations is True:
131-
# TODO: there must be a nicer way to do this. See also:
132-
# http://www.w3.org/TR/xml-c14n, "namespace axis"
133-
# http://www.w3.org/TR/xml-c14n2/#sec-Namespace-Processing
132+
warnings.warn(
133+
"excise_empty_xmlns_declarations is deprecated and will be removed in a future SignXML release",
134+
DeprecationWarning,
135+
)
136+
# Incorrect legacy behavior. See also:
137+
# - https://github.com/XML-Security/signxml/issues/193
138+
# - http://www.w3.org/TR/xml-c14n, "namespace axis"
139+
# - http://www.w3.org/TR/xml-c14n2/#sec-Namespace-Processing
134140
c14n = c14n.replace(b' xmlns=""', b"")
135141
return c14n
136142

0 commit comments

Comments
 (0)