Skip to content

Commit cac1c8d

Browse files
authored
Remove all reference XML data if any are corrupted (#502)
(cherry picked from commit 9c1dc5a)
1 parent 5c96990 commit cac1c8d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/signed-xml.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,11 @@ export class SignedXml {
323323
valid(ated). Put simply: if one fails, they are all not trustworthy.
324324
*/
325325
this.signedReferences = [];
326+
this.references.forEach((ref) => {
327+
ref.signedReference = undefined;
328+
});
326329
// TODO: add this breaking change here later on for even more security: `this.references = [];`
330+
327331
if (callback) {
328332
callback(new Error("Could not validate all references"), false);
329333
return;
@@ -358,6 +362,9 @@ export class SignedXml {
358362
// but that may cause some breaking changes, so we'll handle that in v7.x.
359363
// If we were validating `signedInfoCanon` first, we wouldn't have to reset this array.
360364
this.signedReferences = [];
365+
this.references.forEach((ref) => {
366+
ref.signedReference = undefined;
367+
});
361368
// TODO: add this breaking change here later on for even more security: `this.references = [];`
362369

363370
if (callback) {

0 commit comments

Comments
 (0)