-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
Large files can throw YAMLException due to node limits #23096
Comments
The limit of 50 was introduced in SnakeYAML 1.26. We upgraded to 1.26 in 2.3. |
Ah this was discussed in #20366 - The way described to upgrade snakeyaml can also be used to downgrade it again. I haven't tried it, since I already rewrote the configuration, but I assume this works for anyone coming across the issue. |
I would suggest to configure the As already pointed out in #20366
And I would argue that when an attacker controls your configuration files, that he can do much worse things than the billion laughs attack. With the current settings you get another type of DOS, as you application simply won't start if you have more than 50 aliases. And as those |
We still encountered the same exception when attempting to upgrade from
Downgrading the version of snakeyaml to
Resulting in:
Let us know if you need more information to recreate this. |
@bencalegari Could you please open a new issue for this. If you have time to create a sample that shows the problem, that would be very helpful. |
When using a lot of references to nodes in the
application.yaml
the parser fails with the error:Number of aliases for non-scalar nodes exceeds the specified max=50
.This happens because in
org.springframework.boot.env.OriginTrackedYamlLoader#createYaml
a neworg.yaml.snakeyaml.LoaderOptions
object is created, which has per default an upper limit of 50, because of Billion laugh attacks.This limit is new with either Spring Boot 2.2 or 2.3, it did not exist (at least wasn't that low) in 2.1.
There is also no way for a user to increase the limit.
In my opinion
application.yaml
files can be considered trusted and the limit should be severely increased or disabled. I can make a Pull Request for this, but I am not sure what your preferred solution is.Full Exception:
The text was updated successfully, but these errors were encountered: