attackmap-analyzer-atproto 0.1.0__tar.gz

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.

Potentially problematic release.


This version of attackmap-analyzer-atproto might be problematic. Click here for more details.

@@ -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,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: attackmap-analyzer-atproto
3
+ Version: 0.1.0
4
+ Summary: Thin AT Protocol overlay analyzer plugin for AttackMap
5
+ Author: AttackMap Contributors
6
+ Author-email: Matthew Davis <matthewd@matthewd.xyz>
7
+ Maintainer-email: Matthew Davis <matthewd@matthewd.xyz>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/mlaify/attackmap-analyzer-atproto
10
+ Project-URL: Repository, https://github.com/mlaify/attackmap-analyzer-atproto
11
+ Project-URL: Issues, https://github.com/mlaify/attackmap-analyzer-atproto/issues
12
+ Project-URL: Changelog, https://github.com/mlaify/attackmap-analyzer-atproto/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: License :: OSI Approved :: MIT License
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3 :: Only
26
+ Classifier: Topic :: Security
27
+ Classifier: Topic :: Software Development :: Quality Assurance
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.11
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: pydantic>=2.7.0
33
+ Provides-Extra: core
34
+ Requires-Dist: attackmap>=0.1.0; extra == "core"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
37
+ Requires-Dist: build>=1.2.0; extra == "dev"
38
+ Requires-Dist: attackmap>=0.1.0; extra == "dev"
39
+ Dynamic: license-file
40
+
41
+ # AttackMap ATProto Analyzer
42
+
43
+ `attackmap-analyzer-atproto` is a thin protocol-aware overlay analyzer for AttackMap.
44
+
45
+ It is designed to enrich Node/TypeScript service scans (such as `node-service`) with
46
+ AT Protocol-specific exposure signals:
47
+ - protocol namespaces (`com.atproto.*`, `app.bsky.*`)
48
+ - lexicon-inferred XRPC endpoint surface
49
+ - protocol auth/signing/identity hints
50
+ - event stream/subscription exposure hints
51
+ - service notes that complement service-level analyzers
52
+
53
+ This module is heuristic and intentionally lightweight.
54
+
55
+ ## Install
56
+
57
+ ```bash
58
+ pip install git+https://github.com/mlaify/attackmap-analyzer-atproto.git
59
+ ```
60
+
61
+ ## Usage
62
+
63
+ ```bash
64
+ attackmap analyze /path/to/repo --module node-service --module atproto
65
+ ```
@@ -0,0 +1,25 @@
1
+ # AttackMap ATProto Analyzer
2
+
3
+ `attackmap-analyzer-atproto` is a thin protocol-aware overlay analyzer for AttackMap.
4
+
5
+ It is designed to enrich Node/TypeScript service scans (such as `node-service`) with
6
+ AT Protocol-specific exposure signals:
7
+ - protocol namespaces (`com.atproto.*`, `app.bsky.*`)
8
+ - lexicon-inferred XRPC endpoint surface
9
+ - protocol auth/signing/identity hints
10
+ - event stream/subscription exposure hints
11
+ - service notes that complement service-level analyzers
12
+
13
+ This module is heuristic and intentionally lightweight.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ pip install git+https://github.com/mlaify/attackmap-analyzer-atproto.git
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```bash
24
+ attackmap analyze /path/to/repo --module node-service --module atproto
25
+ ```
@@ -0,0 +1,74 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "attackmap-analyzer-atproto"
7
+ version = "0.1.0"
8
+ description = "Thin AT Protocol overlay analyzer plugin for AttackMap"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Matthew Davis", email = "matthewd@matthewd.xyz"},
14
+ {name = "AttackMap Contributors"},
15
+ ]
16
+ maintainers = [
17
+ {name = "Matthew Davis", email = "matthewd@matthewd.xyz"},
18
+ ]
19
+ keywords = [
20
+ "security",
21
+ "static-analysis",
22
+ "appsec",
23
+ "defensive-security",
24
+ "attackmap",
25
+ "attackmap-plugin",
26
+ ]
27
+ classifiers = [
28
+ "Development Status :: 4 - Beta",
29
+ "Intended Audience :: Developers",
30
+ "Intended Audience :: Information Technology",
31
+ "Intended Audience :: System Administrators",
32
+ "License :: OSI Approved :: MIT License",
33
+ "Operating System :: OS Independent",
34
+ "Programming Language :: Python :: 3",
35
+ "Programming Language :: Python :: 3.11",
36
+ "Programming Language :: Python :: 3.12",
37
+ "Programming Language :: Python :: 3.13",
38
+ "Programming Language :: Python :: 3 :: Only",
39
+ "Topic :: Security",
40
+ "Topic :: Software Development :: Quality Assurance",
41
+ "Typing :: Typed",
42
+ ]
43
+ dependencies = [
44
+ "pydantic>=2.7.0",
45
+ ]
46
+
47
+ [project.optional-dependencies]
48
+ core = [
49
+ "attackmap>=0.1.0",
50
+ ]
51
+ dev = [
52
+ "pytest>=8.0.0",
53
+ "build>=1.2.0",
54
+ "attackmap>=0.1.0",
55
+ ]
56
+
57
+ [project.urls]
58
+ Homepage = "https://github.com/mlaify/attackmap-analyzer-atproto"
59
+ Repository = "https://github.com/mlaify/attackmap-analyzer-atproto"
60
+ Issues = "https://github.com/mlaify/attackmap-analyzer-atproto/issues"
61
+ Changelog = "https://github.com/mlaify/attackmap-analyzer-atproto/blob/main/CHANGELOG.md"
62
+ "AttackMap core" = "https://github.com/mlaify/AttackMap"
63
+
64
+ [project.entry-points."attackmap.analyzers"]
65
+ atproto = "attackmap_analyzer_atproto:AtprotoAnalyzer"
66
+
67
+ [tool.setuptools]
68
+ package-dir = {"" = "src"}
69
+
70
+ [tool.setuptools.packages.find]
71
+ where = ["src"]
72
+
73
+ [tool.pytest.ini_options]
74
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ from .analyzer import AtprotoAnalyzer
2
+
3
+ __all__ = ["AtprotoAnalyzer"]
@@ -0,0 +1,257 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import re
5
+ from pathlib import Path
6
+
7
+ from .contracts import AnalyzerMetadata, AuthHint, ExternalCall, Route, ScanResult, SecretHint
8
+
9
+ CODE_SUFFIXES = {".ts", ".tsx", ".js", ".mjs", ".cjs", ".json"}
10
+ SKIP_DIRS = {"node_modules", ".git", "dist", "build", ".next"}
11
+
12
+ NAMESPACE_PATTERN = re.compile(r"\b((?:com\.atproto|app\.bsky)(?:\.[a-z0-9_]+){1,})\b", re.IGNORECASE)
13
+ XRPC_LITERAL_PATTERN = re.compile(r"['\"](?:https?://[^'\"]+)?/xrpc/((?:com\.atproto|app\.bsky)\.[a-z0-9_.]+)['\"]", re.IGNORECASE)
14
+ ENV_URL_PATTERN = re.compile(r"process\.env\.([A-Z0-9_]+_URL)\b")
15
+
16
+ AUTH_HINT_PATTERNS = [
17
+ (re.compile(r"\bjwt\b|\bjsonwebtoken\b", re.IGNORECASE), "atproto_auth:jwt"),
18
+ (re.compile(r"\bserviceauth\b|\bservice_auth\b", re.IGNORECASE), "atproto_auth:service_auth"),
19
+ (re.compile(r"\bdid:[a-z0-9:._-]+\b", re.IGNORECASE), "atproto_identity:did_reference"),
20
+ (re.compile(r"\bplc\b", re.IGNORECASE), "atproto_identity:plc"),
21
+ (re.compile(r"\bsign(?:ing|ature)?\b|\bverify(?:ing|signature)?\b", re.IGNORECASE), "atproto_crypto:signing"),
22
+ (re.compile(r"\brepo\b.*\bcommit\b|\bcommit\b.*\brepo\b", re.IGNORECASE), "atproto_repo:commit_flow"),
23
+ ]
24
+
25
+ EVENT_STREAM_PATTERNS = [
26
+ (re.compile(r"\bsubscriberepos\b", re.IGNORECASE), "atproto_event_stream:subscribe_repos"),
27
+ (re.compile(r"\bwebsocket\b|\bws://\b|\bwss://\b", re.IGNORECASE), "atproto_event_stream:websocket"),
28
+ (re.compile(r"\bfirehose\b", re.IGNORECASE), "atproto_event_stream:firehose"),
29
+ ]
30
+
31
+
32
+ class AtprotoAnalyzer:
33
+ metadata = AnalyzerMetadata(
34
+ name="atproto",
35
+ display_name="AT Protocol Analyzer",
36
+ version="0.1.0",
37
+ description="Thin protocol-aware overlay analyzer for AT Protocol namespace and XRPC exposure.",
38
+ scope="AT Protocol repositories with lexicons, XRPC namespace usage, and protocol auth/identity cues.",
39
+ targets=["atproto", "bluesky", "xrpc"],
40
+ languages=["typescript", "javascript", "json"],
41
+ priority=35,
42
+ experimental=True,
43
+ enabled_by_default=False,
44
+ )
45
+
46
+ @property
47
+ def name(self) -> str:
48
+ return self.metadata.name
49
+
50
+ def detect(self, repo_path: str | Path) -> bool:
51
+ root = Path(repo_path).resolve()
52
+ if not root.exists() or not root.is_dir():
53
+ return False
54
+
55
+ if (root / "lexicons").is_dir():
56
+ return True
57
+
58
+ for file_path in root.rglob("*"):
59
+ if not file_path.is_file():
60
+ continue
61
+ if any(part in SKIP_DIRS for part in file_path.parts):
62
+ continue
63
+ path_text = str(file_path).lower()
64
+ if "com.atproto" in path_text or "app.bsky" in path_text:
65
+ return True
66
+ if file_path.suffix not in CODE_SUFFIXES:
67
+ continue
68
+ content = self._read_text(file_path)
69
+ if not content:
70
+ continue
71
+ if (
72
+ "com.atproto." in content
73
+ or "app.bsky." in content
74
+ or "/xrpc/" in content
75
+ or "lexicon" in content.lower()
76
+ ):
77
+ return True
78
+ return False
79
+
80
+ def analyze(self, repo_path: str | Path) -> ScanResult:
81
+ root = Path(repo_path).resolve()
82
+ result = ScanResult(root=str(root))
83
+ if not root.exists() or not root.is_dir():
84
+ return result
85
+
86
+ lexicon_files = list(root.rglob("lexicons/**/*.json")) if (root / "lexicons").is_dir() else []
87
+ for lexicon_path in lexicon_files:
88
+ if any(part in SKIP_DIRS for part in lexicon_path.parts):
89
+ continue
90
+ result.files_scanned += 1
91
+ self._append_language(result, "json")
92
+ relative = str(lexicon_path.relative_to(root))
93
+ self._extract_lexicon_signals(lexicon_path, relative, result)
94
+
95
+ for file_path in root.rglob("*"):
96
+ if not file_path.is_file():
97
+ continue
98
+ if file_path in lexicon_files:
99
+ continue
100
+ if file_path.suffix not in CODE_SUFFIXES:
101
+ continue
102
+ if any(part in SKIP_DIRS for part in file_path.parts):
103
+ continue
104
+
105
+ result.files_scanned += 1
106
+ self._append_language(result, "typescript" if file_path.suffix in {".ts", ".tsx"} else ("javascript" if file_path.suffix in {".js", ".mjs", ".cjs"} else "json"))
107
+ content = self._read_text(file_path)
108
+ if content is None:
109
+ continue
110
+ relative = str(file_path.relative_to(root))
111
+
112
+ self._extract_namespace_signals(content, relative, result)
113
+ self._extract_xrpc_literals(content, relative, result)
114
+ self._extract_protocol_hints(content, relative, result)
115
+ self._extract_event_stream_hints(content, relative, result)
116
+ self._extract_env_url_signals(content, relative, result)
117
+ self._extract_service_notes(relative, result)
118
+ self._extract_secret_hints(content, relative, result)
119
+
120
+ result.languages.sort()
121
+ return result
122
+
123
+ def _extract_lexicon_signals(self, lexicon_path: Path, relative: str, result: ScanResult) -> None:
124
+ try:
125
+ data = json.loads(lexicon_path.read_text(encoding="utf-8"))
126
+ except (UnicodeDecodeError, json.JSONDecodeError):
127
+ return
128
+
129
+ lexicon_id = data.get("id")
130
+ if isinstance(lexicon_id, str) and lexicon_id:
131
+ namespace_root = self._namespace_root(lexicon_id)
132
+ if namespace_root:
133
+ self._append_unique_auth(result, f"atproto_namespace:{namespace_root}", relative)
134
+ self._append_unique_auth(result, f"atproto_lexicon:{lexicon_id}", relative)
135
+ self._append_unique_route(result, f"/xrpc/{lexicon_id}", "ANY", relative)
136
+
137
+ defs = data.get("defs")
138
+ if isinstance(defs, dict):
139
+ for _, value in defs.items():
140
+ if not isinstance(value, dict):
141
+ continue
142
+ def_type = str(value.get("type", "")).lower()
143
+ if def_type in {"query", "procedure", "subscription"} and isinstance(lexicon_id, str):
144
+ method = "SUBSCRIBE" if def_type == "subscription" else "ANY"
145
+ self._append_unique_route(result, f"/xrpc/{lexicon_id}", method, relative)
146
+ if def_type == "subscription":
147
+ self._append_unique_auth(result, "atproto_event_stream:subscription_lexicon", relative)
148
+
149
+ def _extract_namespace_signals(self, content: str, relative: str, result: ScanResult) -> None:
150
+ for match in NAMESPACE_PATTERN.finditer(content):
151
+ namespace = match.group(1)
152
+ namespace_root = self._namespace_root(namespace)
153
+ if namespace_root:
154
+ self._append_unique_auth(result, f"atproto_namespace:{namespace_root}", relative)
155
+ self._append_unique_auth(result, f"atproto_namespace_ref:{namespace}", relative)
156
+
157
+ def _extract_xrpc_literals(self, content: str, relative: str, result: ScanResult) -> None:
158
+ for match in XRPC_LITERAL_PATTERN.finditer(content):
159
+ ns = match.group(1)
160
+ self._append_unique_route(result, f"/xrpc/{ns}", "ANY", relative)
161
+ self._append_unique_auth(result, f"atproto_xrpc_ref:{ns}", relative)
162
+
163
+ def _extract_protocol_hints(self, content: str, relative: str, result: ScanResult) -> None:
164
+ lowered = content.lower()
165
+ if "xrpc" in lowered:
166
+ self._append_unique_auth(result, "atproto_protocol:xrpc", relative)
167
+ for pattern, hint in AUTH_HINT_PATTERNS:
168
+ if pattern.search(content):
169
+ self._append_unique_auth(result, hint, relative)
170
+
171
+ def _extract_event_stream_hints(self, content: str, relative: str, result: ScanResult) -> None:
172
+ for pattern, hint in EVENT_STREAM_PATTERNS:
173
+ if pattern.search(content):
174
+ self._append_unique_auth(result, hint, relative)
175
+
176
+ def _extract_env_url_signals(self, content: str, relative: str, result: ScanResult) -> None:
177
+ for match in ENV_URL_PATTERN.finditer(content):
178
+ env_name = match.group(1)
179
+ self._append_unique_external(result, f"env://{env_name}", relative)
180
+ service_target = self._service_target_from_env(env_name)
181
+ if service_target:
182
+ self._append_unique_auth(result, f"atproto_service_edge:{service_target}", relative)
183
+
184
+ def _extract_service_notes(self, relative: str, result: ScanResult) -> None:
185
+ normalized = relative.replace("\\", "/")
186
+ parts = normalized.split("/")
187
+ for root in ("services", "packages"):
188
+ if root in parts:
189
+ idx = parts.index(root)
190
+ if idx + 1 < len(parts):
191
+ self._append_unique_auth(result, f"atproto_service_note:{parts[idx + 1].lower()}", relative)
192
+ return
193
+
194
+ def _extract_secret_hints(self, content: str, relative: str, result: ScanResult) -> None:
195
+ for pattern in [
196
+ re.compile(r"process\.env\.([A-Z0-9_]*(?:SECRET|TOKEN|KEY|PASSWORD|SIGNING)[A-Z0-9_]*)"),
197
+ re.compile(r"['\"]([A-Z0-9_]*(?:SECRET|TOKEN|KEY|PASSWORD|SIGNING)[A-Z0-9_]*)['\"]"),
198
+ ]:
199
+ for match in pattern.finditer(content):
200
+ self._append_unique_secret(result, match.group(1), relative)
201
+
202
+ @staticmethod
203
+ def _namespace_root(namespace: str) -> str | None:
204
+ lowered = namespace.lower()
205
+ if lowered.startswith("com.atproto"):
206
+ return "com.atproto"
207
+ if lowered.startswith("app.bsky"):
208
+ return "app.bsky"
209
+ return None
210
+
211
+ @staticmethod
212
+ def _service_target_from_env(env_name: str) -> str | None:
213
+ token = env_name.upper().removesuffix("_URL")
214
+ token = token.replace("__", "_").strip("_")
215
+ if not token:
216
+ return None
217
+ return token.lower().replace("_", "-")
218
+
219
+ @staticmethod
220
+ def _append_language(result: ScanResult, language: str) -> None:
221
+ if language not in result.languages:
222
+ result.languages.append(language)
223
+
224
+ @staticmethod
225
+ def _read_text(path: Path) -> str | None:
226
+ try:
227
+ return path.read_text(encoding="utf-8")
228
+ except UnicodeDecodeError:
229
+ return None
230
+
231
+ @staticmethod
232
+ def _append_unique_route(result: ScanResult, path: str, method: str, file: str) -> None:
233
+ key = (path, method, file)
234
+ if any((item.path, item.method, item.file) == key for item in result.routes):
235
+ return
236
+ result.routes.append(Route(path=path, method=method, file=file))
237
+
238
+ @staticmethod
239
+ def _append_unique_external(result: ScanResult, target: str, file: str) -> None:
240
+ key = (target, file)
241
+ if any((item.target, item.file) == key for item in result.external_calls):
242
+ return
243
+ result.external_calls.append(ExternalCall(target=target, file=file))
244
+
245
+ @staticmethod
246
+ def _append_unique_auth(result: ScanResult, hint: str, file: str) -> None:
247
+ key = (hint, file)
248
+ if any((item.hint, item.file) == key for item in result.auth_hints):
249
+ return
250
+ result.auth_hints.append(AuthHint(hint=hint, file=file))
251
+
252
+ @staticmethod
253
+ def _append_unique_secret(result: ScanResult, name: str, file: str) -> None:
254
+ key = (name, file)
255
+ if any((item.name, item.file) == key for item in result.secret_hints):
256
+ return
257
+ result.secret_hints.append(SecretHint(name=name, file=file))
@@ -0,0 +1,18 @@
1
+ from __future__ import annotations
2
+
3
+ from attackmap.sdk.contracts import AnalyzerMetadata, AnalyzerProtocol
4
+ from attackmap.sdk.models import AuthHint, DatabaseHint, ExternalCall, Route, ScanResult, SecretHint
5
+
6
+ # Compatibility alias used by existing analyzer implementations.
7
+ AttackMapAnalyzerProtocol = AnalyzerProtocol
8
+
9
+ __all__ = [
10
+ "AnalyzerMetadata",
11
+ "AttackMapAnalyzerProtocol",
12
+ "Route",
13
+ "ExternalCall",
14
+ "DatabaseHint",
15
+ "AuthHint",
16
+ "SecretHint",
17
+ "ScanResult",
18
+ ]
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: attackmap-analyzer-atproto
3
+ Version: 0.1.0
4
+ Summary: Thin AT Protocol overlay analyzer plugin for AttackMap
5
+ Author: AttackMap Contributors
6
+ Author-email: Matthew Davis <matthewd@matthewd.xyz>
7
+ Maintainer-email: Matthew Davis <matthewd@matthewd.xyz>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/mlaify/attackmap-analyzer-atproto
10
+ Project-URL: Repository, https://github.com/mlaify/attackmap-analyzer-atproto
11
+ Project-URL: Issues, https://github.com/mlaify/attackmap-analyzer-atproto/issues
12
+ Project-URL: Changelog, https://github.com/mlaify/attackmap-analyzer-atproto/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: License :: OSI Approved :: MIT License
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Programming Language :: Python :: 3 :: Only
26
+ Classifier: Topic :: Security
27
+ Classifier: Topic :: Software Development :: Quality Assurance
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.11
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Requires-Dist: pydantic>=2.7.0
33
+ Provides-Extra: core
34
+ Requires-Dist: attackmap>=0.1.0; extra == "core"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
37
+ Requires-Dist: build>=1.2.0; extra == "dev"
38
+ Requires-Dist: attackmap>=0.1.0; extra == "dev"
39
+ Dynamic: license-file
40
+
41
+ # AttackMap ATProto Analyzer
42
+
43
+ `attackmap-analyzer-atproto` is a thin protocol-aware overlay analyzer for AttackMap.
44
+
45
+ It is designed to enrich Node/TypeScript service scans (such as `node-service`) with
46
+ AT Protocol-specific exposure signals:
47
+ - protocol namespaces (`com.atproto.*`, `app.bsky.*`)
48
+ - lexicon-inferred XRPC endpoint surface
49
+ - protocol auth/signing/identity hints
50
+ - event stream/subscription exposure hints
51
+ - service notes that complement service-level analyzers
52
+
53
+ This module is heuristic and intentionally lightweight.
54
+
55
+ ## Install
56
+
57
+ ```bash
58
+ pip install git+https://github.com/mlaify/attackmap-analyzer-atproto.git
59
+ ```
60
+
61
+ ## Usage
62
+
63
+ ```bash
64
+ attackmap analyze /path/to/repo --module node-service --module atproto
65
+ ```
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/attackmap_analyzer_atproto/__init__.py
5
+ src/attackmap_analyzer_atproto/analyzer.py
6
+ src/attackmap_analyzer_atproto/contracts.py
7
+ src/attackmap_analyzer_atproto.egg-info/PKG-INFO
8
+ src/attackmap_analyzer_atproto.egg-info/SOURCES.txt
9
+ src/attackmap_analyzer_atproto.egg-info/dependency_links.txt
10
+ src/attackmap_analyzer_atproto.egg-info/entry_points.txt
11
+ src/attackmap_analyzer_atproto.egg-info/requires.txt
12
+ src/attackmap_analyzer_atproto.egg-info/top_level.txt
13
+ tests/test_atproto_analyzer.py
@@ -0,0 +1,2 @@
1
+ [attackmap.analyzers]
2
+ atproto = attackmap_analyzer_atproto:AtprotoAnalyzer
@@ -0,0 +1,9 @@
1
+ pydantic>=2.7.0
2
+
3
+ [core]
4
+ attackmap>=0.1.0
5
+
6
+ [dev]
7
+ pytest>=8.0.0
8
+ build>=1.2.0
9
+ attackmap>=0.1.0
@@ -0,0 +1,69 @@
1
+ from pathlib import Path
2
+
3
+ from attackmap.sdk.contracts import AnalyzerMetadata as SharedAnalyzerMetadata
4
+ from attackmap.sdk.models import ScanResult as SharedScanResult
5
+ from attackmap_analyzer_atproto.contracts import AnalyzerMetadata, ScanResult
6
+ from attackmap_analyzer_atproto import AtprotoAnalyzer
7
+
8
+ FIXTURES = Path(__file__).parent / "fixtures"
9
+
10
+
11
+ def test_contracts_use_shared_sdk_types() -> None:
12
+ assert AnalyzerMetadata is SharedAnalyzerMetadata
13
+ assert ScanResult is SharedScanResult
14
+
15
+
16
+ def test_metadata_contains_required_fields() -> None:
17
+ analyzer = AtprotoAnalyzer()
18
+ metadata = analyzer.metadata
19
+
20
+ assert metadata.name == "atproto"
21
+ assert metadata.display_name == "AT Protocol Analyzer"
22
+ assert metadata.version == "0.1.0"
23
+ assert metadata.description
24
+ assert metadata.scope
25
+ assert "atproto" in metadata.targets
26
+ assert "json" in metadata.languages
27
+
28
+
29
+ def test_detect_identifies_atproto_style_repo() -> None:
30
+ analyzer = AtprotoAnalyzer()
31
+ assert analyzer.detect(FIXTURES / "atproto_like_repo") is True
32
+
33
+
34
+ def test_analyze_extracts_protocol_surface_and_hints() -> None:
35
+ analyzer = AtprotoAnalyzer()
36
+ result = analyzer.analyze(FIXTURES / "atproto_like_repo")
37
+
38
+ route_keys = {(route.path, route.method) for route in result.routes}
39
+ auth_hints = {hint.hint for hint in result.auth_hints}
40
+ external_targets = {call.target for call in result.external_calls}
41
+ secret_names = {secret.name for secret in result.secret_hints}
42
+
43
+ assert ("/xrpc/com.atproto.server.createSession", "ANY") in route_keys
44
+ assert ("/xrpc/com.atproto.sync.subscribeRepos", "SUBSCRIBE") in route_keys
45
+
46
+ assert "atproto_namespace:com.atproto" in auth_hints
47
+ assert "atproto_namespace:app.bsky" in auth_hints
48
+ assert "atproto_protocol:xrpc" in auth_hints
49
+ assert "atproto_event_stream:subscription_lexicon" in auth_hints
50
+ assert "atproto_identity:did_reference" in auth_hints
51
+ assert "atproto_crypto:signing" in auth_hints
52
+ assert "atproto_service_note:pds" in auth_hints
53
+
54
+ assert "env://RELAY_URL" in external_targets
55
+ assert "REPO_SIGNING_KEY" in secret_names
56
+
57
+
58
+ def test_analyze_returns_core_compatible_scan_shape() -> None:
59
+ analyzer = AtprotoAnalyzer()
60
+ result = analyzer.analyze(FIXTURES / "atproto_like_repo")
61
+
62
+ assert isinstance(result.root, str)
63
+ assert isinstance(result.files_scanned, int)
64
+ assert isinstance(result.languages, list)
65
+ assert hasattr(result, "routes")
66
+ assert hasattr(result, "external_calls")
67
+ assert hasattr(result, "databases")
68
+ assert hasattr(result, "auth_hints")
69
+ assert hasattr(result, "secret_hints")