Skip to main content

attackmap-analyzer-rust

Rust ecosystem analyzer for AttackMap.

This analyzer extracts structured signals from Rust crates and Cargo workspaces:

  • Web frameworks — axum, actix-web, rocket, poem, salvo, loco, warp, tide (routes with their full mounted path; entrypoints)
  • Databases — sqlx (Postgres / MySQL / SQLite), diesel, sea-orm, tokio-postgres, rusqlite, mongodb, redis, deadpool, AWS SDK (S3 / DynamoDB)
  • Auth crates — jsonwebtoken, argon2 / bcrypt / scrypt / password-hash, oauth2, axum-login, actix-identity, tower-sessions, tower-http auth
  • HTTP clients (external calls) — reqwest, isahc, surf, ureq
  • Secrets — std::env::var, dotenv / dotenvy, env! macro, secrecy::SecretString
  • Service hints — Cargo [package].name and [workspace].members

All emissions populate AttackMap's Signal v2 fields (line numbers, evidence snippets, confidence scores) so downstream insights can cite path/to/file.rs:NN.

Install

uv tool install attackmap --with attackmap-analyzer-rust    # from PyPI
# or: pip install attackmap-analyzer-rust    (installs attackmap too)
# or from source:
pip install git+https://github.com/mlaify/attackmap-analyzer-rust.git

The analyzer is auto-discovered by AttackMap via the attackmap.analyzers entry-point group.

Usage with AttackMap

# Auto-discovered when installed:
attackmap analyze /path/to/rust/repo

# Or invoke explicitly:
attackmap analyze /path/to/rust/repo --module rust

Detection

detect() returns true when any of the following are present, ignoring target/, .git/, node_modules/, .cargo/, and vendor/:

  • A Cargo.toml or Cargo.lock at the repository root, or anywhere in the tree
  • One or more .rs files in the tree

Coverage notes

  • Route prefixes: a route's path includes the prefixes of every router that mounts it.
    • axum: .nest("/p", x) / .merge(x) where x is an inline Router::new()..., a let x = Router::new()... binding (same file, nearest earlier one) or x() / module::x() returning a router (any file; several fn routes() are told apart by module path or by being in the caller's file). A router nested at two prefixes yields a route under each.
    • actix-web: web::scope("/p") and web::resource("/p") (also bare scope(..) / resource(..) when imported from actix_web), nested scopes, .configure(module::config), and #[get] handlers mounted with .service(handler).
    • rocket: .mount("/base", routes![a, m::b]) and .mount("/base", m::routes()) where fn routes() returns routes![..].
    • poem Route::new().at(..).nest(..), salvo Router::with_path(..).get(h).push(..), loco Routes::new().prefix(..).add(..) under AppRoutes::..().prefix(..).add_route(..).
    • warp: each warp::path!("users" / u32) is a route (/users/{u32}); its method is the warp::get()-style filter combined with it. path!(".." / ..) prefix filters and path! used under another filter (x.and(warp::path!(..))) aren't emitted, since their prefix isn't visible.
    • tide: app.at("/x").at("/y").get(h), including receivers bound with let api = app.at("/api").
    • A non-literal prefix (.nest(&format!(..), x)) or an ambiguous mount leaves the route at its own path. let bindings resolve only within their own fn, and let api = api.route(..) continues the earlier router.
    • A named router that nothing visible mounts counts as a fully-seen root (for anonymous) only when it is handed to a server (axum::serve(l, app), poem .run(app), salvo .serve(router)).
  • Multi-method axum chains like .route("/x", get(h).post(h2)) produce one Route per HTTP verb in the chain, all sharing the same line.
  • The actix-web attribute regex (#[get(...)]) and rocket attribute regex are intentionally identical; rocket emissions only fire when the file also mentions rocket somewhere, to avoid double-counting actix routes.
  • Route auth (AttackMap#256): each route carries auth (required / anonymous / unknown), guards and guard_evidence.
    • axum: a Router::new() chain is read in order. .layer / .route_layer wrap only the routes added before them. Routers bound with let or returned from fn name() -> Router are followed through .merge(name) / .nest("/x", name), across files.
    • actix-web: .wrap(...) on App::new() / web::scope(...) / web::resource(...) covers every service in it, nested and configured scopes included. .service(handler) links attribute-macro handlers to their scope.
    • poem / salvo / loco: poem .with(..) wraps the routes before it; salvo .hoop(..) and loco .layer(..) cover the whole router.
    • Each mount path is resolved on its own, so a router nested under an auth layer at /admin and outside it at /preview gets required only under /admin.
    • Auth layers: middleware::from_fn(require_auth), from_extractor::<RequireAuth>, RequireAuthorizationLayer / ValidateRequestHeaderLayer::bearer, login_required!, HttpAuthentication::bearer.
    • Handler extractors: a type like Claims, AuthUser, CurrentUser or LoggedUser makes a route required only when its FromRequestParts / FromRequest impl is in the repo, can reject (not type Rejection = Infallible) checks credentials (reads an auth header / cookie / session / token) and rejects when they're missing (ok_or(..)?, an early return Err, Err(Unauthorized), a required TypedHeader<Authorization<..>>). Maybe* / Optional* extractors, and ones that only parse a token when present, don't count; the same goes for Rocket request guards. Library extractors that reject anonymous callers count without a visible impl: actix-web-httpauth BearerAuth / BasicAuth, actix-identity Identity, loco JWT / JWTWithUser. Option<AuthUser> makes it anonymous, but only when no auth layer applies and every layer on the way up is a known non-auth one (tracing, CORS, compression, ...). axum-login's AuthManagerLayer / AuthSession only load the user and don't count.
    • Stays unknown: routers re-layered or merged outside their own chain, handler names defined in more than one module that can't be told apart, extractors without a visible impl, Rocket path/data params, and warp / tide routes.

License

MIT

Metadata

Release files for attackmap-analyzer-rust 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for attackmap-analyzer-rust 0.2.1
File Size Uploaded Provenance Actions
attackmap_analyzer_rust-0.2.1.tar.gz 49.1 kB With provenance Details for attackmap_analyzer_rust-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for attackmap-analyzer-rust 0.2.1
File Interpreter ABI Platform Actions
attackmap_analyzer_rust-0.2.1-py3-none-any.whl Python 3 none any Details for attackmap_analyzer_rust-0.2.1-py3-none-any.whl

Total release size: 85.4 kB

Release files / attackmap_analyzer_rust-0.2.1.tar.gz

Download URL attackmap_analyzer_rust-0.2.1.tar.gz
Size 49.1 kB
Tags Source
SHA-256 checksum
How to use checksums
03c0dfddc7b75ee8e1cf5c5eeddfa8838700497249da99fc73e9a5ab174ee3c6
BLAKE2b-256 checksum
How to use checksums
3f99b0edb2fa8fd9e869d7f145afeb008f05640688eae0daf6a1a9339ee4f06d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / attackmap_analyzer_rust-0.2.1-py3-none-any.whl

Download URL attackmap_analyzer_rust-0.2.1-py3-none-any.whl
Size 36.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73a7fab9958906334fd688268f21bf5458ad7cd4829eda09e69c59947b0811ce
BLAKE2b-256 checksum
How to use checksums
00c717eeba2f9fb192808af942c61de5480ee36619634472d64b225a84d4af5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for attackmap-analyzer-rust 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for attackmap_analyzer_rust-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page