Skip to content

Commit b3d2bd6

Browse files
committed
fix(deps): replace serde_yml with serde_yaml_ng (RUSTSEC-2025-0068)
serde_yml is unsound and unmaintained. Switch to serde_yaml_ng (maintained fork) which has an API-compatible interface. Also clean up stale advisory ignores in deny.toml.
1 parent ece44c7 commit b3d2bd6

File tree

5 files changed

+10
-25
lines changed

5 files changed

+10
-25
lines changed

Cargo.lock

Lines changed: 5 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ futures = "0.3"
2222
# ─── 序列化 ───
2323
serde = { version = "1", features = ["derive"] }
2424
serde_json = "1"
25-
serde_yml = "0.0.12"
25+
serde_yaml_ng = "0.10"
2626
toml = "1.1.2"
2727

2828
# ─── CLI ───

crates/memory/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mem-ranker = ["dep:crab-api", "dep:crab-core", "dep:tokio"]
1515
crab-common.workspace = true
1616
serde.workspace = true
1717
serde_json.workspace = true
18-
serde_yml.workspace = true
18+
serde_yaml_ng.workspace = true
1919
dunce.workspace = true
2020
# optional — only for mem-ranker feature
2121
crab-api = { workspace = true, optional = true }

crates/memory/src/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ fn split_frontmatter(content: &str) -> Option<(&str, &str)> {
8484
/// (`name`, `description`, `type`) are missing.
8585
pub fn parse_frontmatter(content: &str) -> Option<MemoryMetadata> {
8686
let (yaml, _) = split_frontmatter(content)?;
87-
// serde_yml may return Err for missing required fields — map to None.
88-
serde_yml::from_str(yaml).ok()
87+
// serde_yaml_ng may return Err for missing required fields — map to None.
88+
serde_yaml_ng::from_str(yaml).ok()
8989
}
9090

9191
/// Return the body text after the frontmatter delimiters.
@@ -101,7 +101,7 @@ pub fn extract_body(content: &str) -> &str {
101101
/// Render [`MemoryMetadata`] as a YAML frontmatter block (including `---`
102102
/// delimiters).
103103
pub fn format_frontmatter(metadata: &MemoryMetadata) -> String {
104-
// Build YAML manually for deterministic ordering (serde_yml output order
104+
// Build YAML manually for deterministic ordering (serde_yaml_ng output order
105105
// is not guaranteed).
106106
let mut out = String::from("---\n");
107107
let _ = writeln!(out, "name: {}", metadata.name);

deny.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
ignore = [
33
# Unmaintained crates — transitive deps, will address when alternatives mature
44
{ id = "RUSTSEC-2024-0320", reason = "yaml-rust unmaintained, transitive via syntect" },
5-
{ id = "RUSTSEC-2024-0384", reason = "transitive dep, no safe upgrade available yet" },
6-
{ id = "RUSTSEC-2024-0436", reason = "transitive dep, no safe upgrade available yet" },
7-
{ id = "RUSTSEC-2025-0134", reason = "transitive dep, no safe upgrade available yet" },
85
{ id = "RUSTSEC-2025-0141", reason = "transitive dep, no safe upgrade available yet" },
96
]
107

0 commit comments

Comments
 (0)