Skip to content

A Transform without an Algorithm attribute is skipped instead of rejected #622

Description

@cjbarth

Problem

loadReference skips a Transform element that has no Algorithm attribute instead of rejecting it (src/signed-xml.ts#L767-L773):

const transformAttr = utils.findAttr(transform, "Algorithm");

if (transformAttr) {
  transforms.push(transformAttr.value);
}

The XMLDSig schema makes the attribute required (§4.4.3.4):

<complexType name="TransformType" mixed="true">
  ...
  <attribute name="Algorithm" type="anyURI" use="required"/>
</complexType>

A DigestMethod without Algorithm already throws could not find Algorithm attribute in node .... A Transform without it names a step that cannot be identified, and verifying as though the element were absent digests something the signer never described.

On 6.3.2, a signature whose SignedInfo contains <Transforms><Transform/><Transform Algorithm="...enveloped-signature"/><Transform Algorithm="...xml-exc-c14n#"/></Transforms>, signed over that SignedInfo, passes checkSignature(). The loaded reference lists only the two transforms that have an Algorithm.

The element is inside SignedInfo, so only the signer can produce it. This is a conformance problem, not a bypass.

Proposal

Throw, as for DigestMethod. That rejects documents that verify today, so it belongs in 7.0.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions