<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<br>
<div class="moz-cite-prefix">On 2/4/16 4:04 AM,
<a class="moz-txt-link-abbreviated" href="mailto:detelinyordanov@gmail.com">detelinyordanov@gmail.com</a> wrote:<br>
</div>
<blockquote
cite="mid:CAEu2FROKFYjLBt_Ubq8YtaD_x1sFRjYLARSneEOu+Usdpr2O+A@mail.gmail.com"
type="cite">
<div dir="ltr">
<div> I have encountered an issue in Opensaml when marshalling
an existing SAML assertion into a newly created empty
Document. Apparently
AbstractXMLObjectMarshaller.marshall(assertion, Document) uses
Document.adoptNode() followed by Document.appendNode(..) but
neither of these preserve the IDness of the assertion and if
Document.getElementById(assertionId) is used on the resulting
document, it returns null.<br>
</div>
</div>
</blockquote>
<br>
This sounded familiar. I went and looked and someone encountered a
similar issue back in April 2012, discussed on this list.<br>
<br>
<br>
<blockquote
cite="mid:CAEu2FROKFYjLBt_Ubq8YtaD_x1sFRjYLARSneEOu+Usdpr2O+A@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>but then I noticed it is reproducible with Xerces as well
and I saw that Xerces folks do not consider this a bug in
Xerces DOM implementation - they argue that according to spec,
the adoptNode() is not required to preserve the ID attributes,
see <a moz-do-not-send="true"
href="https://issues.apache.org/jira/browse/XERCESJ-1022">XERCESJ-1022</a>
and respective discussion: <a moz-do-not-send="true"
href="https://mail-archives.apache.org/mod_mbox/xerces-j-users/200701.mbox/%3C20070125062002.01E3310FB003@herse.apache.org%3E">importNode()/adoptNode()
and getElementById()</a><br>
</div>
</div>
</blockquote>
<br>
Yep, I came across XERCESJ-1022 back in 2012. Sadly that seems to
be the official answer.<br>
<br>
<br>
<blockquote
cite="mid:CAEu2FROKFYjLBt_Ubq8YtaD_x1sFRjYLARSneEOu+Usdpr2O+A@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
<div>Does this mean that this is a bug in Opensaml/Xmltooling</div>
</div>
</blockquote>
<br>
Yes, I think it is a bug. I don't know why an issue was never
opened in 2012, but it wasn't and so we never really looked at
fixing this. Please open a bug against the v3 project (OSJ).<br>
<br>
As luck (or lack thereof) would have it, we literally just yesterday
released the last non-security patch release of the v2 project (JOST
in Jira), prior to its full EOL in July. So there wouldn't be any
plans to release it for v2. Unless there were some security
vulnerability aspect to this, but off-hand I don't see any. <br>
<br>
<blockquote
cite="mid:CAEu2FROKFYjLBt_Ubq8YtaD_x1sFRjYLARSneEOu+Usdpr2O+A@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>and Xmltooling node adoption code is required to ensure the
ID attributes are preserved when marshalling into a new
Document?<br>
</div>
</div>
</blockquote>
<br>
Aside from the fix in OpenSAML itself: Yes, after marshaling an
existing XMObject, you would reset the IDness the same way the
marshallers do it. For example, the AssertionMarshaller does this:<br>
<br>
<tt>domElement.setIdAttributeNS(null, Assertion.ID_ATTRIB_NAME,
true);</tt><br>
<br>
<br>
The fix in OpenSAML is likely to involve moving these
setIdAttributeNS(...) calls out of the marshallAttributes(...)
methods (which only get called when there is no existing DOM), and
into a new one like marshallAttributeIDNess(...). Then the latter
gets called in both the new DOM and existing DOM cases. Or
something like that. Doesn't look too bad to fix.<br>
</body>
</html>