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

Issue #240 - added support for "reject duplicate keys" config option #241

Merged
merged 11 commits into from
Mar 26, 2021
Merged

Issue #240 - added support for "reject duplicate keys" config option #241

merged 11 commits into from
Mar 26, 2021

Conversation

JohnTimm
Copy link
Contributor

Signed-off-by: John T.E. Timm johntimm@us.ibm.com

@leadpony
Copy link
Contributor

@JohnTimm @lukasj

  • JsonReaferFactory#getConfigInUse() must return all configuration properties it recognized.
  • I feel FORBID_DUPLICATE_KEYS is better naming than ALLOW_DUPLICATE_KEYS, because the property does not exist in the configuration properties by default and such default state means allow duplicate keys.

@JohnTimm
Copy link
Contributor Author

JohnTimm commented May 28, 2020

@JohnTimm @lukasj

  • JsonReaderFactory#getConfigInUse() must return all configuration properties it recognized.

I have updated the code to pass the configuration object into JsonReaderFactoryImpl (in a similar fashion to JsonGeneratorFactoryImpl).

  • I feel FORBID_DUPLICATE_KEYS is better naming than ALLOW_DUPLICATE_KEYS, because the property does not exist in the configuration properties by default and such default state means allow duplicate keys.

I renamed ALLOW_DUPLICATE_KEYS to FORBID_DUPLICATE_KEYS and updated the logic accordingly. Please see my latest commit.

@JohnTimm JohnTimm requested a review from lukasj May 28, 2020 12:56
@JohnTimm JohnTimm changed the title Issue #240 - added support for "allow duplicate keys" config option Issue #240 - added support for "forbid duplicate keys" config option May 28, 2020
@JohnTimm JohnTimm requested a review from lukasj May 28, 2020 13:25
@JohnTimm JohnTimm changed the title Issue #240 - added support for "forbid duplicate keys" config option Issue #240 - added support for "reject duplicate keys" config option May 28, 2020
Copy link
Contributor

@m0mus m0mus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure that the copyright year is updated to 2020 in all files you changed.

@JohnTimm JohnTimm requested a review from m0mus May 28, 2020 23:08
@JohnTimm
Copy link
Contributor Author

JohnTimm commented May 28, 2020

Make sure that the copyright year is updated to 2020 in all files you changed.

Updated copyright date on JsonObjectBuilderImpl. Please see my latest commit.

@JohnTimm
Copy link
Contributor Author

@lukasj @m0mus Is there a chance for this PR to make it into the next release candidate?

@JohnTimm
Copy link
Contributor Author

JohnTimm commented Jun 15, 2020

Make sure that the copyright year is updated to 2020 in all files you changed.

@m0mus Your requested changes have been addressed. What do we need to do to move this PR forward?

@nmittles
Copy link
Contributor

@m0mus Hi Dmitry. Is there anything holding this PR out? It looks like John has made all the requested changes.

@JohnTimm
Copy link
Contributor Author

JohnTimm commented Sep 9, 2020

@lukasj @m0mus This has been sitting here for months. Please let me know if more needs to be done before it can be merged.

@lukasj
Copy link
Contributor

lukasj commented Sep 9, 2020

We did not want this in 2.0.0 and currently waiting for master to open up for integrations (expect ~2-3 weeks)

@JohnTimm
Copy link
Contributor Author

JohnTimm commented Sep 9, 2020

We did not want this in 2.0.0 and currently waiting for master to open up for integrations (expect ~2-3 weeks)

Sounds good. Thanks for the quick response! I appreciate it.

@JohnTimm
Copy link
Contributor Author

JohnTimm commented Jan 6, 2021

@lukasj Now that Jakarta EE 8 has shipped, where do we stand on getting this PR pulled into master?

@lmsurpre
Copy link
Contributor

lmsurpre commented Mar 1, 2021

Bumped into this interesting article and it reminded me that we've been waiting on this pull request for 9 months: https://labs.bishopfox.com/tech-blog/an-exploration-of-json-interoperability-vulnerabilities

Copy link
Contributor

@lukasj lukasj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't JsonObjectBuilderImpl be the one to decide if the to be added key should be rejected or not? Or is it expected that parser.getObject() may reject the field while json.createObjectBuilder().add("firstName", "John").add("firstName", "Peter").build() is OK to not throw any errors when the reject option is set to true? This does not consistent to me.

@JohnTimm
Copy link
Contributor Author

@lukasj Everything is done through JsonObjectBuilder now so that the behavior should be consistent. Please take a look at my recent commits. We'd like to get this functionality merged sooner than later.

Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
Copy link
Contributor

@lukasj lukasj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Copy link
Contributor

@m0mus m0mus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lukasj lukasj merged commit f0a26c5 into jakartaee:master Mar 26, 2021
@lukasj lukasj linked an issue Mar 26, 2021 that may be closed by this pull request
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.

Consider support for rejecting duplicate keys
6 participants