Skip to content

fix: filter empty attribute values in Yivi disclosure session#72

Merged
rubenhensen merged 5 commits intomainfrom
fix/enforce-attribute-value-in-yivi-session
Mar 20, 2026
Merged

fix: filter empty attribute values in Yivi disclosure session#72
rubenhensen merged 5 commits intomainfrom
fix/enforce-attribute-value-in-yivi-session

Conversation

@rubenhensen
Copy link
Contributor

@rubenhensen rubenhensen commented Mar 19, 2026

Summary

When decrypting an email using postguard website. We know the public sign, which is the email. We can thus force the yivi app to only show that specific attribute. This reduces the chance of decrypting with the wrong attribute.

  • The encrypted file header stores a hidden policy where non-hint-type attribute values (e.g. email) are replaced with an empty string ""
  • Previously, attr.value.clone() would forward this empty string to Yivi, causing it to require an attribute with an empty value — which no credential satisfies
  • This PR adds .filter(|v| !v.is_empty()) so that only non-empty values are enforced in the Yivi session request

The frontend (postguard-website) is responsible for reconstructing the actual email value (from the publicly known map key) before sending the key request to the PKG. This filter ensures that hint-type attributes with masked values (e.g. "12345****") and hidden attributes with empty strings are treated as unconstrained (None) in Yivi.

Test plan

  • Encrypt a file to a specific email address
  • On the download page, verify that the Yivi QR only accepts the exact email used during encryption
  • Verify that hint-type attributes (mobile number, surfnet ID) still accept any value

The hidden policy stored in the encrypted file header has empty string
values for non-hint-type attributes (e.g. email becomes ""). Without
filtering, these empty values would be forwarded to Yivi, causing it to
require an empty attribute value — which no credential has.

Filter out empty strings so that only non-empty values (i.e. values
explicitly set by the frontend for public attributes) are enforced.
create_irma_session was incorrectly modified to reference variables not
in its scope. Restore its original structure and apply the attribute
value filtering in start where the request data is available.
@rubenhensen rubenhensen merged commit c732eab into main Mar 20, 2026
15 checks passed
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.

1 participant