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
Spec should be very clear how to handle duplicate keys #259
Comments
I think we should change dag-json and dag-pb to have a I believe Go should already be rejecting dupes: https://github.com/ipld/go-ipld-prime/blob/33475f04486e763616962f4dd2bda67b31758e27/node/basicnode/map.go#L249-L253 We probably ought to do an @Gozala would you care to draft some language for the specs to get this started? |
Another case for negative fixtures .. we have no way of asserting this kind of condition across our codecs. FWIW dag-pb no longer allows this even though it's entirely valid PB and the old codecs used to allow it. As of the latest generation, Go and JS will reject blocks where there are duplicates of anything. |
2023-01-03 IPLD triage conversation:
|
Some issues as follow-up to get them on the board:
This issue can serve as a placeholder for fixing the spec. |
By the way, you can detect duplicate map keys during parsing for almost-free in most cases, by keeping track of how many keys you've added, and then checking if the size of the map matches what you expect once you reach the end of it - as opposed to doing a |
We end up having a lengthy discussion about duplicate key exploits in signed data https://github.com/ChainAgnostic/varsig/pull/6/files#r1038482364 where it become clear that current IPLD specification is not very clear about this, in fact case could be made that following section suggests such exploits are possible
ipld/specs/codecs/dag-json/spec.md
Lines 24 to 32 in 015ff80
It was also unclear how individual implementations would behave in the face of blocks with duplicate keys, which again suggests that this subtle detail shouldn't be subtle, but rather should be well articulated and implementations should communicate how they'd behave in such scenario.
The text was updated successfully, but these errors were encountered: