chore: declare rust-version and forbid unsafe_code in manifests#352
chore: declare rust-version and forbid unsafe_code in manifests#352e-desouza wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #352 +/- ##
=======================================
Coverage 86.71% 86.71%
=======================================
Files 252 252
Lines 32630 32630
=======================================
Hits 28296 28296
Misses 4334 4334
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR hardens the crate manifests by enforcing explicit MSRV constraints via rust-version and preventing introduction of unsafe blocks via Cargo’s manifest lint configuration.
Changes:
- Added
rust-version = "1.87"to the rootxrpl-rustmanifest to enforce the documented MSRV. - Added
rust-version = "1.85"toxrpl-rust-macrosto match the Rust 2024 edition minimum requirement. - Added
[lints.rust] unsafe_code = "forbid"to the root manifest to prevent unsafe code from compiling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Cargo.toml | Enforces MSRV 1.87 and forbids unsafe blocks via manifest lints. |
| xrpl-rust-macros/Cargo.toml | Adds an explicit MSRV guard for the proc-macro crate (Rust 1.85 for edition 2024). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| version = "0.1.0" | ||
| edition = "2024" | ||
| rust-version = "1.85" | ||
| description = "XRPL Rust Macros" |
There was a problem hiding this comment.
Fixed in 284aa4c: Added [lints.rust] unsafe_code = "forbid" to xrpl-rust-macros/Cargo.toml. Both crates now declare the lint gate.
- Add rust-version = "1.87" to xrpl-rust (enforces documented MSRV at cargo level; downstream consumers get a clear error instead of cryptic proc-macro failures on older toolchains) - Add rust-version = "1.85" to xrpl-rust-macros (edition = "2024" already requires 1.85; now declared explicitly) - Add [lints.rust] unsafe_code = "forbid" to xrpl-rust (crate contains no unsafe code; guard prevents silent introduction into deserialization paths that process untrusted XRPL network data) Closes #350, closes #351
…(addresses review)
01f4002 to
27741ca
Compare
Why
Two hardening gaps were identified in the manifest files:
No declared MSRV —
Cargo.tomlhad norust-versionfield, so the documented MSRV of 1.87 was unenforced.xrpl-rust-macrosusesedition = "2024"(requires Rust ≥ 1.85) with no corresponding guard. Downstream users on older toolchains received cryptic proc-macro errors instead of a clear MSRV message. Closes chore: declare rust-version = "1.87" in Cargo.toml (MSRV enforcement) #351.No
unsafe_codelint guard — The crate contains nounsafeblocks, but withoutforbid(unsafe_code)nothing prevents a future contribution from silently adding raw pointer operations into deserialization paths that process untrusted XRPL network data. Closes chore: add [lints] table with unsafe_code = "forbid" to Cargo.toml #350.What changed
Cargo.toml: addedrust-version = "1.87"and[lints.rust] unsafe_code = "forbid"xrpl-rust-macros/Cargo.toml: addedrust-version = "1.85"(matchesedition = "2024"requirement)How to validate