-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(dr): Add DR about empty assetSelector validator (#1774)
* docs(dr): Add DR about empty assetSelector validator * review suggestions
- Loading branch information
1 parent
4e15162
commit a8823f6
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...evelopment/decision-records/2025-01-30-empty-asset-selector-validator/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Add Validator to Block Contract Definitions with Empty Asset Selector | ||
|
||
## Decision | ||
|
||
Tractusx-edc will provide a feature that allows blocking the creation or update of contract definitions to contain | ||
an empty asset selector. This feature will have the option to be switched on/off, being off the default state. | ||
|
||
## Rationale | ||
|
||
The `assetsSelector` property is a query (similar to a SQL SELECT statement) that returns a set of assets the | ||
contract definition applies to. When left empty, the default behavior of the connector is to apply the contract | ||
definition to all registered assets. | ||
|
||
Unwillingly, mostly due to lack of proper connector usage knowledge, users might expose datasets that shouldn't be | ||
exposed. | ||
|
||
As changing the default behavior of the `assetSelector` is not an option - it is as such by design - preventing | ||
such exposure can be achieved by applying the following approach. | ||
|
||
## Approach | ||
|
||
- Provide an extension that registers in the `JsonObjectValidatorRegistry` a new `JsonObjectValidator` for the | ||
`https://w3id.org/edc/v0.0.1/ns/ContractDefinition` type. This validator should replace the one provided by default | ||
by the contract definitions api. | ||
- The registration of the new `JsonObjectValidator` should be conditioned to setting the connector configuration | ||
`tx.edc.validator.contractdefinitions.block-empty-assets-selector=true` | ||
- Implement the new `JsonObjectValidator` which should behave similarly to the existing | ||
`ContractDefinitionValidator` except it should fail the validation in case the creation/update of a contract | ||
definition introduces an empty `assetSelector` properties and the mentioned new toggle is enabled. | ||
|
||
|