Skip to content

update: replace serde_yaml with serde-saphyr - #358

Merged
inureyes merged 1 commit into
mainfrom
update/replace-serde-yaml
Nov 10, 2026
Merged

inureyes merged 1 commit into
mainfrom
update/replace-serde-yaml

Conversation

@inureyes

Copy link
Copy Markdown
Member

Summary

Replace the deprecated serde_yaml with serde-saphyr 2.1.1, a YAML parser written in safe Rust. This removes unsafe-libyaml (archived, RUSTSEC-2024-0449) from the dependency tree; cargo deny check advisories now reports only the rsa advisory, which waits on russh (Eugeny/russh#821). bssh only calls from_str and to_string, so the change is a call-site rename plus the manifest and lockfile.

Behavior

Both libraries were run on the same edge-case inputs. Empty and comment-only files, duplicate keys (error), tabs, anchors, unknown fields, multiple documents, and ${VAR} text behave the same.

  • Merge keys (<<: *anchor) are now applied; serde_yaml silently ignored them.
  • Some inputs serde_yaml rejected now load: YAML 1.1 booleans (yes/no), quoted numbers (port: "22"), and underscored integers (1_000).
  • bssh-server gen-config output differs only in quoting bind_address: "0.0.0.0".
  • Parse errors now carry a line and column with a source snippet.

Validation

cargo fmt --check and cargo clippy --all-targets --all-features -- -D warnings pass. The full test suite passes except the four tests/integration_test.rs tests that fail locally on clean main as well. The new crates are MIT or Apache-2.0, add no duplicate crates, and need Rust 1.89 at most (MSRV 1.97).

serde_yaml is deprecated and pulls in unsafe-libyaml, which is archived and reported by cargo deny as RUSTSEC-2024-0449. bssh only uses from_str and to_string, so switch every call site to serde-saphyr 2.1.1, a parser written in safe Rust and the alternative the advisory recommends.

Configs that loaded before parse to the same values except when they use YAML merge keys (<<), which serde_yaml ignored and serde-saphyr applies. A few inputs serde_yaml rejected now load: YAML 1.1 booleans such as yes, quoted numbers, and underscored integers. gen-config output only differs in quoting bind_address.
@inureyes inureyes added type:enhancement New feature or request status:review Under review priority:medium Medium priority issue labels Nov 10, 2026
@inureyes
inureyes merged commit bca239e into main Nov 10, 2026
5 checks passed
@inureyes
inureyes deleted the update/replace-serde-yaml branch November 10, 2026 02:31
@inureyes inureyes added status:done Completed and removed status:review Under review labels Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:medium Medium priority issue status:done Completed type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant