Skip to content

reject unterminated key predicates in extractKV - #1095

Open
nabhan06 wants to merge 1 commit into
openconfig:masterfrom
nabhan06:unterminated-key-parse
Open

reject unterminated key predicates in extractKV#1095
nabhan06 wants to merge 1 commit into
openconfig:masterfrom
nabhan06:unterminated-key-parse

Conversation

@nabhan06

Copy link
Copy Markdown

extractKV doesn't check whether it is still inside a [key=value] predicate when the input runs out, so an element with a dangling predicate is silently mis-parsed rather than rejected: the element name is discarded and the trailing key value takes its place. StringToStructuredPath(/a/b[k=c) returns /a/c with no error, and PathToSchemaPath on a deprecated Element of a[b=c returns /c, so code that string-checks a path before converting it can end up resolving a different node than the one it inspected. Same story for a trailing escape character, where the backslash is just dropped.

This errors on both cases at the end of extractKV, with test cases covering the string and Element forms.

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.

1 participant