-
Notifications
You must be signed in to change notification settings - Fork 456
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 validation for null props inside objects inside arrays. #4896
Add validation for null props inside objects inside arrays. #4896
Conversation
{ | ||
if (currentDepth > TwinPropertyMaxDepth) | ||
{ | ||
throw new InvalidOperationException($"Nested depth of twin property exceeds {TwinPropertyMaxDepth}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this applicable to arrays as well? Have you confirmed with IoTHub behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is true for all json type fields then can we just move it out of the destructure ifs and put a single if depth check at the top of this fn?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nyanzebra, this is true for arrays and objects only. But you might have a point, so I moved that into a func to avoid duplications.
@varunpuranik, as discussed offline with the hub folks, I believe we need to keep nested arrays validaion.
...core/test/Microsoft.Azure.Devices.Edge.Hub.Core.Test/twin/ReportedPropertiesValidatorTest.cs
Outdated
Show resolved
Hide resolved
Add validation for null props inside objects inside arrays.
…4941) Add validation for null props inside objects inside arrays. Since IoT Hub does not support patch operations on arrays (if you want to update array, you need to replace it), they don't allow null values or null properties inside arrays. EdgeHub, on the other hand, allows that. So, validation can pass on the EdgeHub side, but the update will be rejected by the hub. This situation allows for sending bad payloads, that blocks any further twin updates unless bad property is removed/cleared.
Update test rusting rusting Style Style C# parsing Parsing with test Add validation for null props inside objects inside arrays. (Azure#4896) (Azure#4941) Add validation for null props inside objects inside arrays. Since IoT Hub does not support patch operations on arrays (if you want to update array, you need to replace it), they don't allow null values or null properties inside arrays. EdgeHub, on the other hand, allows that. So, validation can pass on the EdgeHub side, but the update will be rejected by the hub. This situation allows for sending bad payloads, that blocks any further twin updates unless bad property is removed/cleared.
…) (Azure#4941) Add validation for null props inside objects inside arrays. Since IoT Hub does not support patch operations on arrays (if you want to update array, you need to replace it), they don't allow null values or null properties inside arrays. EdgeHub, on the other hand, allows that. So, validation can pass on the EdgeHub side, but the update will be rejected by the hub. This situation allows for sending bad payloads, that blocks any further twin updates unless bad property is removed/cleared.
#5034) …#4941) Since IoT Hub does not support patch operations on arrays (if you want to update array, you need to replace it), they don't allow null values or null properties inside arrays. EdgeHub, on the other hand, allows that. So, validation can pass on the EdgeHub side, but the update will be rejected by the hub. This situation allows for sending bad payloads, that blocks any further twin updates unless bad property is removed/cleared.
Add validation for null props inside objects inside arrays.
Add validation for null props inside objects inside arrays.
Add validation for null props inside objects inside arrays.
Since IoT Hub does not support patch operations on arrays (if you want to update array, you need to replace it), they don't allow null values or null properties inside arrays. EdgeHub, on the other hand, allows that. So, validation can pass on the EdgeHub side, but the update will be rejected by the hub. This situation allows for sending bad payloads, that blocks any further twin updates unless bad property is removed/cleared.