attackmap-analyzer-node-service 0.3.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.
- attackmap_analyzer_node_service/__init__.py +3 -0
- attackmap_analyzer_node_service/analyzer.py +1149 -0
- attackmap_analyzer_node_service/modules.py +366 -0
- attackmap_analyzer_node_service/route_auth.py +1553 -0
- attackmap_analyzer_node_service-0.3.0.dist-info/METADATA +104 -0
- attackmap_analyzer_node_service-0.3.0.dist-info/RECORD +10 -0
- attackmap_analyzer_node_service-0.3.0.dist-info/WHEEL +5 -0
- attackmap_analyzer_node_service-0.3.0.dist-info/entry_points.txt +2 -0
- attackmap_analyzer_node_service-0.3.0.dist-info/licenses/LICENSE +21 -0
- attackmap_analyzer_node_service-0.3.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: attackmap-analyzer-node-service
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Broad Node.js/TypeScript service analyzer plugin for AttackMap
|
|
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-node-service
|
|
10
|
+
Project-URL: Repository, https://github.com/mlaify/attackmap-analyzer-node-service
|
|
11
|
+
Project-URL: Issues, https://github.com/mlaify/attackmap-analyzer-node-service/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/mlaify/attackmap-analyzer-node-service/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 Node Service Analyzer
|
|
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
|
+
`attackmap-analyzer-node-service` is a broad Node.js/TypeScript backend analyzer module for AttackMap.
|
|
51
|
+
|
|
52
|
+
It is designed for distributed service repositories and emits structured scan signals for:
|
|
53
|
+
- service identity and role hints
|
|
54
|
+
- route and handler registration hints
|
|
55
|
+
- outbound HTTP and env-configured service URLs
|
|
56
|
+
- datastore and storage usage hints
|
|
57
|
+
- auth/signing/token hints
|
|
58
|
+
- lightweight inter-service edge hints
|
|
59
|
+
|
|
60
|
+
This analyzer is intentionally heuristic and incremental. It is not Bluesky-specific.
|
|
61
|
+
|
|
62
|
+
### Mount paths (#4)
|
|
63
|
+
|
|
64
|
+
Routes carry the prefixes of every router mount above them, across files:
|
|
65
|
+
|
|
66
|
+
- Express / Koa `X.use('/prefix', [mw...,] router)`, Hono `X.route('/prefix', sub)` and `X.basePath('/prefix')`, Elysia `new Elysia({ prefix })` and `X.group('/prefix', (g) => ...)`, Koa `new Router({ prefix })`, and Fastify `X.register(plugin, { prefix })` (ignored for `fastify-plugin` wrapped plugins, as Fastify does);
|
|
67
|
+
- a router mounted at two prefixes gives one route per path, each with its own auth;
|
|
68
|
+
- route functions called with the app (`require('./routes/users')(app)`, `usersRoutes(app)`) register on it;
|
|
69
|
+
- chained calls count like separate statements: `new Hono().use(mw).get('/x', h).route('/y', sub)`;
|
|
70
|
+
- Fastify's full form `X.route({ method, url })` and NestJS `@Controller({ path })` are routes too.
|
|
71
|
+
|
|
72
|
+
Imports are followed through `require(...)` (including inline `app.use('/x', require('./x'))`), default / named / namespace `import`s, barrel re-exports (`export { x } from './x'`, `export * from`), `index` files, `compilerOptions.paths` / `baseUrl` from the nearest `tsconfig.json` / `jsconfig.json` (and relative `extends`), and workspace packages by their `package.json` name. Nothing outside the repo is read. Mounts made in test files are ignored. A router that no visible code mounts keeps its file-local path.
|
|
73
|
+
|
|
74
|
+
### Route auth (AttackMap#256)
|
|
75
|
+
|
|
76
|
+
Express, Koa, Hono, Elysia, Fastify and NestJS routes carry `auth` (`required` / `anonymous` / `unknown`), `guards` and `guard_evidence`:
|
|
77
|
+
|
|
78
|
+
- **`required`**:
|
|
79
|
+
- route-local auth middleware: `router.post('/x', requireAuth, h)`, arrays, `router.route('/x').post(mw, h)`, and route options `{ preHandler | onRequest | beforeHandle: [...] }`; a registration made only of guards (`app.get('/x', isAuthorized())`) guards that path;
|
|
80
|
+
- an earlier `X.use([path,] mw)`, `X.all('*', mw)`, Fastify `addHook('onRequest' | 'preHandler', mw)` or Elysia `onBeforeHandle(mw)` / `guard({ beforeHandle }, ...)` on the route's router, or on any router that mounts it (with the mount's own middleware);
|
|
81
|
+
- NestJS `@UseGuards(...)` on the method or controller, or a global `useGlobalGuards(...)` / `APP_GUARD`. A metadata-driven role guard (`RolesGuard`, `PermissionsGuard`) counts only next to its `@Roles(...)` / `@Permissions(...)` metadata.
|
|
82
|
+
- **`anonymous`**:
|
|
83
|
+
- a route whose full path is listed in a guard's `.unless({ path: ['/login', ...] })`;
|
|
84
|
+
- a NestJS `@Public()` / `@SkipAuth()` / `@AllowAnonymous()` / `@SetMetadata('isPublic', true)` route, unless a guard is Passport's own `AuthGuard('...')`, which ignores that metadata.
|
|
85
|
+
- **`unknown`**: everything else. That includes `optionalAuth`-style middleware and NestJS `Optional...` guards, `.unless` lists with regexes or other keys, routers mounted somewhere the analyzer can't see, and middleware registered after the route.
|
|
86
|
+
|
|
87
|
+
Middleware counts as a guard by name: authentication (`requireAuth`, `authenticate`, `isAuthenticated`, `ensureLoggedIn`, `passport.authenticate(...)`, `expressjwt(...)`, `jwt(...)`, `verifyToken`, `bearerAuth(...)`, `fastify.authenticate`) or a role / permission check (`requireRole('admin')`, `isAdmin`, `authorize('admin')`, `checkPermissions`, `guard.check([...])`), which stays visible in `guards` for AttackMap's function-level authorization check. An inline hook that calls `request.jwtVerify()` counts too. Rate limiters, body parsers, CORS / CSRF / helmet, `optional` / `skip` / `public` variants and trackers such as `updateAuthenticatedUsers` don't.
|
|
88
|
+
|
|
89
|
+
**Not handled yet:** Next.js `middleware.ts` matchers, NestJS `RouterModule` / `setGlobalPrefix`, and dynamic mount paths (`app.use(prefix, router)` with a variable).
|
|
90
|
+
|
|
91
|
+
## Install
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
uv tool install attackmap --with attackmap-analyzer-node-service \
|
|
95
|
+
--index mlaify=https://pkg.mlaify.io/pypi/simple/ --index-strategy first-index
|
|
96
|
+
# or from source:
|
|
97
|
+
pip install git+https://github.com/mlaify/attackmap-analyzer-node-service.git
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Usage
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
attackmap analyze /path/to/repo --module node-service
|
|
104
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
attackmap_analyzer_node_service/__init__.py,sha256=2f30LPbsX_sHS3g8Z3Gw2F2IQLm6KpfNpDQj3KWKUTw,77
|
|
2
|
+
attackmap_analyzer_node_service/analyzer.py,sha256=iGc4GeVo-DA6Nk0oPTXo1zAt4UXvIMr8bU-edZ5RX8U,55174
|
|
3
|
+
attackmap_analyzer_node_service/modules.py,sha256=claU3CwiCHAVB2kUkKyFByeo_WArXjVdsPYO_ZuLUtE,15668
|
|
4
|
+
attackmap_analyzer_node_service/route_auth.py,sha256=0QebU5MynfEJ1aApprkOVHhgjyzbragAhxnR2JGbxC8,71002
|
|
5
|
+
attackmap_analyzer_node_service-0.3.0.dist-info/licenses/LICENSE,sha256=vtPQVGUyxq359j0JmD3_eJaXyHmaHyjzaMOtaLwJc88,1097
|
|
6
|
+
attackmap_analyzer_node_service-0.3.0.dist-info/METADATA,sha256=wIxj_T_s25zMhS9s3vq6wpSbts52VbRMW9ZL3Zv1GOA,6836
|
|
7
|
+
attackmap_analyzer_node_service-0.3.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
8
|
+
attackmap_analyzer_node_service-0.3.0.dist-info/entry_points.txt,sha256=PPfCR-i9If3fa2v7AgkM8Bule6pnvUGqDCkBqLvYEIk,89
|
|
9
|
+
attackmap_analyzer_node_service-0.3.0.dist-info/top_level.txt,sha256=DwrLiRQLyrae24-tVGmY5U58jy2evKwVV5h5_e3xXhc,32
|
|
10
|
+
attackmap_analyzer_node_service-0.3.0.dist-info/RECORD,,
|
|
@@ -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_node_service
|