Skip to content

present-proof v2 (DIF) crashes when input_descriptor.schema is omitted (NoneType uri_groups) #4006

@nodlesh

Description

@nodlesh

ACA‑Py throws a 500 when creating a DIF presentation if the request’s input_descriptors omit schema (schema is optional per Presentation Exchange). The handler dereferences schemas.uri_groups when schemas is None, causing a crash. This blocks send-presentation even when a matching credential is selected by record id.

Environment:

  • ACA‑Py version: 1.4.0 (from /status)
  • Protocol: present-proof v2.0
  • Format: DIF Presentation Exchange
  • LDP VC (W3C v2) with Ed25519Signature2020
  • Askar (wallet.type=askar, wallet.storage_type=default).

Steps to Reproduce:

  1. Issue an LDP VC to the holder.
  2. Verifier sends a v2 proof request with DIF definition without schema in input_descriptors (constraints only):
{
  "presentation_definition": {
    "name": "Ayra Business Card LDP",
    "format": { "ldp_vp": { "proof_type": ["Ed25519Signature2020"] } },
    "input_descriptors": [
      {
        "id": "ayra-business-card",
        "purpose": "Must be an Ayra Business Card with Ed25519Signature2020",
        "constraints": {
          "fields": [
            { "path": ["$.type","$.vc.type","$.credential.type"], "filter": { "type": "array", "contains": { "const": "AyraBusinessCard" } } },
            { "path": ["$.proof.type","$.proof[0].type"], "filter": { "type": "string", "const": "Ed25519Signature2020" } }
          ]
        }
      }
    ]
  }
}
  1. Holder calls:
    • GET /present-proof-2.0/records/{pres_ex_id}/credentials (returns candidates)

    • POST /present-proof-2.0/records/{pres_ex_id}/send-presentation with record IDs:

      { "auto_remove": false, "dif": { "record_ids": { "ayra-business-card": ["<record_id>"] } } }

Expected:
ACA‑Py should treat missing schema as “no schema filter” and proceed with constraint matching, or at least return a validation error, not crash.

Actual:
send-presentation returns 500, stack trace shows null dereference:
AttributeError: 'NoneType' object has no attribute 'uri_groups' File ".../present_proof/dif/pres_exch_handler.py", line 1014, in filter_schema credential=credential, filter=schemas.uri_groups

Logs (from our run):

  • Request payload shows input_descriptors without schema:presentation_definition ... input_descriptors ... constraints ...
  • Crash + 500:
    • AttributeError: 'NoneType' object has no attribute 'uri_groups'
    • POST /present-proof-2.0/records//send-presentation → 500

Notes:

  • This looks like a null‑check bug in filter_schema when schemas is absent.
  • Presentation Exchange allows schema omission; constraints alone should be valid.
  • With schema present, the handler does not crash (different issue: schema mismatch).

Workaround (not yet confirmed): include a schema array in each input_descriptor (e.g., W3C VC v2 + Ayra context) so filter_schema has non‑null data.
A safe workaround may also be contained in #3441

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