rust-security

Audit Rust dependencies and harden parsers against supply-chain attacks and untrusted input.

2|1|Updated Aug 19, 2026
One-click install
npx skills add https://github.com/po4yka/rust-skills --skill rust-security-po4yka
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rust-security
Source: https://github.com/po4yka/rust-skills/tree/main/skills/rust-security
Command: npx skills add https://github.com/po4yka/rust-skills --skill rust-security-po4yka

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Rust projects face two distinct security risks: vulnerable or malicious crates entering the dependency graph, and parsers that mishandle adversarial files, archives, or binary formats. This Skill provides concrete cargo-audit and cargo-deny workflows, dependency vetting gates, and parser hardening rules to address both. ## Core Features & Use Cases - Advisory and policy enforcement: Run cargo-audit and cargo-deny with correct version-pinned commands, triage RUSTSEC advisories by kind (vulnerability, unsound, unmaintained, malicious), and write time-boxed ignore entries with tracking links. - Dependency vetting gate: Apply a six-step review to every new Cargo.lock package, including typosquat identity checks, published-source inspection of build scripts and proc macros, and a no-compile rule until vetting passes. - Malicious crate response: Follow an incident playbook for compromised releases, including lockfile rollback, local cache deletion, and credential rotation reporting. - Untrusted-input parser hardening: Enforce length caps, checked arithmetic, recursion limits, path traversal rejection, and safe hasher choices for parsers reading archives, XML, JSON, SQLite, or binary containers. - Use Case: A pull request adds a new transitive dependency. Use this Skill to vet the crate's identity and published source before compiling, then run cargo deny to confirm the candidate graph passes policy. ## Quick Start Ask the agent to audit the workspace dependencies with cargo-audit and cargo-deny and triage any RUSTSEC findings in Cargo.lock.

Frequently Asked Questions about rust-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit Rust dependencies for vulnerabilities?▼

Run cargo audit to compare Cargo.lock against the RustSec advisory database; it exits 1 on vulnerabilities. Add --deny warnings to also fail on unmaintained, unsound, and yanked crates, and use cargo deny check for license, ban, and source policy.

cargo-audit vs cargo-deny: which should I use?▼

cargo-audit gives a fast advisory-only check against the RustSec database. cargo-deny is the blocking gate that also checks licenses, duplicate versions, wildcard requirements, and dependency sources, so use it in CI as the policy enforcement job.

How do I respond to a malicious crate advisory in Rust?▼

Remove the malicious package from the graph in one change, rolling back to an unaffected version if the advisory lists one. Then delete cached copies from the Cargo registry, run cargo clean, and report which machines built the workspace so credentials can be rotated.

Why does cargo deny fail with unexpected argument '--config' found?▼

The command syntax and pinned cargo-deny version disagree. On 0.20 and later, --config is a root option before check; on 0.19 it goes after check. Match the command to the version CI pins.

How do I prevent path traversal when extracting archives in Rust?▼

Accept only Component::Normal UTF-8 path components and reject absolute paths, parent components, symlinks, and hard links. Create entries relative to an open staging-root directory handle with no-follow semantics rather than relying on a library extract helper.

When should I not use FxHasher or FnvHasher in Rust?▼

Avoid them for hash-map keys an outside caller controls, such as HTTP headers, JSON object keys, or archive entry names, because they lack a random secret and allow offline collision attacks. Keep std RandomState for untrusted keys and use fast hashers only for internal keys.