attackmap-analyzer-php-laminas 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,97 @@
1
+ Metadata-Version: 2.4
2
+ Name: attackmap-analyzer-php-laminas
3
+ Version: 0.2.0
4
+ Summary: Framework-aware Laminas 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-php-laminas
10
+ Project-URL: Repository, https://github.com/mlaify/attackmap-analyzer-php-laminas
11
+ Project-URL: Issues, https://github.com/mlaify/attackmap-analyzer-php-laminas/issues
12
+ Project-URL: Changelog, https://github.com/mlaify/attackmap-analyzer-php-laminas/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-php-laminas
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
+ Framework-aware Laminas analyzer for [AttackMap](https://github.com/mlaify/AttackMap).
51
+
52
+ This module focuses on structured signal extraction for Laminas/Zend MVC projects:
53
+
54
+ - route paths from the `'router' => ['routes' => [...]]` config tree, walked structurally (see [Routes](#routes)); route *names* such as navigation's `'route' => 'home'` are not routes
55
+ - Mezzio/Expressive routes (`$app->get('/x', ...)`, `->post/put/patch/delete/any`, `$app->route('/x', $mw, ['GET', 'POST'])`) in files that reference `Mezzio\` or `Zend\Expressive\`
56
+ - controller mapping hints
57
+ - service-manager mapping hints
58
+ - broad PHP security signals (outbound calls, datastore, auth, secret hints)
59
+
60
+ ## Analyzer identity
61
+
62
+ - `name`: `php-laminas`
63
+ - `display_name`: `PHP Laminas Analyzer`
64
+ - `version`: `0.1.0`
65
+ - `experimental`: `true`
66
+ - `enabled_by_default`: `false`
67
+
68
+ ## Detection
69
+
70
+ `detect(repo_path)` returns true when one or more Laminas indicators exist:
71
+
72
+ - composer dependencies beginning with `laminas/`, `zendframework/` or `mezzio/`
73
+ - a `module/` directory together with `config/application.config.php`
74
+ - any `module.config.php` outside `vendor/` (and the other shared skip dirs)
75
+
76
+ A generic `src/`, `app/` or `config/` directory on its own is not enough.
77
+
78
+ ## Routes
79
+
80
+ Router config is read with a small PHP-array tokenizer (`phparray.py`) that balances `[`/`]` and `array(`/`)` and skips strings, heredocs and comments, so a route is reported with its full path:
81
+
82
+ - **`child_routes` are joined** onto the parent path: `'/admin'` → `'/users'` → `'/:id'` is `/admin/users/:id`. A parent with children is itself a route only with `'may_terminate' => true`.
83
+ - **Method routes** (`'type' => Method::class, 'options' => ['verb' => 'post']`, or `'get,head'`) set the HTTP method on the parent's path instead of adding a path.
84
+ - **Segment optional parts are expanded progressively**: the minimal form, then one more optional group opened at a time in source order, at most 4 paths per route. `/:controller[/:action[/:id]]` gives `/:controller`, `/:controller/:action` and `/:controller/:action/:id`; sibling groups `[/a][/b]` give `''`, `/a`, `/a/b` (not `/b` alone). A child path joins the parent's *maximal* form, because Laminas' parent route consumes its optional parts greedily and never backs off (`/h[/:action]` + `/x` is reachable only as `/h/:action/x`); a child that can match nothing (`[/:id]`) keeps every parent form (`/h`, `/h/:action`, `/h/:action/:id`). A trailing `[/]` doesn't add a path; `:id{-}` delimiters and translated `{literal}` parts are normalized.
85
+ - `Regex` routes use their `spec` (`%id%` → `:id`); `Hostname`/`Scheme` routes add no path; Part, Wildcard, Query and console routes are skipped.
86
+ - **Config merged across modules**: a module's `'admin' => ['child_routes' => [...]]` stub (no type or route of its own) joins onto the `admin` route another module defines, as Laminas' config merge does. A stub extending a route no file defines is skipped.
87
+ - A file that only `return`s a route map (required from a router config) is walked too, and `'router' => $router` / `'routes' => $routes` follow a same-file `$routes = [...]` assignment.
88
+ - Method children apply to every expanded form of the parent: `/user[/:id]` with a `delete` child gives `DELETE /user` and `DELETE /user/:id`.
89
+ - Any `'route' => '/path'` literal the walk didn't reach (routes built with `array_merge`, in loops, or past the tokenizer's 500k-token cap) keeps the flat match, except literals inside a `child_routes` array, which are only fragments of a path.
90
+
91
+ Non-UTF-8 sources (cp1252/latin-1, common in ZF1/ZF2 code) are decoded by `attackmap.sdk.read_source` rather than skipped.
92
+
93
+ ## Notes
94
+
95
+ This analyzer is heuristic and intentionally avoids AST parsing in this first iteration.
96
+
97
+ Secret hints are env var names (`getenv`, `$_ENV`, `$_SERVER`) containing `SECRET`, `TOKEN`, `KEY`, `PASSWORD` or `PASSWD`, matched case-sensitively; `DB_HOST`-style connection settings are not secrets. `jwt` needs a JWT library (`Firebase\JWT\JWT`, `JWT::decode/encode`, `Lcobucci\JWT`, `tymon/jwt-auth`), and `auth` needs the `Auth::` facade or a chained `auth()->…` helper.
@@ -0,0 +1,10 @@
1
+ attackmap_analyzer_php_laminas/__init__.py,sha256=_ksMXWIt_rSuUp9qBx-c76zK7BVZ4zDN5uTCVY9J28o,138
2
+ attackmap_analyzer_php_laminas/analyzer.py,sha256=MMAX3bpTk8bgzlMTmGxELfeG0NObkURJwR9Q7VNhk_M,16626
3
+ attackmap_analyzer_php_laminas/phparray.py,sha256=g4BP6v-WPsL8znPlWb1e_wJRiHaQQaFRLDX7Sp_QEt8,15561
4
+ attackmap_analyzer_php_laminas/routes.py,sha256=ohbKXNGYWhELQlJlIzrFz71PdQEySTt3CRSirnNhVow,22860
5
+ attackmap_analyzer_php_laminas-0.2.0.dist-info/licenses/LICENSE,sha256=vtPQVGUyxq359j0JmD3_eJaXyHmaHyjzaMOtaLwJc88,1097
6
+ attackmap_analyzer_php_laminas-0.2.0.dist-info/METADATA,sha256=UViCmUI7xiaLWQ9ftB1PB2w029DB5OhavzbLd0S1J8c,6441
7
+ attackmap_analyzer_php_laminas-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
8
+ attackmap_analyzer_php_laminas-0.2.0.dist-info/entry_points.txt,sha256=CIQ2tQZ9jtJ_6VaH97xijB3ZdhSUxw2Iul3Mf-3nxrQ,86
9
+ attackmap_analyzer_php_laminas-0.2.0.dist-info/top_level.txt,sha256=QWrIbf38wt3JHLIdPJ1KP6CsLr2vIH2B0KqJ2hQ3PQk,31
10
+ attackmap_analyzer_php_laminas-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
+ php_laminas = attackmap_analyzer_php_laminas:PhpLaminasAnalyzer
@@ -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_php_laminas