-
Notifications
You must be signed in to change notification settings - Fork 418
Add unmaintained unsafe-libyaml & serde_yaml #2459
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
Open
jayvdb
wants to merge
1
commit into
rustsec:main
Choose a base branch
from
jayvdb:add-serde-yaml
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| ```toml | ||
| [advisory] | ||
| id = "RUSTSEC-0000-0000" | ||
| package = "serde_yaml" | ||
| date = "2025-11-16" | ||
| url = "https://github.com/dtolnay/serde-yaml/blob/master/README.md" | ||
| informational = "unmaintained" | ||
|
|
||
| [versions] | ||
| patched = [] | ||
| ``` | ||
|
|
||
| # serde_yaml crate is unmaintained | ||
|
|
||
| The `serde_yaml` crate is no longer actively maintained. If you rely on this crate, consider switching to a recommended alternative. | ||
|
|
||
| While there are maintained forks of `serde_yaml`, none of them can be recommended as they either use the | ||
| unmaintained `unsafe-libyaml`, or they use a fork of `unsafe-libyaml` which do not resolve the underlying security problems | ||
| of `libyaml`. | ||
|
|
||
| ## Recommended alternatives | ||
|
|
||
| - [`yaml-spanned`](https://crates.io/crates/yaml-spanned) - Deserializer only. | ||
| - [`serde_yaml2`](https://crates.io/crates/serde_yaml2) - Incomplete implementation of serde framework. | ||
| - [`serde-saphyr`](https://crates.io/crates/serde-saphyr) - Not complete implementation of YAML 1.2 or serde framework. | ||
| - [`yaml-peg`](https://crates.io/crates/yaml-peg) - Not complete implementation of YAML 1.2 or serde framework. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| ```toml | ||
| [advisory] | ||
| id = "RUSTSEC-0000-0000" | ||
| package = "unsafe-libyaml" | ||
| date = "2025-11-16" | ||
| url = "https://github.com/rustsec/advisory-db/issues/2132" | ||
| informational = "unmaintained" | ||
|
|
||
| [versions] | ||
| patched = [] | ||
| ``` | ||
|
|
||
| # unsafe-libyaml crate is unmaintained | ||
|
|
||
| The `unsafe-libyaml` crate is no longer actively maintained. If you rely on this crate, consider switching to a maintained alternative. | ||
|
|
||
| ## Recommended alternatives | ||
|
|
||
| - [`libyaml-safer`](https://crates.io/crates/libyaml-safer) | ||
| - [`saphyr-parser`](https://crates.io/crates/saphyr-parser) - Parser only. | ||
| - [`yaml-rust2`](https://crates.io/crates/yaml-rust2) - [Maintenance mode only](https://github.com/Ethiraric/yaml-rust2/issues/26) | ||
| - [`yaml_parser`](https://crates.io/crates/yaml_parser) & [`pretty_yaml`](https://crates.io/crates/pretty_yaml) | ||
| - [`yaml-spanned`](https://crates.io/crates/yaml-spanned) - Parser only. | ||
| - [`yaml-peg`](https://crates.io/crates/yaml-peg) - Not complete implementation of YAML 1.2 | ||
| - [`rust-yaml`](https://crates.io/crates/rust-yaml) | ||
| - [`yaml_lib`](https://crates.io/crates/yaml_lib) | ||
| - [`oak-yaml`](https://crates.io/crates/oak-yaml) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to replace this by
While the library is relatively young, "incomplete" implies that this is a stub that lacks all the necessary functionality. This is not the case.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bourumir-wyngs I am not happy with that alternative you provide, but I do understand what you are getting at.
The main point that must be conveyed is that
serde-saphyris not a complete implementation of YAML 1.2, becausesaphyr-parseris still incomplete wrt YAML 1.2 spec. Very incomplete. I have lots of types of data structures that worked withserde_yamlthat fail insidesaphyr-parser. It did work for a few simpler data structures, and I adopted it for those. But it is not nearly as good atyaml-spanned, and it is roughly on par withserde_yaml2based on my usage.To be honest, I am not sure how complete
serde-saphyris wrt to the serde framework. i.e. which issues are due toserde-saphyrimmaturity vs problems it inherits fromsaphyr-parserand cant fix untilsaphyr-parserimproves. It is a bit difficult for an outside observer to easily identify which is the cause of the problems. That said, from what I saw, there is a bit of both to blame for the problems I saw trying to migrate a very large commercial codebase toserde-saphyr.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While saphyr-parser needs more work, I do not see where else would be the way to go. yaml-spanned you talk about uses internally libyaml-safer that is, again, the fork of the same unsafe-libyaml. Having cascades of
unsafethere is fundamentally a problem, memory safety is on the main Rust's selling points.Serde-saphyr currently has 618 passing tests, many of which were ported from the yaml-test-suite (those with a y_prefix), and also quite many from serde-yaml. If you would share at least some of these "lots" structures that do not work, I would be thankful. yaml-rust2 (from whom saphyr-parser is the fork with modern features) has 19,601,133 downloads to date so I think works for some.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libyaml-saferdoes not useunsafe. https://github.com/simonask/libyaml-safer/blob/c09b7a24554171e32fa958042304af0f4cf4e203/src/lib.rs#L22There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/saphyr-rs/saphyr/issues?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen lists the many fundamental issues with saphyr-parser wrt YAML. And I ran into many of those. It changes the data-type of incoming data. And that blows up your serde layer on top of it in weird ways.