diff --git a/.cargo/audit.toml b/.cargo/audit.toml new file mode 100644 index 0000000..206b3f4 --- /dev/null +++ b/.cargo/audit.toml @@ -0,0 +1,10 @@ +# cargo-audit config (local `cargo audit` and the nightly Audit workflow). +# Keep in sync with the advisory ignores in deny.toml. + +[advisories] +ignore = [ + # chrono is unmaintained (informational, no vulnerability, no patched + # version). It is a non-optional dependency of rmcp, borg-mcp's MCP SDK. + # Remove once rmcp moves off chrono. + "RUSTSEC-2026-0543", +] diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 924ce85..53b28f0 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -1,16 +1,24 @@ name: Audit +# Two jobs over the same RustSec advisory database: +# - `cargo deny` gates every change to the dependency graph (push to main, +# pull requests) and is the advisory check that blocks merges. +# - `cargo audit` runs nightly and on demand, and opens an issue per new +# advisory, so advisories published after a merge still surface. on: push: + branches: [main] paths: - "**/Cargo.toml" - "**/Cargo.lock" + - ".cargo/audit.toml" - ".github/workflows/audit.yml" - "deny.toml" pull_request: paths: - "**/Cargo.toml" - "**/Cargo.lock" + - ".cargo/audit.toml" - ".github/workflows/audit.yml" - "deny.toml" schedule: @@ -23,17 +31,21 @@ permissions: jobs: audit: name: cargo audit + # Not on push/pull_request: there audit-check reports through a check + # run that 404s on pull requests, and `cargo deny` already covers + # advisories for those events. + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest permissions: contents: read - # audit-check opens an issue (scheduled runs) and posts a check run. issues: write checks: write steps: - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: persist-credentials: false - - uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2.0.0 + # Unreleased main: v2.0.0 plus the Node 24 runtime (Node 20 is deprecated). + - uses: rustsec/audit-check@858dc40f52ca2b8570b7a997c1c4e35c6fc9a432 # main (node24) with: token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Cargo.lock b/Cargo.lock index b36589b..e27d4b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,18 +86,21 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - [[package]] name = "bitflags" version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + [[package]] name = "borg" version = "1.0.0" @@ -318,12 +321,27 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" +[[package]] +name = "const-oid" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a" + [[package]] name = "core-foundation-sys" version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + [[package]] name = "criterion" version = "0.5.1" @@ -394,45 +412,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] -name = "darling" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.23.0" +name = "crypto-common" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" dependencies = [ - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.117", + "hybrid-array", ] [[package]] -name = "darling_macro" -version = "0.23.0" +name = "digest" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ - "darling_core", - "quote", - "syn 2.0.117", + "block-buffer", + "const-oid", + "crypto-common", ] -[[package]] -name = "dyn-clone" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" - [[package]] name = "either" version = "1.16.0" @@ -621,6 +619,15 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" +[[package]] +name = "hybrid-array" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" +dependencies = [ + "typenum", +] + [[package]] name = "iana-time-zone" version = "0.1.65" @@ -651,12 +658,6 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "indexmap" version = "2.14.0" @@ -847,10 +848,10 @@ dependencies = [ ] [[package]] -name = "pastey" -version = "0.2.2" +name = "percent-encoding" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a797f0e07bdf071d15742978fc3128ec6c22891c31a3a931513263904c982a" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pin-project-lite" @@ -907,9 +908,9 @@ dependencies = [ [[package]] name = "process-wrap" -version = "9.1.0" +version = "10.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e842efad9119158434d193c6682e2ebee4b44d6ad801d7b349623b3f57cdf55" +checksum = "1f21b97672d2dc848e7b25701ab4535618b92f4861c13cc3f7f7bed52ad3c8da" dependencies = [ "futures", "indexmap", @@ -963,26 +964,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "ref-cast" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "regex" version = "1.12.3" @@ -1014,46 +995,34 @@ checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "rmcp" -version = "1.7.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0810a9f717d9828f475fe1f629f4c305c8464b7f496c3a854b58d29e65f4058e" +checksum = "391f153431ab68664d946513ea0cb3edbca78eaf99c5a983036cacab6220d85b" dependencies = [ - "async-trait", - "base64", "chrono", "futures", - "pastey", + "indexmap", + "libc", + "percent-encoding", "pin-project-lite", "process-wrap", - "rmcp-macros", - "schemars", "serde", "serde_json", + "sha2", "thiserror", "tokio", "tokio-stream", "tokio-util", "tracing", -] - -[[package]] -name = "rmcp-macros" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aefac48c364756e97f04c0401ba3231e8607882c7c1d92da0437dc16307904d" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "serde_json", - "syn 2.0.117", + "unicode-general-category", + "unicode-normalization", ] [[package]] name = "rustix" -version = "1.1.4" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ "bitflags", "errno", @@ -1077,32 +1046,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "schemars" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" -dependencies = [ - "chrono", - "dyn-clone", - "ref-cast", - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d115b50f4aaeea07e79c1912f645c7513d81715d0420f8bc77a18c6260b307f" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn 2.0.117", -] - [[package]] name = "scopeguard" version = "1.2.0" @@ -1145,17 +1088,6 @@ dependencies = [ "syn 2.0.117", ] -[[package]] -name = "serde_derive_internals" -version = "0.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", -] - [[package]] name = "serde_json" version = "1.0.150" @@ -1169,6 +1101,17 @@ dependencies = [ "zmij", ] +[[package]] +name = "sha2" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -1222,12 +1165,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - [[package]] name = "syn" version = "2.0.117" @@ -1302,6 +1239,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + [[package]] name = "tokio" version = "1.54.1" @@ -1437,12 +1380,33 @@ dependencies = [ "syn 2.0.117", ] +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-general-category" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f" + [[package]] name = "unicode-ident" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" +[[package]] +name = "unicode-normalization" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75cd3fb03d5288b3ba9a1ee103ac7e9cbb59f0b03d64f8ddfcc04dd42758a85d" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-xid" version = "0.2.6" diff --git a/Cargo.toml b/Cargo.toml index 1a83ee8..4b32526 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,16 +25,11 @@ publish = false [workspace.dependencies] borg = { path = "crates/borg" } -borg-loop = { path = "crates/borg-loop" } borg-macros = { path = "crates/borg-macros" } -borg-mcp = { path = "crates/borg-mcp" } -borg-tools = { path = "crates/borg-tools" } -borg-tracing = { path = "crates/borg-tracing" } arc-swap = "1" async-stream = "0.3" async-trait = "0.1" -dashmap = "6" futures = "0.3" lru = "0.18" # Non-poisoning locks: a panic while holding a `std::sync` guard makes @@ -43,7 +38,7 @@ lru = "0.18" parking_lot = "0.12" proc-macro2 = "1" quote = "1" -rmcp = { version = "1.7", features = ["client", "transport-child-process"] } +rmcp = { version = "3.11", default-features = false, features = ["client", "transport-child-process"] } serde = { version = "1", features = ["derive", "rc"] } serde_json = "1" syn = { version = "2", features = ["full"] } diff --git a/crates/borg-loop/Cargo.toml b/crates/borg-loop/Cargo.toml index cef1c12..bd187ea 100644 --- a/crates/borg-loop/Cargo.toml +++ b/crates/borg-loop/Cargo.toml @@ -1,5 +1,5 @@ [package] -publish = false # GitHub-only distribution; consumers pin a release tag +publish.workspace = true name = "borg-loop" version.workspace = true edition.workspace = true diff --git a/crates/borg-macros/Cargo.toml b/crates/borg-macros/Cargo.toml index 7968a68..2a205e6 100644 --- a/crates/borg-macros/Cargo.toml +++ b/crates/borg-macros/Cargo.toml @@ -1,5 +1,5 @@ [package] -publish = false # GitHub-only distribution; consumers pin a release tag +publish.workspace = true name = "borg-macros" version.workspace = true edition.workspace = true diff --git a/crates/borg-mcp/Cargo.toml b/crates/borg-mcp/Cargo.toml index bb27738..d4198c1 100644 --- a/crates/borg-mcp/Cargo.toml +++ b/crates/borg-mcp/Cargo.toml @@ -1,5 +1,5 @@ [package] -publish = false # GitHub-only distribution; consumers pin a release tag +publish.workspace = true name = "borg-mcp" version.workspace = true edition.workspace = true diff --git a/crates/borg-mcp/src/client.rs b/crates/borg-mcp/src/client.rs index c27bcc7..392ab03 100644 --- a/crates/borg-mcp/src/client.rs +++ b/crates/borg-mcp/src/client.rs @@ -397,10 +397,10 @@ impl McpClient { // Best effort: tell the server to stop working on it. Bounded so // a wedged transport can't turn a timeout into another hang. - let notify = self.peer.notify_cancelled(CancelledNotificationParam { - request_id: id, - reason: Some(reason.to_string()), - }); + let notify = self.peer.notify_cancelled(CancelledNotificationParam::new( + Some(id), + Some(reason.to_string()), + )); let _ = tokio::time::timeout(Duration::from_secs(1), notify).await; Err(err) } diff --git a/crates/borg-mcp/src/convert.rs b/crates/borg-mcp/src/convert.rs index e40a721..15ff6bc 100644 --- a/crates/borg-mcp/src/convert.rs +++ b/crates/borg-mcp/src/convert.rs @@ -14,7 +14,7 @@ //! `ServiceError`) become `BorgError::Internal`. use borg::{BorgError, ToolCallResult, ToolSchema}; -use rmcp::model::{CallToolResult, RawContent, Tool}; +use rmcp::model::{CallToolResult, ContentBlock, Tool}; /// Convert an rmcp `Tool` (from `tools/list`) to a borg `ToolSchema`. /// @@ -99,10 +99,10 @@ pub(crate) fn cap_result(result: ToolCallResult, max_bytes: usize) -> ToolCallRe /// Join all `text` blocks in a content vec with `\n` for an /// `is_error: true` result. Non-text blocks are skipped. -fn joined_text(content: &[rmcp::model::Content]) -> String { +fn joined_text(content: &[ContentBlock]) -> String { let mut buf = String::new(); for block in content { - if let RawContent::Text(t) = &block.raw { + if let ContentBlock::Text(t) = block { if !buf.is_empty() { buf.push('\n'); } @@ -119,7 +119,7 @@ fn joined_text(content: &[rmcp::model::Content]) -> String { /// Serialize a content vec to a JSON array, preserving block types via /// rmcp's own `Serialize` impls (canonical MCP wire shape). -fn content_vec_to_json(content: &[rmcp::model::Content]) -> serde_json::Value { +fn content_vec_to_json(content: &[ContentBlock]) -> serde_json::Value { let items: Vec = content .iter() .filter_map(|block| serde_json::to_value(block).ok()) @@ -130,7 +130,6 @@ fn content_vec_to_json(content: &[rmcp::model::Content]) -> serde_json::Value { #[cfg(test)] mod tests { use super::*; - use rmcp::model::Content; use std::sync::Arc; fn make_tool(name: &'static str, desc: Option<&'static str>) -> Tool { @@ -175,8 +174,8 @@ mod tests { #[test] fn result_to_borg_success_with_content_array() { let result = CallToolResult::success(vec![ - Content::text("first line"), - Content::text("second line"), + ContentBlock::text("first line"), + ContentBlock::text("second line"), ]); let borg_result = result_to_borg(result).unwrap(); let output = borg_result.output.unwrap(); @@ -194,8 +193,8 @@ mod tests { #[test] fn result_to_borg_error_joins_text() { let result = CallToolResult::error(vec![ - Content::text("file not found"), - Content::text("path: /tmp/missing"), + ContentBlock::text("file not found"), + ContentBlock::text("path: /tmp/missing"), ]); let borg_result = result_to_borg(result).unwrap(); assert!(borg_result.output.is_none()); diff --git a/crates/borg-sandbox/Cargo.toml b/crates/borg-sandbox/Cargo.toml index dc7bd0f..0ded7f8 100644 --- a/crates/borg-sandbox/Cargo.toml +++ b/crates/borg-sandbox/Cargo.toml @@ -1,5 +1,5 @@ [package] -publish = false # GitHub-only distribution; consumers pin a release tag +publish.workspace = true name = "borg-sandbox" version.workspace = true edition.workspace = true diff --git a/crates/borg-tools/Cargo.toml b/crates/borg-tools/Cargo.toml index a852ee2..3640a74 100644 --- a/crates/borg-tools/Cargo.toml +++ b/crates/borg-tools/Cargo.toml @@ -1,5 +1,5 @@ [package] -publish = false # GitHub-only distribution; consumers pin a release tag +publish.workspace = true name = "borg-tools" version.workspace = true edition.workspace = true diff --git a/crates/borg-tracing/Cargo.toml b/crates/borg-tracing/Cargo.toml index 8425b9d..ba694ef 100644 --- a/crates/borg-tracing/Cargo.toml +++ b/crates/borg-tracing/Cargo.toml @@ -1,5 +1,5 @@ [package] -publish = false # GitHub-only distribution; consumers pin a release tag +publish.workspace = true name = "borg-tracing" version.workspace = true edition.workspace = true diff --git a/crates/borg/Cargo.toml b/crates/borg/Cargo.toml index b9deea9..393e57d 100644 --- a/crates/borg/Cargo.toml +++ b/crates/borg/Cargo.toml @@ -1,5 +1,5 @@ [package] -publish = false # GitHub-only distribution; consumers pin a release tag +publish.workspace = true name = "borg" version.workspace = true edition.workspace = true diff --git a/deny.toml b/deny.toml index ec8e6be..36bb703 100644 --- a/deny.toml +++ b/deny.toml @@ -4,7 +4,13 @@ all-features = true [advisories] version = 2 yanked = "deny" -ignore = [] +ignore = [ + # chrono is unmaintained (informational, no vulnerability, no patched + # version). It is a non-optional dependency of rmcp, borg-mcp's MCP SDK, + # so it can't be dropped from here. Remove once rmcp moves off chrono, + # together with the matching ignore in .cargo/audit.toml. + { id = "RUSTSEC-2026-0543", reason = "unmaintained, transitive via rmcp; no alternative upstream yet" }, +] [licenses] version = 2