[YANGTOOLS-1473] XML/JSON YangInstanceIdentifier codecs mis-handle key values Created: 03/Jan/23  Updated: 15/Mar/23  Resolved: 15/Mar/23

Status: Resolved
Project: yangtools
Component/s: codecs, data-util
Affects Version/s: 8.0.0, 9.0.0, 7.0.18, 10.0.4
Fix Version/s: 11.0.0, 8.0.10, 9.0.7, 10.0.5

Type: Bug Priority: Highest
Reporter: Robert Varga Assignee: Ruslan Kashapov
Resolution: Done Votes: 1
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by NETCONF-845 Support of namespace for referred yan... Resolved
Relates
relates to YANGTOOLS-1458 Instance identifier parser : handle i... Resolved

 Description   

It seems AbstractStringInstanceIdentifierCodec is not handling values correctly, as it uses String.valueOf() on the object – bypassing any additional processing – so, for example, I do not believe in handles identityref and instance-identifier references correctly.

Furthermore it does not perform any escaping, which probably means we cannot handle strings containing backslashes, or single quotes or double quotes.

This relates to YANGTOOLS-1361, as it provides a counterpart parser, which needs to behave correctly w.r.t. these.

Write a set of tests to show how we handle these corner cases.

 



 Comments   
Comment by Robert Varga [ 06/Jan/23 ]

Tests are showing that at least yang-data-codec-gson is affected by this.

The test suite requires:

  • NodeWithValue tests
  • XML tests
  • full body JSON/XML tests

I very much suspect this will be rather easy for JSON, but XML will need a bespoke solution to work in actual XML bodies, as we need to also emit namespace declarations as part of encoding.

Comment by Robert Varga [ 10/Jan/23 ]

I suspect type bits is mis-handled as well.

Generated at Wed Feb 07 20:56:15 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.