Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/signed-xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,9 @@ export class SignedXml {

/* eslint-disable-next-line deprecation/deprecation */
for (const ref of this.getReferences()) {
if (ref.signedReference === undefined) {
continue;
}
const uri = ref.uri?.[0] === "#" ? ref.uri.substring(1) : ref.uri;

for (const attr of this.idAttributes) {
Expand Down Expand Up @@ -570,12 +573,12 @@ export class SignedXml {

ref.getValidatedNode = deprecate((xpathSelector?: string) => {
xpathSelector = xpathSelector || ref.xpath;
if (typeof xpathSelector !== "string" || ref.validationError != null) {
if (typeof xpathSelector !== "string" || ref.signedReference === undefined) {
return null;
}
const selectedValue = xpath.select1(xpathSelector, doc);
return isDomNode.isNodeLike(selectedValue) ? selectedValue : null;
}, "`ref.getValidatedNode()` is deprecated and insecure. Use `ref.signedReference` or `this.getSignedReferences()` instead.");
}, "`ref.getValidatedNode()` is deprecated and insecure. Use `getSignedReferences()` instead.");

if (!isDomNode.isNodeLike(elem)) {
const validationError = new Error(
Expand Down