Skip to content

feat(xmldsig): URI dereference for Reference elements #8

@polaz

Description

@polaz

Summary

Implement same-document URI resolution for XMLDSig <Reference> elements:

  • Empty URI ("") → entire document without comments
  • Bare-name #id → element subtree by ID attribute
  • #xpointer(/) → document root with comments
  • #xpointer(id('...')) → element subtree by ID (XPointer form)
  • ID attribute registration (ID, Id, id + custom names)

Technical Details

  • UriReferenceResolver builds a HashMap<&str, Node> index on construction for O(1) lookups
  • NodeSet type tracks included/excluded nodes with subtree exclusion support
  • TransformData enum (NodeSet / Binary) for the transform pipeline
  • Integration tested: URI dereference → NodeSet → C14N canonicalization end-to-end

Test Plan

  • 19 unit tests covering all URI forms, error cases, edge cases (duplicate IDs, custom attrs, SAML-like docs)
  • 11 integration tests verifying URI → NodeSet → C14N pipeline produces correct canonical output
  • Includes SAML-specific scenarios (assertion subtree, enveloped signature exclusion)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions