digdir / dialogporten

Dialogporten - common API and and metadata state store for digital dialogs
https://docs.altinn.studio/dialogporten
MIT License
1 stars 3 forks source link

Handle masking of personal identifiers in enduser-API #988

Open elsand opened 3 months ago

elsand commented 3 months ago

Introduction

This introduces a masking of all personal identifiers used in the end user models as well as supporting masked versions as input parameters already supporting personal identifiers today

Description

The party and actorId fields in the API both use a urn:altinn:person: namespaced identifier, available in both the parties and dialog search/details APIs. Pids (personal identifiers) are PII and require special consideration as they are sometimes used as authenticators (outside Altinn). In Altinn 2, all outputted PIDs are masked, and partyIds (numerical) are used as the primary key.

Dialogporten will not employ partyIds, as that will constrain the possible users to norwegian persons or businesses. Instead we need a system/register agnostic mapping between a masked and unmasked ID in order to support any kind of identifier later (wallet-ids, EIDAS ids etc).

The masked version of a pid will have to be stable per environment (as with Altinn 2 partyIds). A simple encrypt/decrypt approach will run the risk of exposing pids if the key is lost, or break user experiences (eg. stored search queries/fileter) if the key is rotated.

Implementation

### Tasks
- [ ] Add table and migration
- [ ] Add population/generation mechanism
- [ ] Add handling of masked pids as input parameters in end-user APIs (map/join to unmasked)
- [ ] Add masking to pids in output DTOs in end-user APIs (replacing "ephemeral" pids)
- [ ] Add masking to events
- [ ] Prepare documentation (if relevant - either update working document, or add a new file in `docs`)
- [ ] Add e2e-test (if relevant)
### Threat modelling
- [x] Does this change introduce any potential security issues? No, this closes a concern about pids being exposed to end users.
elsand commented 2 months ago

Just noting here that this feature is an ongoing discussion with legal/security, which hopefully will be resolved well within the upcoming sprint. Until then, we're blocking this.