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

Potential SnakeYaml version upgrade issue #5818

Closed
porsche-rbieniek opened this issue Sep 19, 2022 · 6 comments
Closed

Potential SnakeYaml version upgrade issue #5818

porsche-rbieniek opened this issue Sep 19, 2022 · 6 comments
Labels
model About the data model

Comments

@porsche-rbieniek
Copy link

porsche-rbieniek commented Sep 19, 2022

The latest release versions of SnakeYaml, the YML parser used by ORT, it is no longer possible to parse ORT files larger than 3 MB in size

The symptom is an exception similar to this:

com.fasterxml.jackson.databind.JsonMappingException: The incoming YAML document exceeds the limit: 3145728 code points.

Caused by: com.fasterxml.jackson.dataformat.yaml.JacksonYAMLParseException: The incoming YAML document exceeds the limit: 3145728 code points.
 at [Source: (BufferedInputStream); line: 83202, column: 17]
	at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:409)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:308)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:176)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:313)
	... 89 more
Caused by: org.yaml.snakeyaml.error.YAMLException: The incoming YAML document exceeds the limit: 3145728 code points.
	at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:335)
	at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:256)
	at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingValue.produce(ParserImpl.java:680)
	at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:171)
	at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:181)
	at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.java:403)
	... 93 more

The problem seems to be introduced as part of the fix for CVE-2022-25857

There is currently no other workaround except fixing the snakeyaml version to 1.30

@sschuberth
Copy link
Member

The latest release versions of SnakeYaml, the YML parser used by ORT

Minor clarification: ORT is not using SnakeYaml directly, but ORT is using Jackson which in turn uses SnakeYaml.

it is no longer possible to parse ORT files larger than 3 MB in size

That limit was introduced as part of SnakeYaml 1.32. However, I just verified that ORT's main branch uses only up to SnakeYaml 1.31 (via ./gradlew allDependencies | grep snakeyaml).

There is currently no other workaround except fixing the snakeyaml version to 1.30

This sentence confuses me now, because the 3MB limit has been introduced with version 1.32. So using version 1.31 (as we do) should be fine. Can you please clarify?

@sschuberth sschuberth added needs info An issue where further information is required scanner About the scanner tool labels Sep 19, 2022
@mnonnenmacher
Copy link
Member

We will eventually want to upgrade anyway and I could not find a way to override the limit. Not being able to parse YAML files larger than 3MB would make the file format useless for us so I have asked the devs if they can confirm that my assumption is correct: FasterXML/jackson-dataformats-text#335 (comment)

@sschuberth
Copy link
Member

As explained here we could always use Gradle to force the transitive SnakeYaml version to 1.31 (or even 1.30), as most users probably aren't affected by the evoked CVEs anyway.

PS: Slightly off-topic, but with all the removals of the custom deserializers recently, I'm really looking forward to #3904 which would solve also this issue for good.

@sschuberth sschuberth changed the title SnakeYaml version upgrade issue Potential SnakeYaml version upgrade issue Sep 20, 2022
@mnonnenmacher
Copy link
Member

Efforts to make the size limit configurable are now tracked in FasterXML/jackson-dataformats-text#337.

@mnonnenmacher
Copy link
Member

PS: Slightly off-topic, but with all the removals of the custom deserializers recently, I'm really looking forward to #3904 which would solve also this issue for good.

Apart from potential technical issues we would first have to migrate all config files to use camel case, I think that's still a long way to go.

@sschuberth sschuberth removed the needs info An issue where further information is required label Sep 20, 2022
sschuberth added a commit that referenced this issue Sep 21, 2022
For background information see [1].

[1]: #5818

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
@sschuberth sschuberth added model About the data model on hold Pull requests that cannot currently be merged and removed scanner About the scanner tool labels Sep 21, 2022
sschuberth added a commit that referenced this issue Sep 21, 2022
For background information see [1].

[1]: #5818

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
sschuberth added a commit to oss-review-toolkit/ort-workbench that referenced this issue Nov 28, 2022
Stick to version 1.31, which is the latest version that does not limit
the file size to 3 MiB, also see the discussion at [1].

[1]: oss-review-toolkit/ort#5818

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
sschuberth added a commit to oss-review-toolkit/ort-workbench that referenced this issue Nov 28, 2022
Stick to version 1.31, which is the latest version that does not limit
the file size to 3 MiB, also see the discussion at [1].

[1]: oss-review-toolkit/ort#5818

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
sschuberth added a commit that referenced this issue Nov 28, 2022
Stick to version 1.31, which is the latest version that does not limit
the file size to 3 MiB, also see the discussion at [1].

[1]: #5818

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
sschuberth added a commit that referenced this issue Nov 28, 2022
Stick to version 1.31, which is the latest version that does not limit
the file size to 3 MiB, also see the discussion at [1].

[1]: #5818

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
@sschuberth sschuberth removed the on hold Pull requests that cannot currently be merged label Nov 28, 2022
@sschuberth
Copy link
Member

Efforts to make the size limit configurable are now tracked in FasterXML/jackson-dataformats-text#337.

This new feature is being made use of in #6124.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
model About the data model
Projects
None yet
Development

No branches or pull requests

3 participants