`maxStringLength` is not enforced when skipping String values
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 75/100
Research direction
Compare the _skipString() paths in ReaderBasedJsonParser, UTF8StreamJsonParser, and UTF8DataInputJsonParser with the async parser's existing enforcement. Trace how maxStringLength is checked when strings are materialized, then verify that skipped oversized strings are rejected in each synchronous parser. Done when the example with a 100,000-character string and a 1,000-character limit fails consistently while within-limit strings still advance normally.
Written by the indexing model from the issue text.
Description
Summary
StreamReadConstraints.maxStringLength is not enforced when a String value is skipped by synchronous parsers.
When a String value is materialized, its length is validated against maxStringLength. However, if the value is left incomplete and skipped by calling nextToken(), the _skipString() paths do not track or validate the String length.
For example:
JsonFactory f = JsonFactory.builder()
.streamReadConstraints(StreamReadConstraints.builder()
.maxStringLength(1000)
.build())
.build();
JsonParser p = createParser(f, mode,
"[\"" + "x".repeat(100_000) + "\",1]");
p.nextToken(); // START_ARRAY
p.nextToken(); // VALUE_STRING
p.nextToken(); // skips the String and advances to VALUE_NUMBER_INT
The 100,000-character String is accepted when skipped, despite the configured limit of 1,000.
This affects the synchronous String-skipping paths in:
ReaderBasedJsonParserUTF8StreamJsonParserUTF8DataInputJsonParser
The async parser already enforces the constraint while skipping the String.
This is similar to #1727: validation is performed when the String is consumed, but is missing from the corresponding skip path.
I think _skipString() should enforce maxStringLength consistently with the materialization paths.
- Dominant language
- Java
- Stars
- 2.4k
- Forks
- 952
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 32
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FasterXML/jackson-core
-
Concurrent `BufferRecycler.releaseToPool()` calls can return the same recycler more than oncePossibly taken @Dongnyoung claimed this 5 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 70/100
FasterXML/jackson-core#1824 ·
Maintainers usually reply within 1 day
-
`UTF8DataInputJsonParser` reports end-of-input as `JacksonIOException` instead of `UnexpectedEndOfInputException`Possibly taken @curforever claimed this 34 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 57/100
FasterXML/jackson-core#1761 · 1 reaction ·
Maintainers usually reply within 1 day
-
3.4
Difficulty 5/5 Over a week Newbie friendliness 38/100
FasterXML/jackson-core#1740 · 5 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Consider validating raw unpaired UTF-16 surrogates in ReaderBasedJsonParserPossibly taken @nvsaigokul-sudo claimed this 7 days ago. Open
Difficulty 5/5 Over a week Newbie friendliness 35/100
FasterXML/jackson-core#1705 · 5 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Non-root number separator validation not applied to non-blocking (async) parser (follow-up to #1557)Possibly taken @seonwooj0810 claimed this 98 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 68/100
FasterXML/jackson-core#1640 ·
Maintainers usually reply within 1 day
All issues in FasterXML/jackson-core
Similar issues
-
Cleanup: restore the interrupt flag in AiFailureAnalyzerPossibly taken @Rishankgupta08 claimed this today. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
seleniumboot/selenium-boot#258 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dense-analysis/ale#5181 ·
-
bug subsystem:agent-harness triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ShaftHQ/SHAFT_ENGINE#8043 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
johanhaleby/occurrent#1505 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day