Skip to content

refactor(core): replace the unmaintained serde_yaml with serde-saphyr (RUSTSEC-2024-0449) - #1117

Open
lopatnov wants to merge 2 commits into
cloudflare:mainfrom
lopatnov:replace-serde-yaml-with-serde-saphyr
Open

lopatnov wants to merge 2 commits into
cloudflare:mainfrom
lopatnov:replace-serde-yaml-with-serde-saphyr

Conversation

@lopatnov

@lopatnov lopatnov commented Nov 8, 2026

Copy link
Copy Markdown

Refs #779 (replace the deprecated serde_yaml; the maintainers' answer there was that they would). Fixes #1058 (RUSTSEC-2024-0449).

Why

serde_yaml is archived, and it pulls in unsafe-libyaml, which the advisory RUSTSEC-2024-0449 reports as unmaintained. It reaches every downstream project through pingora-core, so each of them has to ignore the advisory (#1058). serde-saphyr is safe Rust, maintained, and the replacement the advisory suggests.

What

  • pingora-core: ServerConf::from_yaml and ServerConf::to_yaml use serde_saphyr::from_str / to_string. The API of pingora-core does not change.
  • pingora-proxy: the modify_response example (and the dev-dependency) uses serde_saphyr::to_string.
  • The one test that inspected a serde_yaml::Value (test_working_directory_deserializes_from_yaml_string) now checks the written yaml and that it reads back as the same configuration.
  • A second commit changes the CI toolchain matrix (see below).

serde_yaml and unsafe-libyaml are gone from the dependency tree of pingora-core and pingora-proxy (cargo tree -i unsafe-libyaml finds nothing).

The MSRV (please read)

serde-saphyr uses let chains and declares rust-version = "1.89" (its releases from 1.2.0 on; 1.1.0 declares nothing but already fails on 1.85 with error[E0658]: let expressions in this position are unstable). The job that checks the oldest toolchain, 1.85.0, therefore cannot build pingora-core with it. This was the question raised in #779 ("it requires rust 1.89").

I kept that change in its own commit, so it is easy to drop or rework: the oldest toolchain in .github/workflows/build.yml becomes 1.89.0 (same exclusions as before), and pingora-cache, which declares a rust-version and depends on pingora-core, declares 1.89. I did not touch clippy.toml (msrv = "1.85"), because changing it can enable new lints, which is a separate decision. If you prefer to keep 1.85, the alternative is a maintained fork of the same libyaml port (for example serde_norway), which keeps the C-translated parser and may build on 1.85; I did not try it. Tell me which way you prefer and I will rework the PR.

Checked

  • cargo test -p pingora-core --lib server::configuration: 14 passed, on stable (1.99.1, Linux).
  • cargo check -p pingora-core -p pingora-proxy -p pingora-cache -p pingora-load-balancing --all-targets and cargo check -p pingora-proxy --example modify_response on 1.89.0 and on stable.
  • cargo fmt --all -- --check is clean.
  • Not run here: cargo check --workspace (the BoringSSL crates need libclang, which my machine lacks), the TLS-backend tests, the 1.89.0 test leg of CI.

🤖 Generated with Claude Code

lopatnov and others added 2 commits November 8, 2026 19:31
serde_yaml is archived and pulls in unsafe-libyaml, which RUSTSEC-2024-0449
reports as unmaintained (cloudflare#1058). serde-saphyr is safe Rust, maintained, and the
replacement the advisory suggests. It is used in the same three places:
ServerConf::from_yaml, ServerConf::to_yaml and the modify_response example.

The one test that inspected a serde_yaml::Value now checks the written yaml and
that it reads back as the same configuration.

Refs cloudflare#779
Refs cloudflare#1058

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…phyr

serde-saphyr uses let chains and declares rust-version 1.89, so the job that
checked 1.85.0 cannot build pingora-core any more. The oldest toolchain in the
matrix becomes 1.89.0 (the same exclusions as before), and pingora-cache, which
declares a rust-version and depends on pingora-core, declares 1.89 as well.

This commit is separate so that it can be dropped or reworked if the project
prefers another way to keep an older MSRV.

Refs cloudflare#779

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RUSTSEC-2024-0449: unsafe-libyaml is unmaintained

1 participant