Commit Graph
30 Commits
Author SHA1 Message Date
Mirko SwillusandClaude e2cfb5a641 #1071: reject invalid XML element names in XML.toString (CWE-91)
XML.toString emitted JSONObject keys verbatim as tag names, so a key
containing '<', '>' or '/' broke out of its element and injected
arbitrary sibling structure into the output. Per #294/#123 the agreed
approach is to throw on invalid input rather than mangle it.

- Add mustBeXmlName / isXmlNameStart / isXmlNameChar implementing the
  XML 1.0 (5th ed.) Name production, code-point aware.
- Validate tagName at method entry and each key at the top of the key
  loop (skipping the cDataTagName sentinel).
- Rewrite XMLTest.shouldHandleIllegalJSONNodeNames and
  XMLConfigurationTest.shouldHandleIllegalJSONNodeNames (previously
  documenting the pass-through behaviour) to assert the throw.
- Add XMLTest.toStringRejectsElementInjectionInKey covering the #1071
  payload and an invalid caller-supplied tagName.
- Add XMLTest.toStringAcceptsValidXmlNames covering hyphen/dot/
  underscore/colon, Latin-1 letters, and the cDataTagName sentinel.

Fixes #1071. Also resolves the long-standing well-formedness question
in #166 / #294 / #308.

Co-Authored-By: Claude <[email protected]>
2026-07-23 14:36:42 +02:00
Pratik Tiwari 510a03ac36 Fixes #1040, Aligns non-forceList behaviour with forceList 2026-01-31 10:34:24 +05:30
Pratik Tiwari 995fb840f7 Fixes the issue of losing the array if an empty forceList element or a tag is in the middle or the end 2026-01-02 21:20:53 +05:30
marilynel 7bb3df8ebf added test details 2025-07-06 12:41:44 -08:00
marilynel 3dce55794f fixed keeping null as string 2025-07-06 12:37:05 -08:00
marilynel 53da5ce2a9 adjusted keepstrings behavior to reflect changes in keepBooleanAsString & keepNumberAsString 2025-04-06 11:04:33 -07:00
marilynel 8dbf03e76b work on issue 841 2025-03-30 12:21:44 -07:00
Sean Leary d3c7eaf17e restore-jsonparserconfiguration: fix unit tests to work when strictMode default is true 2024-12-15 13:18:39 -06:00
Sean Leary ab1b9a3459 Revert "Merge pull request #888 from rikkarth/fix/887"
This reverts commit 14f71274f7, reversing
changes made to 054786e300.
2024-11-03 09:49:23 -06:00
Sean Leary fa2f3402d6 fixes the broken XMLConfigurationTest cases 2024-04-28 11:33:31 -05:00
Sean Leary 771c82c4eb backing out recent changes to optLong, getLong. See #868 2024-02-24 13:07:51 -06:00
Keaton Taylor 30f5b2de79 Add a config flag to disable whitespace trimming 2023-11-20 17:50:22 +02:00
rudrajyoti biswas 8ec822c575 #748 - PR comments - follow convention of configuration builder. 2023-10-28 07:36:31 +05:30
rudrajyoti biswas c6ec2f0e4c #748 - close XML tag explicitly for empty tags with configuration. 2023-10-25 23:23:00 +05:30
rudrajyoti biswas 2374766018 #790 - Update XML with changes for string to number conversion.
For now the code remains duplicated in JSON and XML parsers.
Unit test cases updated to comply with number expectations.
2023-10-19 14:07:53 +05:30
rudrajyoti biswas 1d0775cce7 Revert changes with feature and refactor together. 2023-10-19 10:28:11 +05:30
rudrajyoti biswas 7b2677ac5a #790 - Update XML with changes for string to number conversion.
Moved the code logic to a common utility to de-duplicate.
2023-10-14 10:05:36 +05:30
Cleydyr de Albuquerque eb56704e68 fix: set default maximum nesting depth as 512 2023-02-02 18:15:03 +01:00
Cleydyr de Albuquerque f566a1d9ee fix: limit the nesting depth 2023-02-01 16:26:58 +01:00
stleary 6daabb43ab update-copyright - Replace copyright and license restrictions with Public Domain 2022-08-23 20:00:25 -05:00
Zach 5dd78bc0b9 Test case passed with tags with multiple entries set forceList 2021-11-19 21:22:38 -06:00
Zach e638955034 Pass test case for empty tag with forceList 2021-11-19 21:05:05 -06:00
Zach 3f9b53fee4 longer forcelist tests 2021-11-19 20:55:10 -06:00
Zach fafaeb7aa6 Added simple test case 2021-11-19 20:32:36 -06:00
Sean Leary 78528102d0 Merge pull request #543 from johnjaylward/RefactorXmlConfiguration
Refactor XMLConfiguration to use Builder Pattern
2020-07-24 02:49:28 -05:00
John J. Aylward 5a31f9ef5f Refs #541
Updates XML configuration to use a builder pattern instead of
constructors with many parameters
2020-07-21 11:08:40 -04:00
stleary c63e78bbc7 initial commit 2020-07-18 17:14:39 -05:00
John J. Aylward c11c006e88 fix tests to not depend on HashSet key order 2020-06-05 19:09:10 -04:00
stleary 2b0a8838ef gradle support 2020-05-22 11:17:44 -05:00
stleary d0ea807884 xml parser config tests 2018-12-08 14:51:01 -06:00