@teevee98/synapse-hub 4.3.0 → 4.4.0
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.
- package/.agents/agents/api-engineer.md +8 -0
- package/.agents/agents/perf-engineer.md +10 -2
- package/.agents/hooks/session_start.py +52 -0
- package/.agents/hooks.json +12 -0
- package/.agents/rules/performance_testing_rules.md +4 -3
- package/.agents/skills/01-web-automation/clean-pom-crafter/SKILL.md +6 -3
- package/.agents/skills/01-web-automation/e2e-testing-patterns/SKILL.md +3 -1
- package/.agents/skills/02-test-design/rbt-manual-testing/SKILL.md +11 -5
- package/.agents/skills/04-performance-and-load/backend-load-and-stress-patterns/SKILL.md +4 -1
- package/.agents/skills/04-performance-and-load/backend-load-and-stress-patterns/references/performance_test_plan_29119.md +106 -0
- package/.agents/skills/04-performance-and-load/web-vitals-and-performance-profiler/SKILL.md +75 -14
- package/.agents/skills/05-security-and-compliance/security-dast-sentinel/SKILL.md +13 -2
- package/.agents/skills/05-security-and-compliance/wcag-audit-patterns/SKILL.md +4 -1
- package/.agents/skills/07-data-and-state/file-and-report-validator/SKILL.md +8 -1
- package/.agents/skills/07-data-and-state/synthetic-test-data-generator/SKILL.md +4 -1
- package/.agents/skills/11-ai-and-prompting/mipro-prompt-compiler/SKILL.md +8 -0
- package/.agents/templates/performance-test-plan-template.md +106 -0
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/agentskills.json +1 -1
- package/docs/ARCHITECTURE.en.md +95 -2
- package/docs/ARCHITECTURE.md +86 -2
- package/docs/TOOL_CATALOG.md +11 -2
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills_manifest.json +1 -1
- package/synapse.config.json +1 -1
- package/tools/.infer_baseline.json +44 -3
- package/tools/TOOLS_RUNBOOK.md +237 -0
- package/tools/TOOL_CATALOG.json +138 -3
- package/tools/__init__.py +1 -1
- package/tools/ai_eval_sentinel.py +403 -0
- package/tools/asvs_auditor.py +410 -0
- package/tools/browser_helpers.js +2 -2
- package/tools/chaos_resilience_probe.py +362 -0
- package/tools/cldr_l10n_verifier.py +309 -0
- package/tools/cli.py +191 -3
- package/tools/cvss_calculator.py +412 -0
- package/tools/dashboard_generator.py +8 -8
- package/tools/dspy_qa_signatures.py +105 -1
- package/tools/etl_data_reconciler.py +460 -0
- package/tools/generate_jmx_plan.py +12 -4
- package/tools/jtl_analyzer.py +23 -1
- package/tools/mcp_docx_server.py +1 -1
- package/tools/mcp_excel_server.py +1 -1
- package/tools/mcp_server.py +1 -1
- package/tools/mobile_resilience_sentinel.py +273 -0
- package/tools/observability_tester.py +235 -0
- package/tools/payment_interop_simulator.py +337 -0
- package/tools/pre_push_guard.py +306 -0
- package/tools/regulatory_compliance.py +336 -0
- package/tools/rules_router.py +1 -1
- package/tools/task_memory_manager.py +12 -1
- package/tools/test_memory_os.py +48 -0
- package/tools/tmmi_auditor.py +172 -0
- package/tools/tot_exploratory_tester.py +17 -0
- package/tools/ui_server.py +1 -1
- package/tools/update_sentinel.py +109 -43
- package/tools/vpat_exporter.py +428 -0
- package/tools/welcome_page.py +1 -1
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright (c) 2026 Thế Vị (@TeeVee98). All rights reserved.
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
# Project: Synapse-Hub (https://github.com/TeeVee98/Synapse-Hub)
|
|
5
|
+
|
|
6
|
+
"""
|
|
7
|
+
tools/asvs_auditor.py — OWASP Application Security Verification Standard (ASVS 4.0.3) Engine
|
|
8
|
+
--------------------------------------------------------------------------------------------
|
|
9
|
+
Implements the OWASP ASVS 4.0.3 verification framework across 14 security chapters
|
|
10
|
+
and 3 verification levels (Level 1: Opportunistic, Level 2: Standard, Level 3: Advanced).
|
|
11
|
+
|
|
12
|
+
Provides:
|
|
13
|
+
1. Complete ASVS 4.0.3 requirement matrix with CWE cross-references.
|
|
14
|
+
2. Automated non-destructive probes for Level-1 verifiable web/API controls
|
|
15
|
+
(Security Headers, CORS, Cookies, TLS enforcement, Error disclosures).
|
|
16
|
+
3. Interactive/Automated compliance checklists and Markdown/JSON reporting.
|
|
17
|
+
|
|
18
|
+
Usage:
|
|
19
|
+
python tools/asvs_auditor.py --probe https://staging.example.com --level 1
|
|
20
|
+
python tools/asvs_auditor.py --probe https://staging.example.com --json report.json
|
|
21
|
+
python tools/asvs_auditor.py --export-checklist asvs_checklist.md --level 2
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
import sys
|
|
25
|
+
import json
|
|
26
|
+
import urllib.request
|
|
27
|
+
import urllib.parse
|
|
28
|
+
import urllib.error
|
|
29
|
+
import ssl
|
|
30
|
+
import argparse
|
|
31
|
+
from typing import Dict, List, Any, Optional
|
|
32
|
+
|
|
33
|
+
# Enforce UTF-8 stdout encoding for Windows console compatibility
|
|
34
|
+
if hasattr(sys.stdout, "reconfigure"):
|
|
35
|
+
try:
|
|
36
|
+
sys.stdout.reconfigure(encoding="utf-8")
|
|
37
|
+
sys.stderr.reconfigure(encoding="utf-8")
|
|
38
|
+
except Exception:
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# ==============================================================================
|
|
43
|
+
# ASVS 4.0.3 CHAPTER DEFINITIONS & CORE MATRIX
|
|
44
|
+
# ==============================================================================
|
|
45
|
+
|
|
46
|
+
ASVS_CHAPTERS = {
|
|
47
|
+
"V1": "Architecture, Design and Threat Modeling",
|
|
48
|
+
"V2": "Authentication",
|
|
49
|
+
"V3": "Session Management",
|
|
50
|
+
"V4": "Access Control",
|
|
51
|
+
"V5": "Malicious Input Handling & Validation",
|
|
52
|
+
"V6": "Cryptography at Rest",
|
|
53
|
+
"V7": "Error Handling and Logging",
|
|
54
|
+
"V8": "Data Protection & Privacy",
|
|
55
|
+
"V9": "Communications & TLS Verification",
|
|
56
|
+
"V10": "Malicious Code & Integrity",
|
|
57
|
+
"V11": "Business Logic",
|
|
58
|
+
"V12": "Files and Resources",
|
|
59
|
+
"V13": "API and Web Service",
|
|
60
|
+
"V14": "Configuration & Security Headers",
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# Curated high-impact ASVS requirements covering L1, L2, L3
|
|
64
|
+
ASVS_REQUIREMENTS = [
|
|
65
|
+
# V1: Architecture
|
|
66
|
+
{"id": "V1.1.1", "chapter": "V1", "level": 1, "cwe": "CWE-1027", "desc": "Verify that secure development lifecycle is followed and threat modeling was performed.", "automated": False},
|
|
67
|
+
{"id": "V1.4.1", "chapter": "V1", "level": 1, "cwe": "CWE-1188", "desc": "Verify that untrusted data from all boundaries is validated or sanitized.", "automated": False},
|
|
68
|
+
|
|
69
|
+
# V2: Authentication
|
|
70
|
+
{"id": "V2.1.1", "chapter": "V2", "level": 1, "cwe": "CWE-521", "desc": "Verify that user passwords are at least 12 characters in length (or 8 for legacy).", "automated": True},
|
|
71
|
+
{"id": "V2.2.1", "chapter": "V2", "level": 1, "cwe": "CWE-307", "desc": "Verify that anti-automation or rate-limiting is in place against brute-force attacks.", "automated": True},
|
|
72
|
+
{"id": "V2.8.1", "chapter": "V2", "level": 2, "cwe": "CWE-308", "desc": "Verify multi-factor authentication (MFA) is supported for privileged accounts.", "automated": False},
|
|
73
|
+
|
|
74
|
+
# V3: Session Management
|
|
75
|
+
{"id": "V3.4.1", "chapter": "V3", "level": 1, "cwe": "CWE-614", "desc": "Verify cookie-based session tokens possess the 'Secure' attribute.", "automated": True},
|
|
76
|
+
{"id": "V3.4.2", "chapter": "V3", "level": 1, "cwe": "CWE-1004", "desc": "Verify cookie-based session tokens possess the 'HttpOnly' attribute.", "automated": True},
|
|
77
|
+
{"id": "V3.4.3", "chapter": "V3", "level": 1, "cwe": "CWE-1275", "desc": "Verify cookie-based session tokens possess 'SameSite=Lax' or 'SameSite=Strict'.", "automated": True},
|
|
78
|
+
{"id": "V3.2.1", "chapter": "V3", "level": 2, "cwe": "CWE-384", "desc": "Verify session tokens are invalidated and renewed upon user authentication/logout.", "automated": True},
|
|
79
|
+
|
|
80
|
+
# V4: Access Control
|
|
81
|
+
{"id": "V4.1.1", "chapter": "V4", "level": 1, "cwe": "CWE-285", "desc": "Verify that the principle of least privilege exists (users only access their own records).", "automated": True},
|
|
82
|
+
{"id": "V4.1.2", "chapter": "V4", "level": 1, "cwe": "CWE-639", "desc": "Verify protection against Broken Object Level Authorization (BOLA/IDOR).", "automated": True},
|
|
83
|
+
{"id": "V4.2.1", "chapter": "V4", "level": 1, "cwe": "CWE-862", "desc": "Verify that sensitive endpoints strictly enforce role-based access control (RBAC).", "automated": True},
|
|
84
|
+
|
|
85
|
+
# V5: Malicious Input Handling
|
|
86
|
+
{"id": "V5.1.1", "chapter": "V5", "level": 1, "cwe": "CWE-20", "desc": "Verify that all input data is validated against a strict allowlist schema.", "automated": True},
|
|
87
|
+
{"id": "V5.3.1", "chapter": "V5", "level": 1, "cwe": "CWE-89", "desc": "Verify protection against SQL Injection using parameterized queries and ORMs.", "automated": True},
|
|
88
|
+
{"id": "V5.3.3", "chapter": "V5", "level": 1, "cwe": "CWE-79", "desc": "Verify context-aware output encoding to prevent Cross-Site Scripting (XSS).", "automated": True},
|
|
89
|
+
|
|
90
|
+
# V6: Cryptography at Rest
|
|
91
|
+
{"id": "V6.2.1", "chapter": "V6", "level": 2, "cwe": "CWE-311", "desc": "Verify sensitive data at rest (passwords, PII, keys) is strongly encrypted using AES-256 or ChaCha20.", "automated": False},
|
|
92
|
+
|
|
93
|
+
# V7: Error Handling and Logging
|
|
94
|
+
{"id": "V7.1.1", "chapter": "V7", "level": 1, "cwe": "CWE-209", "desc": "Verify that error handling does not disclose internal system details, stacktraces, or database queries.", "automated": True},
|
|
95
|
+
{"id": "V7.1.2", "chapter": "V7", "level": 1, "cwe": "CWE-532", "desc": "Verify that log messages do not record secrets, auth tokens, credit cards, or passwords in plain text.", "automated": True},
|
|
96
|
+
|
|
97
|
+
# V8: Data Protection
|
|
98
|
+
{"id": "V8.3.1", "chapter": "V8", "level": 1, "cwe": "CWE-319", "desc": "Verify that sensitive personal data (PII) is masked or tokenized in test environments and logs.", "automated": True},
|
|
99
|
+
|
|
100
|
+
# V9: Communications
|
|
101
|
+
{"id": "V9.1.1", "chapter": "V9", "level": 1, "cwe": "CWE-319", "desc": "Verify that all network traffic enforces TLS 1.2 or TLS 1.3.", "automated": True},
|
|
102
|
+
{"id": "V9.2.1", "chapter": "V9", "level": 1, "cwe": "CWE-523", "desc": "Verify that HTTP Strict Transport Security (HSTS) header is enabled with max-age >= 15768000.", "automated": True},
|
|
103
|
+
|
|
104
|
+
# V10: Malicious Code
|
|
105
|
+
{"id": "V10.3.1", "chapter": "V10", "level": 1, "cwe": "CWE-1395", "desc": "Verify third-party dependencies are scanned for known CVE vulnerabilities.", "automated": True},
|
|
106
|
+
|
|
107
|
+
# V11: Business Logic
|
|
108
|
+
{"id": "V11.1.1", "chapter": "V11", "level": 1, "cwe": "CWE-840", "desc": "Verify that business logic flows cannot be bypassed or executed out of sequence.", "automated": True},
|
|
109
|
+
{"id": "V11.1.4", "chapter": "V11", "level": 1, "cwe": "CWE-362", "desc": "Verify protection against race conditions and double-submits in financial transactions.", "automated": True},
|
|
110
|
+
|
|
111
|
+
# V12: Files and Resources
|
|
112
|
+
{"id": "V12.1.1", "chapter": "V12", "level": 1, "cwe": "CWE-434", "desc": "Verify that uploaded files are validated for MIME type, extension, and scanned for malware.", "automated": True},
|
|
113
|
+
|
|
114
|
+
# V13: API and Web Service
|
|
115
|
+
{"id": "V13.1.1", "chapter": "V13", "level": 1, "cwe": "CWE-306", "desc": "Verify that all API endpoints enforce authentication and valid access tokens.", "automated": True},
|
|
116
|
+
{"id": "V13.2.1", "chapter": "V13", "level": 1, "cwe": "CWE-1027", "desc": "Verify that API schemas conform to published OpenAPI/Swagger specifications.", "automated": True},
|
|
117
|
+
|
|
118
|
+
# V14: Configuration & Headers
|
|
119
|
+
{"id": "V14.4.1", "chapter": "V14", "level": 1, "cwe": "CWE-1021", "desc": "Verify that 'Content-Security-Policy' header is present and restricts script execution.", "automated": True},
|
|
120
|
+
{"id": "V14.4.2", "chapter": "V14", "level": 1, "cwe": "CWE-1021", "desc": "Verify that 'X-Frame-Options' (or CSP frame-ancestors) is set to DENY or SAMEORIGIN.", "automated": True},
|
|
121
|
+
{"id": "V14.4.3", "chapter": "V14", "level": 1, "cwe": "CWE-16", "desc": "Verify that 'X-Content-Type-Options' is set to 'nosniff'.", "automated": True},
|
|
122
|
+
{"id": "V14.4.4", "chapter": "V14", "level": 1, "cwe": "CWE-116", "desc": "Verify that 'Referrer-Policy' is configured safely (e.g., strict-origin-when-cross-origin).", "automated": True},
|
|
123
|
+
{"id": "V14.5.1", "chapter": "V14", "level": 1, "cwe": "CWE-942", "desc": "Verify CORS policy does not reflect untrusted Origins with Access-Control-Allow-Credentials: true.", "automated": True},
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# ==============================================================================
|
|
128
|
+
# AUTOMATED LEVEL-1 VERIFIER PROBE
|
|
129
|
+
# ==============================================================================
|
|
130
|
+
|
|
131
|
+
class ASVSProbeRunner:
|
|
132
|
+
"""Performs passive and safe non-destructive probes against web/API targets."""
|
|
133
|
+
|
|
134
|
+
def __init__(self, target_url: str, timeout: int = 8):
|
|
135
|
+
self.target_url = target_url.strip()
|
|
136
|
+
self.timeout = timeout
|
|
137
|
+
self.headers_observed: Dict[str, str] = {}
|
|
138
|
+
self.cookies_observed: List[str] = []
|
|
139
|
+
self.status_code = 0
|
|
140
|
+
self.is_tls = self.target_url.startswith("https://")
|
|
141
|
+
self.cors_vulnerable = False
|
|
142
|
+
self.verbose_error_detected = False
|
|
143
|
+
|
|
144
|
+
def execute_probe(self) -> Dict[str, Any]:
|
|
145
|
+
"""Dispatches inspection request and analyzes response."""
|
|
146
|
+
results = {}
|
|
147
|
+
req = urllib.request.Request(
|
|
148
|
+
self.target_url,
|
|
149
|
+
headers={"User-Agent": "Synapse-Hub-ASVS-Auditor/4.3.1 (OWASP-Verification)"},
|
|
150
|
+
)
|
|
151
|
+
ctx = ssl.create_default_context()
|
|
152
|
+
|
|
153
|
+
try:
|
|
154
|
+
with urllib.request.urlopen(req, timeout=self.timeout, context=ctx) as resp:
|
|
155
|
+
self.status_code = resp.getcode()
|
|
156
|
+
for k, v in resp.headers.items():
|
|
157
|
+
self.headers_observed[k.lower()] = v
|
|
158
|
+
self.cookies_observed = resp.headers.get_all("set-cookie") or []
|
|
159
|
+
body = resp.read(4096).decode("utf-8", errors="ignore")
|
|
160
|
+
if "stacktrace" in body.lower() or "sqlexception" in body.lower():
|
|
161
|
+
self.verbose_error_detected = True
|
|
162
|
+
except urllib.error.HTTPError as e:
|
|
163
|
+
self.status_code = e.code
|
|
164
|
+
for k, v in e.headers.items():
|
|
165
|
+
self.headers_observed[k.lower()] = v
|
|
166
|
+
self.cookies_observed = e.headers.get_all("set-cookie") or []
|
|
167
|
+
except Exception as e:
|
|
168
|
+
results["error"] = f"Failed to connect to target: {e}"
|
|
169
|
+
return results
|
|
170
|
+
|
|
171
|
+
# Test CORS Reflection (safe non-destructive probe)
|
|
172
|
+
try:
|
|
173
|
+
cors_req = urllib.request.Request(
|
|
174
|
+
self.target_url,
|
|
175
|
+
headers={
|
|
176
|
+
"User-Agent": "Synapse-Hub-ASVS-Auditor/4.3.1",
|
|
177
|
+
"Origin": "https://untrusted-attacker-domain.example",
|
|
178
|
+
},
|
|
179
|
+
)
|
|
180
|
+
with urllib.request.urlopen(cors_req, timeout=self.timeout, context=ctx) as c_resp:
|
|
181
|
+
acao = c_resp.headers.get("Access-Control-Allow-Origin", "")
|
|
182
|
+
acac = c_resp.headers.get("Access-Control-Allow-Credentials", "").lower()
|
|
183
|
+
if "untrusted-attacker-domain" in acao and acac == "true":
|
|
184
|
+
self.cors_vulnerable = True
|
|
185
|
+
except Exception:
|
|
186
|
+
pass
|
|
187
|
+
|
|
188
|
+
return self.evaluate_asvs_controls()
|
|
189
|
+
|
|
190
|
+
def evaluate_asvs_controls(self) -> Dict[str, Any]:
|
|
191
|
+
"""Evaluates observed probe data against ASVS Level 1 requirements."""
|
|
192
|
+
evaluations = {}
|
|
193
|
+
|
|
194
|
+
# V9.1.1 & V9.2.1: TLS & HSTS
|
|
195
|
+
hsts_header = self.headers_observed.get("strict-transport-security", "")
|
|
196
|
+
hsts_pass = self.is_tls and ("max-age=" in hsts_header)
|
|
197
|
+
evaluations["V9.1.1"] = {"status": "PASS" if self.is_tls else "FAIL", "evidence": f"TLS enabled: {self.is_tls}"}
|
|
198
|
+
evaluations["V9.2.1"] = {
|
|
199
|
+
"status": "PASS" if hsts_pass else "FAIL",
|
|
200
|
+
"evidence": f"Strict-Transport-Security: {hsts_header}" if hsts_header else "Header missing",
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
# V14.4.1: Content-Security-Policy
|
|
204
|
+
csp = self.headers_observed.get("content-security-policy", "")
|
|
205
|
+
evaluations["V14.4.1"] = {
|
|
206
|
+
"status": "PASS" if csp else "FAIL",
|
|
207
|
+
"evidence": f"CSP present (length {len(csp)})" if csp else "Content-Security-Policy header missing",
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
# V14.4.2: X-Frame-Options or CSP frame-ancestors
|
|
211
|
+
xfo = self.headers_observed.get("x-frame-options", "").upper()
|
|
212
|
+
frame_safe = ("DENY" in xfo or "SAMEORIGIN" in xfo) or ("frame-ancestors" in csp)
|
|
213
|
+
evaluations["V14.4.2"] = {
|
|
214
|
+
"status": "PASS" if frame_safe else "FAIL",
|
|
215
|
+
"evidence": f"X-Frame-Options: {xfo}" if xfo else "X-Frame-Options missing",
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
# V14.4.3: X-Content-Type-Options: nosniff
|
|
219
|
+
xcto = self.headers_observed.get("x-content-type-options", "").lower()
|
|
220
|
+
evaluations["V14.4.3"] = {
|
|
221
|
+
"status": "PASS" if "nosniff" in xcto else "FAIL",
|
|
222
|
+
"evidence": f"X-Content-Type-Options: {xcto}" if xcto else "Missing 'nosniff'",
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
# V14.4.4: Referrer-Policy
|
|
226
|
+
ref_pol = self.headers_observed.get("referrer-policy", "")
|
|
227
|
+
evaluations["V14.4.4"] = {
|
|
228
|
+
"status": "PASS" if ref_pol else "FAIL",
|
|
229
|
+
"evidence": f"Referrer-Policy: {ref_pol}" if ref_pol else "Referrer-Policy missing",
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
# V14.5.1: CORS
|
|
233
|
+
evaluations["V14.5.1"] = {
|
|
234
|
+
"status": "FAIL" if self.cors_vulnerable else "PASS",
|
|
235
|
+
"evidence": "Insecure CORS reflection with credentials" if self.cors_vulnerable else "CORS policy safe or restrictive",
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
# V3.4.1 - V3.4.3: Cookies
|
|
239
|
+
if self.cookies_observed:
|
|
240
|
+
sec_cookie = all("secure" in c.lower() for c in self.cookies_observed)
|
|
241
|
+
http_only = all("httponly" in c.lower() for c in self.cookies_observed)
|
|
242
|
+
same_site = all("samesite" in c.lower() for c in self.cookies_observed)
|
|
243
|
+
evaluations["V3.4.1"] = {"status": "PASS" if sec_cookie else "FAIL", "evidence": f"Secure flag on {len(self.cookies_observed)} cookies"}
|
|
244
|
+
evaluations["V3.4.2"] = {"status": "PASS" if http_only else "FAIL", "evidence": f"HttpOnly flag on {len(self.cookies_observed)} cookies"}
|
|
245
|
+
evaluations["V3.4.3"] = {"status": "PASS" if same_site else "FAIL", "evidence": "SameSite attribute present on cookies"}
|
|
246
|
+
else:
|
|
247
|
+
evaluations["V3.4.1"] = {"status": "NOT_APPLICABLE", "evidence": "No Set-Cookie headers in response"}
|
|
248
|
+
evaluations["V3.4.2"] = {"status": "NOT_APPLICABLE", "evidence": "No Set-Cookie headers in response"}
|
|
249
|
+
evaluations["V3.4.3"] = {"status": "NOT_APPLICABLE", "evidence": "No Set-Cookie headers in response"}
|
|
250
|
+
|
|
251
|
+
# V7.1.1: Error & Stacktrace disclosure
|
|
252
|
+
evaluations["V7.1.1"] = {
|
|
253
|
+
"status": "FAIL" if self.verbose_error_detected else "PASS",
|
|
254
|
+
"evidence": "Stacktrace / Exception revealed in body" if self.verbose_error_detected else "Zero system leaks observed in response",
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return evaluations
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
# ==============================================================================
|
|
261
|
+
# REPORTING & CHECKLIST GENERATION
|
|
262
|
+
# ==============================================================================
|
|
263
|
+
|
|
264
|
+
def generate_asvs_checklist_markdown(level: int = 1, chapter: Optional[str] = None) -> str:
|
|
265
|
+
"""Generates an interactive Markdown audit checklist for ASVS."""
|
|
266
|
+
lines = [
|
|
267
|
+
f"# OWASP ASVS 4.0.3 Verification Checklist (Level {level})",
|
|
268
|
+
"",
|
|
269
|
+
"> Generated by Synapse Hub ASVS Engine (`tools/asvs_auditor.py`).",
|
|
270
|
+
"",
|
|
271
|
+
]
|
|
272
|
+
|
|
273
|
+
grouped: Dict[str, List[Dict[str, Any]]] = {}
|
|
274
|
+
for req in ASVS_REQUIREMENTS:
|
|
275
|
+
if req["level"] > level:
|
|
276
|
+
continue
|
|
277
|
+
if chapter and req["chapter"] != chapter:
|
|
278
|
+
continue
|
|
279
|
+
c_id = req["chapter"]
|
|
280
|
+
grouped.setdefault(c_id, []).append(req)
|
|
281
|
+
|
|
282
|
+
for c_id, reqs in grouped.items():
|
|
283
|
+
title = ASVS_CHAPTERS.get(c_id, c_id)
|
|
284
|
+
lines.append(f"## Chapter {c_id}: {title}")
|
|
285
|
+
lines.append("")
|
|
286
|
+
lines.append("| Status | ID | Level | CWE | Requirement Description | Verification Method |")
|
|
287
|
+
lines.append("| :---: | :--- | :---: | :--- | :--- | :--- |")
|
|
288
|
+
for r in reqs:
|
|
289
|
+
v_type = "Automated Probe" if r["automated"] else "Manual Review"
|
|
290
|
+
lines.append(f"| [ ] | **{r['id']}** | L{r['level']} | {r['cwe']} | {r['desc']} | {v_type} |")
|
|
291
|
+
lines.append("")
|
|
292
|
+
|
|
293
|
+
return "\n".join(lines)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
def run_asvs_audit(target_url: Optional[str], level: int = 1, chapter: Optional[str] = None) -> Dict[str, Any]:
|
|
297
|
+
"""Runs ASVS audit combining automated probes and structural requirements."""
|
|
298
|
+
probe_results = {}
|
|
299
|
+
if target_url:
|
|
300
|
+
runner = ASVSProbeRunner(target_url)
|
|
301
|
+
probe_results = runner.execute_probe()
|
|
302
|
+
|
|
303
|
+
report_items = []
|
|
304
|
+
total_applicable = 0
|
|
305
|
+
total_passed = 0
|
|
306
|
+
total_failed = 0
|
|
307
|
+
total_na = 0
|
|
308
|
+
total_manual = 0
|
|
309
|
+
|
|
310
|
+
for req in ASVS_REQUIREMENTS:
|
|
311
|
+
if req["level"] > level:
|
|
312
|
+
continue
|
|
313
|
+
if chapter and req["chapter"] != chapter:
|
|
314
|
+
continue
|
|
315
|
+
|
|
316
|
+
item = dict(req)
|
|
317
|
+
item["chapter_title"] = ASVS_CHAPTERS.get(req["chapter"], req["chapter"])
|
|
318
|
+
r_id = req["id"]
|
|
319
|
+
|
|
320
|
+
if r_id in probe_results:
|
|
321
|
+
probe = probe_results[r_id]
|
|
322
|
+
item["status"] = probe["status"]
|
|
323
|
+
item["evidence"] = probe["evidence"]
|
|
324
|
+
if item["status"] == "PASS":
|
|
325
|
+
total_passed += 1
|
|
326
|
+
elif item["status"] == "FAIL":
|
|
327
|
+
total_failed += 1
|
|
328
|
+
elif item["status"] == "NOT_APPLICABLE":
|
|
329
|
+
total_na += 1
|
|
330
|
+
else:
|
|
331
|
+
item["status"] = "MANUAL_VERIFICATION_REQUIRED"
|
|
332
|
+
item["evidence"] = "Requires architecture review, code audit, or functional test."
|
|
333
|
+
total_manual += 1
|
|
334
|
+
|
|
335
|
+
total_applicable += 1
|
|
336
|
+
report_items.append(item)
|
|
337
|
+
|
|
338
|
+
score_pct = (total_passed / (total_passed + total_failed) * 100) if (total_passed + total_failed) > 0 else 0.0
|
|
339
|
+
|
|
340
|
+
return {
|
|
341
|
+
"asvs_version": "4.0.3",
|
|
342
|
+
"target_url": target_url or "Offline Checklist",
|
|
343
|
+
"level": level,
|
|
344
|
+
"compliance_score_pct": round(score_pct, 1),
|
|
345
|
+
"summary": {
|
|
346
|
+
"total_requirements": total_applicable,
|
|
347
|
+
"passed": total_passed,
|
|
348
|
+
"failed": total_failed,
|
|
349
|
+
"not_applicable": total_na,
|
|
350
|
+
"manual_required": total_manual,
|
|
351
|
+
},
|
|
352
|
+
"requirements": report_items,
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
def main():
|
|
357
|
+
parser = argparse.ArgumentParser(
|
|
358
|
+
description="Synapse Hub OWASP ASVS 4.0.3 Verification Engine",
|
|
359
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
360
|
+
)
|
|
361
|
+
parser.add_argument("--probe", help="Target URL to run automated Level 1 ASVS probes against")
|
|
362
|
+
parser.add_argument("--level", type=int, choices=[1, 2, 3], default=1, help="ASVS Verification Level (1: Opportunistic, 2: Standard, 3: Advanced)")
|
|
363
|
+
parser.add_argument("--chapter", help="Filter by Chapter ID (e.g. V1, V3, V14)")
|
|
364
|
+
parser.add_argument("--export-checklist", help="Export Markdown checklist file (e.g. asvs_checklist.md)")
|
|
365
|
+
parser.add_argument("--json", help="Export structured JSON audit report to specified file")
|
|
366
|
+
parser.add_argument("--gate-score", type=float, help="Quality Gate: Fail with exit code 1 if compliance score < threshold")
|
|
367
|
+
|
|
368
|
+
args = parser.parse_args()
|
|
369
|
+
|
|
370
|
+
if args.export_checklist:
|
|
371
|
+
md = generate_asvs_checklist_markdown(level=args.level, chapter=args.chapter)
|
|
372
|
+
with open(args.export_checklist, "w", encoding="utf-8") as f:
|
|
373
|
+
f.write(md)
|
|
374
|
+
print(f"✅ Exported OWASP ASVS Level {args.level} checklist to {args.export_checklist}")
|
|
375
|
+
return 0
|
|
376
|
+
|
|
377
|
+
report = run_asvs_audit(args.probe, level=args.level, chapter=args.chapter)
|
|
378
|
+
|
|
379
|
+
if args.json:
|
|
380
|
+
with open(args.json, "w", encoding="utf-8") as f:
|
|
381
|
+
json.dump(report, f, indent=2, ensure_ascii=False)
|
|
382
|
+
print(f"✅ ASVS audit report saved to {args.json}")
|
|
383
|
+
else:
|
|
384
|
+
print("=" * 70)
|
|
385
|
+
print(" SYNAPSE HUB — OWASP ASVS 4.0.3 SECURITY AUDIT SCORECARD")
|
|
386
|
+
print("=" * 70)
|
|
387
|
+
print(f" Target URL : {report['target_url']}")
|
|
388
|
+
print(f" Target Level : Level {report['level']} (ASVS 4.0.3)")
|
|
389
|
+
print(f" Total Checks : {report['summary']['total_requirements']}")
|
|
390
|
+
print(f" Passed Checks : \033[92m{report['summary']['passed']}\033[0m")
|
|
391
|
+
print(f" Failed Checks : \033[91m{report['summary']['failed']}\033[0m")
|
|
392
|
+
print(f" Manual Review : \033[93m{report['summary']['manual_required']}\033[0m")
|
|
393
|
+
print(f" Compliance Rate: \033[1m{report['compliance_score_pct']}%\033[0m (Automated probes)")
|
|
394
|
+
print("-" * 70)
|
|
395
|
+
|
|
396
|
+
for r in report["requirements"]:
|
|
397
|
+
if r["status"] in ("PASS", "FAIL"):
|
|
398
|
+
st_color = "\033[92m[PASS]\033[0m" if r["status"] == "PASS" else "\033[91m[FAIL]\033[0m"
|
|
399
|
+
print(f" {st_color} {r['id']:<8} L{r['level']} | {r['desc'][:45]:<45} -> {r['evidence']}")
|
|
400
|
+
print("=" * 70)
|
|
401
|
+
|
|
402
|
+
if args.gate_score and report["compliance_score_pct"] < args.gate_score:
|
|
403
|
+
print(f"🚨 Quality Gate Failed: ASVS score {report['compliance_score_pct']}% < required {args.gate_score}%", file=sys.stderr)
|
|
404
|
+
return 1
|
|
405
|
+
|
|
406
|
+
return 0
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
if __name__ == "__main__":
|
|
410
|
+
sys.exit(main())
|
package/tools/browser_helpers.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
(function () {
|
|
14
14
|
'use strict';
|
|
15
15
|
|
|
16
|
-
if (window.__qa && window.__qa.__version === '4.
|
|
16
|
+
if (window.__qa && window.__qa.__version === '4.4.0') {
|
|
17
17
|
return window.__qa;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
const qa = {
|
|
50
|
-
__version: '4.
|
|
50
|
+
__version: '4.4.0',
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* 1. Smart Action Batching
|