attackmap-analyzer-rust 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: attackmap-analyzer-rust
3
+ Version: 0.2.0
4
+ Summary: Rust ecosystem analyzer plugin for AttackMap (axum, actix-web, rocket; sqlx/diesel/sea-orm; jsonwebtoken/argon2; reqwest).
5
+ Author: AttackMap Contributors
6
+ Author-email: Matthew Davis <mlaify@mlaify.io>
7
+ Maintainer-email: Matthew Davis <mlaify@mlaify.io>
8
+ License-Expression: MIT
9
+ Project-URL: Homepage, https://github.com/mlaify/attackmap-analyzer-rust
10
+ Project-URL: Repository, https://github.com/mlaify/attackmap-analyzer-rust
11
+ Project-URL: Issues, https://github.com/mlaify/attackmap-analyzer-rust/issues
12
+ Project-URL: Changelog, https://github.com/mlaify/attackmap-analyzer-rust/blob/main/CHANGELOG.md
13
+ Project-URL: AttackMap core, https://github.com/mlaify/AttackMap
14
+ Keywords: security,static-analysis,appsec,defensive-security,attackmap,attackmap-plugin
15
+ Classifier: Development Status :: 4 - Beta
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: Information Technology
18
+ Classifier: Intended Audience :: System Administrators
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3 :: Only
25
+ Classifier: Topic :: Security
26
+ Classifier: Topic :: Software Development :: Quality Assurance
27
+ Classifier: Typing :: Typed
28
+ Requires-Python: >=3.11
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: pydantic>=2.7.0
32
+ Provides-Extra: core
33
+ Requires-Dist: attackmap>=0.6.0; extra == "core"
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
36
+ Requires-Dist: build>=1.2.0; extra == "dev"
37
+ Requires-Dist: attackmap>=0.6.0; extra == "dev"
38
+ Dynamic: license-file
39
+
40
+ # attackmap-analyzer-rust
41
+
42
+ > [!IMPORTANT]
43
+ > **Active development, slow pace.** AttackMap is under active development, but
44
+ > progress may be slow until more contributors or co-maintainers join. Help is
45
+ > very welcome with the core engine, an analyzer, the macOS app, or the docs —
46
+ > see [CONTRIBUTING.md](CONTRIBUTING.md) or open an issue on
47
+ > [mlaify/AttackMap](https://github.com/mlaify/AttackMap/issues) to say hello.
48
+ > Security reports are still welcome at [security@mlaify.io](mailto:security@mlaify.io).
49
+
50
+ Rust ecosystem analyzer for [AttackMap](https://github.com/mlaify/AttackMap).
51
+
52
+ This analyzer extracts structured signals from Rust crates and Cargo workspaces:
53
+
54
+ - **Web frameworks** — axum, actix-web, rocket, poem, salvo, loco, warp, tide (routes with their full mounted path; entrypoints)
55
+ - **Databases** — sqlx (Postgres / MySQL / SQLite), diesel, sea-orm, tokio-postgres, rusqlite, mongodb, redis, deadpool, AWS SDK (S3 / DynamoDB)
56
+ - **Auth crates** — jsonwebtoken, argon2 / bcrypt / scrypt / password-hash, oauth2, axum-login, actix-identity, tower-sessions, tower-http auth
57
+ - **HTTP clients (external calls)** — reqwest, isahc, surf, ureq
58
+ - **Secrets** — `std::env::var`, `dotenv` / `dotenvy`, `env!` macro, `secrecy::SecretString`
59
+ - **Service hints** — Cargo `[package].name` and `[workspace].members`
60
+
61
+ All emissions populate AttackMap's Signal v2 fields (line numbers, evidence snippets, confidence scores) so downstream insights can cite `path/to/file.rs:NN`.
62
+
63
+ ## Install
64
+
65
+ ```bash
66
+ uv tool install attackmap --with attackmap-analyzer-rust \
67
+ --index mlaify=https://pkg.mlaify.io/pypi/simple/ --index-strategy first-index
68
+ # or from source:
69
+ pip install git+https://github.com/mlaify/attackmap-analyzer-rust.git
70
+ ```
71
+
72
+ The analyzer is auto-discovered by AttackMap via the `attackmap.analyzers` entry-point group.
73
+
74
+ ## Usage with AttackMap
75
+
76
+ ```bash
77
+ # Auto-discovered when installed:
78
+ attackmap analyze /path/to/rust/repo
79
+
80
+ # Or invoke explicitly:
81
+ attackmap analyze /path/to/rust/repo --module rust
82
+ ```
83
+
84
+ ## Detection
85
+
86
+ `detect()` returns true when any of the following are present, ignoring `target/`, `.git/`, `node_modules/`, `.cargo/`, and `vendor/`:
87
+
88
+ - A `Cargo.toml` or `Cargo.lock` at the repository root, or anywhere in the tree
89
+ - One or more `.rs` files in the tree
90
+
91
+ ## Coverage notes
92
+
93
+ - **Route prefixes:** a route's path includes the prefixes of every router that mounts it.
94
+ - **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.
95
+ - **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)`.
96
+ - **rocket:** `.mount("/base", routes![a, m::b])` and `.mount("/base", m::routes())` where `fn routes()` returns `routes![..]`.
97
+ - **poem** `Route::new().at(..).nest(..)`, **salvo** `Router::with_path(..).get(h).push(..)`, **loco** `Routes::new().prefix(..).add(..)` under `AppRoutes::..().prefix(..).add_route(..)`.
98
+ - **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.
99
+ - **tide:** `app.at("/x").at("/y").get(h)`, including receivers bound with `let api = app.at("/api")`.
100
+ - 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.
101
+ - 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)`).
102
+ - 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`.
103
+ - 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.
104
+ - **Route auth (AttackMap#256)**: each route carries `auth` (`required` / `anonymous` / `unknown`), `guards` and `guard_evidence`.
105
+ - **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.
106
+ - **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.
107
+ - **poem / salvo / loco:** poem `.with(..)` wraps the routes before it; salvo `.hoop(..)` and loco `.layer(..)` cover the whole router.
108
+ - 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`.
109
+ - **Auth layers:** `middleware::from_fn(require_auth)`, `from_extractor::<RequireAuth>`, `RequireAuthorizationLayer` / `ValidateRequestHeaderLayer::bearer`, `login_required!`, `HttpAuthentication::bearer`.
110
+ - **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.
111
+ - **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.
112
+
113
+ ## License
114
+
115
+ MIT
@@ -0,0 +1,11 @@
1
+ attackmap_analyzer_rust/__init__.py,sha256=jNIsqi2upFZUf6RkoyVp3WVD-fvvEbj9NwwRkiFpy-E,63
2
+ attackmap_analyzer_rust/analyzer.py,sha256=Ab5QmpS0CjLCQgk-rqJpkqj113trAqo_ld4cA3i3J0I,35631
3
+ attackmap_analyzer_rust/frameworks.py,sha256=dyrh8jtkUaxpli1kdJjkq7qsYm8BaV84Co_VhqcBe74,6469
4
+ attackmap_analyzer_rust/route_auth.py,sha256=b6S8SvyFEXsjWUzG82ssP6_DKKqPzTPLB8sf4bqVzK4,19019
5
+ attackmap_analyzer_rust/routing.py,sha256=4yYJpzim-vgmrv8DOAMqFjPSA5S7f6-VEYraIboBI7g,39455
6
+ attackmap_analyzer_rust-0.2.0.dist-info/licenses/LICENSE,sha256=vtPQVGUyxq359j0JmD3_eJaXyHmaHyjzaMOtaLwJc88,1097
7
+ attackmap_analyzer_rust-0.2.0.dist-info/METADATA,sha256=qKUo5HTfh42wSKY7Z53jJYVaS9ce2aGvgHNhEjFFPhE,8688
8
+ attackmap_analyzer_rust-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
9
+ attackmap_analyzer_rust-0.2.0.dist-info/entry_points.txt,sha256=QCFC6xBuNBgFX_DBilz_B2ZJP1jMMeoqy_3jXKCHx0c,66
10
+ attackmap_analyzer_rust-0.2.0.dist-info/top_level.txt,sha256=VTNwgVcQmqxAjpCDx35w9CbzaQZR9Mmohxt7Z6PtJuM,24
11
+ attackmap_analyzer_rust-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [attackmap.analyzers]
2
+ rust = attackmap_analyzer_rust:RustAnalyzer
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Matthew Davis and AttackMap Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ attackmap_analyzer_rust