Skip to content
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

Policy imports #1555

Merged
merged 62 commits into from
Dec 16, 2022
Merged

Conversation

kalinkostashki
Copy link
Contributor

@kalinkostashki kalinkostashki commented Dec 15, 2022

Enables the imports of policies.
One policy would now be able to import other policies(this isn't transitive).
The maximum number of imported policies is also configurable. Currently set to 10.

Resolves: #298

thjaeckle and others added 30 commits August 12, 2022 16:31
…ctoring - preserved via former PoCs and contributions on that topic

Co-authored-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Co-authored-by: Dirk Van Haerenborgh <dirk.vanhaerenborgh@aloxy.io>
Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
… allow more differentiated options (implicit, explicit, never). Simplify included/excluded notation from policy imports and expect only a list of (included) policy entries. Adapt PolicyImporter accordingly.

Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
…cyImporterTest.

Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
…y (the limits changed a bit after recent modifications)

Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Yannic Buergmann <yannic.buergmann@bosch.io>
…t with other methods

Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Yannic Buergmann <yannic.buergmann@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
…licy

Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Yannic Buergmann <yannic.buergmann@bosch.io>
…ange

* This change indicates a semantic change of the policy and should lead
  to cache invalidation

Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Yannic Buergmann <yannic.buergmann@bosch.io>
…mports but instead default to an empty PolicyImports instance if no imports are defined and always return a non-null instance

Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
* TODO: think about making PolicyEnforcerProvider and PolicyCacheLoader
  an akka extension in order to make it a singleton

Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Yannic Buergmann <yannic.buergmann@bosch.io>
* Only exception is the search, where the cache loader is instantiated
  differently

Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Yannic Buergmann <yannic.buergmann@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Yannic Buergmann <yannic.buergmann@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Yannic Buergmann <yannic.buergmann@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
for the search index

Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Yannic Buergmann <yannic.buergmann@bosch.io>
… policy changes

Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Yannic Buergmann <yannic.buergmann@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Yannic Buergmann <yannic.buergmann@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
* The query in MongoThingsSearchUpdaterPersistence wasn't correct because
  the "id" field was extracted from the JSON pointer which appended a leading
  slash
* We need to remember deleted but still imported policies otherwise the
  search index is not updated when the imported policy is recreated
* Imported policies need to be taken into account when checking if a
  write model is outdated
* The Metadata built by the ThingUpdater needs to preserve the thingPolicy
  aswell as the referenced policy tags

Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Yannic Buergmann <yannic.buergmann@bosch.io>
dguggemos and others added 19 commits October 11, 2022 15:12
… but return an error instead (default is still implicit, if value is not provided)

Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
…or an imported entry allows WRITE on policy root resource"

This reverts commit 92f7ac5.
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Co-authored-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
 - created a custom PolicyImportsTooLargeException in order to facilitate sending of correct error response to user
 - small typos and fixes as needed
 - made the policy imports limit configurable in ditto-limits.conf

Signed-off-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Signed-off-by: Dominik Guggemos <dominik.guggemos@bosch.io>
Signed-off-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Kalin Kostashki <kalin.kostashki@bosch.io>
 - result.accept called explicitly to for ModifyPolicyImports to run and throw the required exception.

Signed-off-by: Kalin Kostashki <kalin.kostashki@bosch.io>
Signed-off-by: Kalin Kostashki <kalin.kostashki@bosch.io>
# Conflicts:
#	internal/utils/persistent-actors/src/main/java/org/eclipse/ditto/internal/utils/persistentactors/AbstractPersistenceActor.java
#	policies/service/src/main/java/org/eclipse/ditto/policies/service/persistence/actors/PolicySupervisorActor.java
#	policies/service/src/test/java/org/eclipse/ditto/policies/service/persistence/actors/PolicyPersistenceOperationsActorIT.java
 - added the PolicyEnforcerProvider

Signed-off-by: Kalin Kostashki <kalin.kostashki@bosch.io>
 - mocked PolicyEnforcer in order to trigger the RetrievePolicy command.

Signed-off-by: Kalin Kostashki <kalin.kostashki@bosch.io>
…-api-2.yml

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
@thjaeckle thjaeckle added this to the 3.1.0 milestone Dec 15, 2022
@thjaeckle thjaeckle changed the title Feature/importing policies Policy imports Dec 15, 2022
@thjaeckle thjaeckle marked this pull request as draft December 15, 2022 16:19
@thjaeckle thjaeckle marked this pull request as ready for review December 15, 2022 16:19
…policies

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Copy link
Member

@thjaeckle thjaeckle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code reviews were done as part of development process by the Ditto team.

Approving on behalf of the Ditto team 👍

@thjaeckle thjaeckle merged commit ca70280 into eclipse-ditto:master Dec 16, 2022
@thjaeckle thjaeckle deleted the feature/importing-policies branch December 16, 2022 05:57
This pull request was closed.
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.

Let policies import other policies to enable re-use when securing things
3 participants