Howdy,
Just found a potential XXE vulnerability on rhino as show below, it seems function toXml didn't add any protection from XXE vulnerability when parsing XML document.
https://github.com/mozilla/rhino/blob/master/xmlimplsrc/org/mozilla/javascript/xmlimpl/XmlProcessor.java#L225
You may need to follow the OWASP guide below which provides concise information to prevent this vulnerability.
https://www.owasp.org/index.php/XML_External_Entity_(XXE)_Prevention_Cheat_Sheet#Java
Thanks,
Brian