Altinn / altinn-events

Altinn platform microservice for handling events
MIT License
1 stars 2 forks source link

Automatically delete invalid subscriptions #15

Open SandGrainOne opened 2 years ago

SandGrainOne commented 2 years ago

Blocked by

We created an issue to start collecting better insight into this so that we can better evaluate whether we need a feature like this: #602

Description

An invalid subscription is a subscription where the subscriber no longer have access to the related data. Rights and roles changes for different reasons all the time. The Events component should regularily verify that the subscriber still have the necessary rights to access the data.

Subscriptions that never push any events still have a performance cost and over time they might become the majority of subscriptions unless there is a mechanism to delete them.

Additional Information

The idea is to have an Azure function scheduled to run once a day. The logic should perform an authorization check to see if the subscriber still have read access to the data in question. If the result is negative, the function would proceed to delete the subscription.

Possible implementations

  1. Scheduled authorization check This would be an increasingly large job as the number of valid subscriptions continue to grow.
  2. Delete on during push if authorisation fails during push This might not cover all cases, subscriptions might never be tested if they never "trigger.
  3. Register message to a Kafka Topic if authorisation fails during push Almost identical to the point above, but most of the job is done asyncronously.
SandGrainOne commented 2 years ago

@OddArneSaetervik Før vi bruker noe tid på å refine denne ønsker vi avklaring på hvorvidt det er greit å bare slette abonnementer. Burde det gis en beskjed til eier av abonnementet om at det er slettet eller skal det være en slags "grace period" hvor vi beholder abonnementet, men ekskluderer det fra push logikken.