Skip to content

fix: build privSignKey from actually disclosed optional attributes#68

Open
rubenhensen wants to merge 12 commits intomainfrom
fix/issue-28-optional-attrs
Open

fix: build privSignKey from actually disclosed optional attributes#68
rubenhensen wants to merge 12 commits intomainfrom
fix/issue-28-optional-attrs

Conversation

@rubenhensen
Copy link
Contributor

Summary

  • Fix the signing_key handler to filter disclosed attributes by type only (previously compared Attribute{value=None} against Attribute{value=Some("")}, which always produced an empty priv_con and was therefore never building a private signing key with optional attributes)
  • Return privSignKey=None when no optional attributes were disclosed, rather than returning a key with an empty policy

Context

The PKG's /v2/request/start already requests optional attributes (phone, name, date of birth) as optional disjunctions in every signing session. The user can choose to disclose them in the Yivi app. When the client calls /v2/irma/sign/key, it now passes privSignId with all optional attribute types. The PKG filters con (all disclosed attributes from the Yivi proof) against privSignId to build the private signing key.

The bug was that the filter used priv_sign_id.contains(&Attribute::new(&a.atype, None)), but priv_sign_id entries were deserialized with value=Some("") (from JSON v: ""), so value=None != value=Some("") and the filter always returned empty.

Closes encryption4all/postguard-website#28

Email is now required; mobile phone, full name, and date of birth are
optional. Attributes are no longer taken from the frontend request.
The priv_sign_id path is not used in the current flow, so the defensive
empty-check and return type changes were unnecessary.
….com:encryption4all/postguard into postguard-website/fix/design-feedback-issues
Replace single multi-platform job (QEMU, ~93 min) with parallel native
runner jobs that merge into a multi-arch manifest. Separate GHA cache
scopes per architecture prevent cross-contamination.
In the decryption flow the PKG was ignoring kr.con entirely and
presenting a hardcoded optional disclosure (email + phone/name/DOB),
so recipients were never asked to disclose the attributes they were
actually encrypted with.

Distinguish two modes in start.rs:
- Decryption flow (kr.con contains non-email attributes): build a
  mandatory disclosure from all attributes in kr.con so the Yivi
  session requires the exact combination used during encryption.
- Signing flow (email-only): keep the original optional extras
  behaviour so senders can choose which additional attributes to
  include in their signing identity.

Also add a debug log in key.rs that prints the timestamp and all
attributes used when deriving a USK, to aid future diagnostics.
Change the filter to compare attribute types only (previously compared
Attribute{atype, value=None} against deserialized Attribute{atype,
value=Some("")}, which always returned empty). Also return privSignKey=None
when no optional attributes were disclosed rather than an empty-policy key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show optional sender attributes in email and download flow

1 participant