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

Add option to enforce validation based on referenced WoT model #1650

Open
thjaeckle opened this issue Jun 10, 2023 · 2 comments · May be fixed by #1936
Open

Add option to enforce validation based on referenced WoT model #1650

thjaeckle opened this issue Jun 10, 2023 · 2 comments · May be fixed by #1936
Assignees
Labels
WoT Web of Things related enhancements
Milestone

Comments

@thjaeckle
Copy link
Member

thjaeckle commented Jun 10, 2023

Currently, Ditto's WoT Integration does not ensure/enforce the referenced model.

As the reference implementation, Eclipse Thingweb did also not do that we thought that would be a common practice to move validation to eg producers of messages.

In practice I now see that an enforcement of the model by Ditto would have great benefits and is the best place to add validation.
This would eg ensure that different API consumers always modify a thing only in the intended and modeled way.

That would be especially important if the Ditto managed twin is used in an Event driven system, where changes of the twin state is reacted to by eg issuing a command downlink to an actual device (using "desired properties" approach).

This issue should track:

  • new config option to enable wot validation
  • implementation and making configurable all of the below:
    • validation of attributes on thing level
    • validation of properties of features
    • validation of desired properties of features (ignoring "required" constraints)
    • validation of thing messages
    • validation of feature messages
    • whether to allow modifying non modeled attributes/properties or to reject them
    • whether to allow sending of non modeled messages (wot actions/events) or to reject them

I expect this to be quite difficult to do, as we have to extract the JsonSchema parts from WoT TM models and apply them.
Both when eg a complete thing is modified and also partially, when eg only a single feature or even property or even part of a property is modified.

@thjaeckle thjaeckle changed the title Add option to enforce validatation based on referenced WoT model Add option to enforce validation based on referenced WoT model Jun 10, 2023
@thjaeckle
Copy link
Member Author

I think that we need to validate always what the target state of the complete thing (or feature if only a feature was modifier) would be against the model.

So after enforcement (different permissions should not yield different validation results), but before applying a modify command to the persistence.

We should also monitor how much time validation takes, by adding metrics (spans) to the existing signal processing trace.

It would ne nice to have the validation as separate Java Module so that it could also be used as a library.

@thjaeckle thjaeckle added this to the 3.4.0 milestone Jun 16, 2023
@thjaeckle
Copy link
Member Author

Another idea on the enforcement:
Configure a list of auth subjects (also supporting wildcards) for which validation is not done.

I am thinking especially about eg connections where we don't necessarily rely on a user input to validate.
Whereas for api users, eg authenticated via JWT and the http api, it would be important to validate all provided data.

@thjaeckle thjaeckle removed this from the 3.4.0 milestone Aug 25, 2023
@thjaeckle thjaeckle added the WoT Web of Things related enhancements label Jan 30, 2024
@thjaeckle thjaeckle added this to the 3.6.0 milestone Feb 24, 2024
@thjaeckle thjaeckle self-assigned this Feb 24, 2024
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue May 6, 2024
* restructuring of "ditto-wot" module to enable re-usability of non-pekko/non-Ditto specifics
* adding "validator" concept and first sample implementation (WIP)

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
@thjaeckle thjaeckle linked a pull request May 6, 2024 that will close this issue
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue May 6, 2024
* restructuring of "ditto-wot" module to enable re-usability of non-pekko/non-Ditto specifics
* adding "validator" concept and first sample implementation (WIP)

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue May 6, 2024
* restructuring of "ditto-wot" module to enable re-usability of non-pekko/non-Ditto specifics
* adding "validator" concept and first sample implementation (WIP)

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue May 6, 2024
* restructuring of "ditto-wot" module to enable re-usability of non-pekko/non-Ditto specifics
* adding "validator" concept and first sample implementation (WIP)

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue May 6, 2024
* restructuring of "ditto-wot" module to enable re-usability of non-pekko/non-Ditto specifics
* adding "validator" concept and first sample implementation (WIP)

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue May 7, 2024
* restructuring of "ditto-wot" module to enable re-usability of non-pekko/non-Ditto specifics
* adding "validator" concept and first sample implementation (WIP)

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue May 7, 2024
* restructuring of "ditto-wot" module to enable re-usability of non-pekko/non-Ditto specifics
* adding "validator" concept and first sample implementation (WIP)

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue May 7, 2024
* restructuring of "ditto-wot" module to enable re-usability of non-pekko/non-Ditto specifics
* adding "validator" concept and first sample implementation (WIP)

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue May 7, 2024
* restructuring of "ditto-wot" module to enable re-usability of non-pekko/non-Ditto specifics
* adding "validator" concept and first sample implementation (WIP)

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
thjaeckle added a commit to beyonnex-io/ditto that referenced this issue May 13, 2024
…hingModel

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WoT Web of Things related enhancements
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants
@thjaeckle and others