Skip to content

Add SnakeYAML 2.x compatibility#579

Merged
rmpestano merged 1 commit intodatabase-rider:masterfrom
xak2000:master
Mar 17, 2024
Merged

Add SnakeYAML 2.x compatibility#579
rmpestano merged 1 commit intodatabase-rider:masterfrom
xak2000:master

Conversation

@xak2000
Copy link
Copy Markdown
Contributor

@xak2000 xak2000 commented Feb 16, 2024

SnakeYaml 2.0 solved the unsafe deserialization vulnerability by changing the default behavior of constructed Yaml instance to restrict types which can be instantiated during deserialization.

This behavior made impossible to define custom DataSet replacers in YAML as they must be instantiated during deserialization.

E.g.

caseInsensitiveStrategy: !!com.github.database.rider.core.api.configuration.Orthography 'LOWERCASE'
properties:
  replacers: [!!my.package.WktReplacer {}]

Both Orthography enum and WktReplacer could not be instantiated during YAML deserialization.

This commit fixes this behavior by configuring SnakeYAML 2.x to use the old behavior (allow any class to be instantiated).

This is acceptable solution as dbunit.yml is loaded from the trusted source, so the mentioned vulnerability is not relevant here.

See:

Fixes #575

@rmpestano
Copy link
Copy Markdown
Member

Hi @xak2000, can you rebase your PR with rider master? I'm not sure why but GH actions didn't run for this PR

Thanks for the help!

@xak2000
Copy link
Copy Markdown
Contributor Author

xak2000 commented Mar 17, 2024

Hi @rmpestano, the commit is already on the rider master, isn't it?

@xak2000
Copy link
Copy Markdown
Contributor Author

xak2000 commented Mar 17, 2024

I have fixed the indentation from tabs to spaces and force-pushed, so the checks should probably trigger again.

@rmpestano
Copy link
Copy Markdown
Member

Hi @rmpestano, the commit is already on the rider master, isn't it?

Once the build passes I'll merge into master

SnakeYaml 2.0 solved the unsafe deserialization vulnerability
by changing the default behavior of constructed `Yaml`
instance to restrict types which can be instantiated during
deserialization.

This behavior made impossible to define custom DataSet
replacers in YAML as they must be instantiated during
deserialization.

E.g.
caseInsensitiveStrategy: !!com.github.database.rider.core.api.configuration.Orthography 'LOWERCASE'
properties:
  replacers: [!!my.package.WktReplacer {}]

Both `Orthography` enum and `WktReplacer` could not be
instantiated during YAML deserialization.

This commit fixes this behavior by configuring SnakeYAML 2.x
to use the old behavior (allow any class to be instantiated).

This is acceptable solution as dbunit.yml is loaded from the
trusted source, so the mentioned vulnerability is not relevant
here.

See:
* https://www.cve.org/CVERecord?id=CVE-2022-1471

Fixes database-rider#575
@rmpestano rmpestano merged commit 04faeb3 into database-rider:master Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SnakeYAML 2.x (Spring Boot 3.2) Compatibility

2 participants