-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add idempotency field #1573
Comments
## Description Added IdempotentId based on self-defined id and org name ## Related Issue(s) #1573 ## Verification - [x] **Your** code builds clean without any errors or warnings - [x] Manual testing done (required) - [x] Relevant automated test added (if you find this hard, leave it and we'll help out) ## Documentation - [ ] Documentation is updated (either in `docs`-directory, Altinnpedia or a separate linked PR in [altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if applicable) --------- Co-authored-by: Magnus Sandgren <[email protected]> Co-authored-by: Ole Jørgen Skogstad <[email protected]>
TestFørste kriterie : Det finnes ingen tidligere dialog med nøkkelenInput 🟢 det dannes dialog med de nye feltet angitt i POST 🔴 feltet returneres ikke med GET Er den case sensitiv på stor K? Første kriterie : Samme nøkkel kan ikke benyttes flere ganger🔴 Kan trykke Send om og om igjen i postman med samme nøkkel. Her er det noe feil:
Denne er ikke klar fort test og må vente
Dokumentasjonen bør oppdateresUsikkerheten på om "idempotentkey" er rett feltnavn kommer mye av at feltet ikke er nevnt i dokumentasjonen https://docs.altinn.studio/dialogporten/reference/entities/dialog/ |
TestNå på releaset versjon 1.50.1 Kriterie 1Oppretter dialog 0194f42d-5e68-7756-98e6-65667144f1de Gjør get single dilaog Kriterie 2Gjør en ny post create dialog der samme .json gjenbrukes Kriterie 3Angir alt for lag idempotentkey Grenseverdi test🟢 37 tegn 🟢 36 tegn |
Introduction
This introduces an independent idempotency mechanism as a field on the dialog entity
Description
See initial discussion in #1191
This will allow service providers to attempt to create dialogs supplying a custom idempotency key in the request body. This will have to be unique per org (ie serviceowner code). The field should only be visible on service owner DTOs (for create and get details). If attempting to create a dialog which collides on this field, an error should be returned. This error should also indicate the id of the existing/conflicting dialog.
Implementation
For performance reasons, we should avoid having to manually check whether the org/key already exists prior to database insertion. Instead, consider creating a composite unique key over "org" and the new field for idempotency key, and handle the constraint error instead.
Tasks
Threat modelling
Threats
This introduces a mechanism in which it is possible for any system to determine if a dialog exists, if the format/business rules for the utilized idempotency keys are known and predictable. This is mostly mitigated by having this unique per org. Trust boundaries will however eventually be set per system within an org (see #40), so documentation should mention this and suggest to consider using non-predictable idempotency keys (ie peppered hashes) if systems within an org does not trust each other to leak the existance of dialogs to eachother.
Acceptance criteria
GIVEN a service owner DTO with a valid idempotency key and no existing dialog with the same idempotency key for the same org
WHEN a dialog is created
THEN the dialog is successfully created, and the idempotency key is stored in the database
GIVEN a service owner DTO with a valid idempotency key that matches an existing dialog's idempotency key for the same org
WHEN a dialog creation is attempted
THEN the service returns an error indicating a conflict, including the ID of the existing dialog
GIVEN a service owner DTO with an invalid idempotency key (e.g., exceeding maximum length or malformed)
WHEN a dialog creation is attempted
THEN the service returns a validation error indicating the issue
The text was updated successfully, but these errors were encountered: