@teevee98/synapse-hub 4.1.4 → 4.2.1
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/rules/git-push-protocol.md +2 -2
- package/.agents/skills/01-web-automation/auth-session-and-cookie-manager/SKILL.md +52 -3
- package/.agents/skills/01-web-automation/bats-testing-patterns/SKILL.md +55 -5
- package/.agents/skills/01-web-automation/clean-pom-crafter/SKILL.md +62 -67
- package/.agents/skills/01-web-automation/e2e-testing-patterns/SKILL.md +54 -4
- package/.agents/skills/01-web-automation/katalon-cli-runner/SKILL.md +62 -12
- package/.agents/skills/01-web-automation/lam-script-generator/SKILL.md +55 -8
- package/.agents/skills/01-web-automation/mobile-appium-som/SKILL.md +60 -12
- package/.agents/skills/01-web-automation/mobile-appium-som/examples/BaseScreen.java +2 -2
- package/.agents/skills/01-web-automation/mobile-appium-som/examples/LoginScreen.java +2 -2
- package/.agents/skills/01-web-automation/mobile-appium-som/examples/TC_MobileLogin.java +2 -2
- package/.agents/skills/01-web-automation/playwright-live-interaction/SKILL.md +54 -91
- package/.agents/skills/01-web-automation/playwright-webapp-testing/SKILL.md +59 -11
- package/.agents/skills/01-web-automation/web-agent-gym-benchmarking/SKILL.md +50 -4
- package/.agents/skills/02-test-design/architecture-decision-records/SKILL.md +55 -9
- package/.agents/skills/02-test-design/gherkin-to-suite/SKILL.md +55 -9
- package/.agents/skills/02-test-design/rbt-manual-testing/SKILL.md +55 -8
- package/.agents/skills/02-test-design/review-spec/SKILL.md +50 -6
- package/.agents/skills/02-test-design/tot-exploratory-testing/SKILL.md +50 -4
- package/.agents/skills/03-api-and-contracts/api-network-mocking-interception/SKILL.md +56 -5
- package/.agents/skills/03-api-and-contracts/api-spec-to-e2e-matrix/SKILL.md +53 -7
- package/.agents/skills/03-api-and-contracts/consumer-driven-contract-testing/SKILL.md +86 -36
- package/.agents/skills/04-performance-and-load/backend-load-and-stress-patterns/SKILL.md +54 -6
- package/.agents/skills/04-performance-and-load/lean-impact-scoreboard/SKILL.md +50 -6
- package/.agents/skills/04-performance-and-load/web-vitals-and-performance-profiler/SKILL.md +50 -3
- package/.agents/skills/05-security-and-compliance/security-dast-sentinel/SKILL.md +63 -14
- package/.agents/skills/05-security-and-compliance/skillspector-security-guard/SKILL.md +51 -5
- package/.agents/skills/05-security-and-compliance/wcag-audit-patterns/SKILL.md +54 -4
- package/.agents/skills/06-healing-and-resilience/agentless-qa-repair/SKILL.md +51 -5
- package/.agents/skills/06-healing-and-resilience/antigravity-test-sentinel/SKILL.md +53 -6
- package/.agents/skills/06-healing-and-resilience/failure-autopsy-and-healing/SKILL.md +54 -8
- package/.agents/skills/06-healing-and-resilience/flaky-test-sentinel-and-quarantine/SKILL.md +60 -24
- package/.agents/skills/06-healing-and-resilience/self-healing-locator/SKILL.md +52 -6
- package/.agents/skills/06-healing-and-resilience/systematic-debugging/SKILL.md +56 -10
- package/.agents/skills/06-healing-and-resilience/test-driven-development/SKILL.md +58 -12
- package/.agents/skills/06-healing-and-resilience/verification-before-completion/SKILL.md +58 -12
- package/.agents/skills/06-healing-and-resilience/visual-regression-sentinel/SKILL.md +53 -5
- package/.agents/skills/07-data-and-state/db-state-verifier-and-seeder/SKILL.md +56 -5
- package/.agents/skills/07-data-and-state/file-and-report-validator/SKILL.md +53 -4
- package/.agents/skills/07-data-and-state/synthetic-test-data-generator/SKILL.md +58 -5
- package/.agents/skills/08-code-quality/code-refactoring-refactor-clean/SKILL.md +57 -11
- package/.agents/skills/08-code-quality/graphify-impact-analyzer/SKILL.md +83 -34
- package/.agents/skills/08-code-quality/graphify-impact-analyzer/examples/dependency_blast_radius.json +3 -4
- package/.agents/skills/08-code-quality/lean-code-ladder/SKILL.md +55 -10
- package/.agents/skills/08-code-quality/repo-quality-audit/SKILL.md +49 -6
- package/.agents/skills/08-code-quality/senior-code-review/SKILL.md +52 -7
- package/.agents/skills/08-code-quality/surgical-coding-principles/SKILL.md +55 -10
- package/.agents/skills/08-code-quality/technical-debt-harvester/SKILL.md +51 -5
- package/.agents/skills/09-ci-and-devops/github-actions-templates/SKILL.md +54 -17
- package/.agents/skills/09-ci-and-devops/github-actions-templates/examples/matrix_test_pipeline.yml +2 -1
- package/.agents/skills/10-agent-orchestration/actor-qa-swarm/SKILL.md +50 -4
- package/.agents/skills/10-agent-orchestration/agent-orchestration-multi-agent-optimize/SKILL.md +53 -7
- package/.agents/skills/10-agent-orchestration/event-stream-qa-orchestrator/SKILL.md +50 -4
- package/.agents/skills/10-agent-orchestration/persistent-planning-files/SKILL.md +58 -13
- package/.agents/skills/10-agent-orchestration/qa-memory-os/SKILL.md +51 -5
- package/.agents/skills/11-ai-and-prompting/meta-prompt-crafter/SKILL.md +57 -10
- package/.agents/skills/11-ai-and-prompting/mipro-prompt-compiler/SKILL.md +50 -4
- package/.agents/skills/11-ai-and-prompting/qa-aci-interface/SKILL.md +50 -4
- package/.agents/skills/11-ai-and-prompting/token-and-context-optimizer/SKILL.md +55 -9
- package/.cursor/rules/synapse-qa.mdc +20 -7
- package/.cursorrules +19 -5
- package/.windsurfrules +18 -3
- package/AGENTS.md +51 -59
- package/CLAUDE.md +38 -24
- package/LICENSE +5 -5
- package/NOTICE +1 -1
- package/README.en.md +4 -4
- package/README.md +4 -4
- package/agentskills.json +1 -1
- package/docs/ARCHITECTURE.en.md +2 -2
- package/docs/ARCHITECTURE.md +11 -2
- package/docs/CLIENT_SUPPORT_MATRIX.md +44 -0
- package/docs/CLI_REFERENCE.en.md +6 -4
- package/docs/CLI_REFERENCE.md +1 -1
- package/docs/CONTRIBUTING.en.md +1 -1
- package/docs/CONTRIBUTING.md +2 -2
- package/docs/SIDE_EFFECTING_TOOLS_INVENTORY.md +233 -0
- package/docs/TOOL_CATALOG.md +6 -2
- package/docs/research/agent_skill_training_analysis.md +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills_manifest.json +320 -55
- package/synapse.config.json +1 -1
- package/templates/ai_bridges/CLAUDE.md +29 -26
- package/templates/ai_bridges/copilot-instructions.md +14 -5
- package/templates/ai_bridges/cursor_synapse_qa.mdc +16 -7
- package/templates/ai_bridges/windsurfrules +14 -3
- package/templates/ui/index.html +2 -2
- package/tools/TOOLS_RUNBOOK.md +1 -1
- package/tools/TOOL_CATALOG.json +63 -3
- package/tools/__init__.py +1 -1
- package/tools/api_fuzzer.py +447 -132
- package/tools/author_integrity.py +121 -11
- package/tools/benchmark_swarm_context.py +130 -22
- package/tools/break_ui_generator.py +233 -0
- package/tools/browser_helpers.js +2 -2
- package/tools/check_version_sync.py +18 -50
- package/tools/cli.py +110 -19
- package/tools/core/bm25_retriever.py +218 -0
- package/tools/core/i18n.py +5 -5
- package/tools/core/provider_usage_adapter.py +383 -0
- package/tools/core/token_estimator.py +81 -15
- package/tools/count_tokens.py +7 -2
- package/tools/coverage_reporter.py +245 -0
- package/tools/dashboard_generator.py +8 -8
- package/tools/db_sandbox.py +290 -9
- package/tools/distill_log.py +1 -1
- package/tools/distill_skill.py +206 -0
- package/tools/git_pre_commit_guard.py +202 -1
- package/tools/humanize_linter.py +3 -0
- package/tools/mcp_docx_server.py +1 -1
- package/tools/mcp_excel_server.py +1 -1
- package/tools/mcp_server.py +104 -16
- package/tools/micro_mutator.py +114 -15
- package/tools/pentest_scope_guard.py +674 -58
- package/tools/perf/benchmark_perf_runner.py +42 -0
- package/tools/project_state.py +29 -5
- package/tools/reversible_sandbox.py +58 -13
- package/tools/rules_router.py +473 -60
- package/tools/security_scanner.py +80 -0
- package/tools/senior_code_review.py +14 -0
- package/tools/skill_canonical_digest.py +302 -0
- package/tools/skill_profiles.py +77 -7
- package/tools/slide_deck_exporter.py +477 -0
- package/tools/sync_agent_rules.py +187 -61
- package/tools/sync_skills_manifest.py +166 -0
- package/tools/task_memory_manager.py +275 -0
- package/tools/ui_server.py +3 -1
- package/tools/update_sentinel.py +3 -3
- package/tools/validate_host_interop.py +485 -0
- package/tools/validate_skills_schema.py +575 -0
- package/tools/verify_all.py +668 -44
- package/tools/welcome_page.py +2 -2
|
@@ -32,6 +32,14 @@ FORBIDDEN_HUB_PREFIXES = (
|
|
|
32
32
|
"e2e/", "pages/", "cypress/"
|
|
33
33
|
)
|
|
34
34
|
|
|
35
|
+
def check_no_verify_attempt(args: list) -> bool:
|
|
36
|
+
"""Block any bypass attempt using --no-verify flag (Inspired by wshobson block-no-verify)."""
|
|
37
|
+
if any(arg in ("--no-verify", "-n") for arg in args):
|
|
38
|
+
print("❌ [CRITICAL SECURITY BLOCKED] Git pre-commit bypass flag (--no-verify / -n) is strictly forbidden in Synapse Hub.")
|
|
39
|
+
print(" All commits must adhere to the 10 DoD Quality Gates without exception.")
|
|
40
|
+
return False
|
|
41
|
+
return True
|
|
42
|
+
|
|
35
43
|
def is_test_script(file_path: str) -> bool:
|
|
36
44
|
"""
|
|
37
45
|
Identifies test scripts across polyglot test frameworks:
|
|
@@ -151,6 +159,178 @@ def check_scripts_clean_pom(files):
|
|
|
151
159
|
sys.stderr.write(f"Notice: Could not parse {f}: {err}\n")
|
|
152
160
|
return violations
|
|
153
161
|
|
|
162
|
+
|
|
163
|
+
# Gate 6 High-Confidence Secret Scanning Patterns (Mirroring tools/verify_all.py Gate 6)
|
|
164
|
+
GATE_6_SECRET_PATTERNS = [
|
|
165
|
+
(re.compile(r'\bghp_[0-9a-zA-Z]{36}\b'), "GitHub Personal Access Token"),
|
|
166
|
+
(re.compile(r'\bgithub_pat_[0-9a-zA-Z_]{82}\b'), "GitHub Fine-Grained Personal Access Token"),
|
|
167
|
+
(re.compile(r'\bAKIA[0-9A-Z]{16}\b'), "AWS Access Key ID"),
|
|
168
|
+
(re.compile(r'\bsk_(?:live|test)_[0-9a-zA-Z]{24,}\b'), "Stripe Secret Key"),
|
|
169
|
+
(re.compile(r'\bxox[baprs]-[0-9a-zA-Z-]{10,48}\b'), "Slack API Token"),
|
|
170
|
+
(re.compile(r'\bAIza[0-9A-Za-z-_]{35}\b'), "Google API Key"),
|
|
171
|
+
(re.compile(r'-----BEGIN (?:RSA|OPENSSH|EC|DSA|PGP)?\s?PRIVATE KEY-----'), "Private Key Header"),
|
|
172
|
+
]
|
|
173
|
+
|
|
174
|
+
PASSWORD_PATTERNS = [
|
|
175
|
+
(re.compile(r'(?i)\b(?:Pass(?:word)?@?\d+|Admin@?\d+|Root@?\d+|Default@?\d+)\b'), "Known Default Password"),
|
|
176
|
+
(re.compile(r'(?i)\b(?:password|passwd|pwd)\s*[:=]\s*[\x22\x27][^\x22\x27]{4,}[\x22\x27]'), "Hardcoded Plaintext Password Assignment"),
|
|
177
|
+
]
|
|
178
|
+
|
|
179
|
+
PASSWORD_ALLOWLIST_INDICATORS = [
|
|
180
|
+
"System.getenv", "os.getenv", "os.environ", "process.env",
|
|
181
|
+
"dummy", "placeholder", "***", "<password>", "your_password",
|
|
182
|
+
"test_password", "NEO4J_PASSWORD", "DynamicTestPwd",
|
|
183
|
+
"secret_patterns", "<name>PASSWORD</name>", 'password = ""', "password = ''",
|
|
184
|
+
"type=str", "help="
|
|
185
|
+
]
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def check_secrets(files=None, diff_text=None):
|
|
189
|
+
"""
|
|
190
|
+
Scans staged files and/or git diff text for high-confidence secrets (Gate 6).
|
|
191
|
+
Honors # gate6-allowlist comments on the same line to support synthetic fixtures.
|
|
192
|
+
Returns a list of violations: [(file_path, line_no, description), ...]
|
|
193
|
+
"""
|
|
194
|
+
violations = []
|
|
195
|
+
allowlist_token = "# gate6-allowlist"
|
|
196
|
+
|
|
197
|
+
# Self-exclusion and test scanner file exemptions
|
|
198
|
+
exempt_files = {
|
|
199
|
+
"git_pre_commit_guard.py", "verify_all.py",
|
|
200
|
+
"test_tools.py", "test_git_pre_commit_guard.py", "test_audit_remediation_e2e.py"
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
# 1. If diff_text is provided, scan added lines in the staged diff
|
|
204
|
+
if diff_text:
|
|
205
|
+
current_file = "staged_diff"
|
|
206
|
+
line_num = 0
|
|
207
|
+
for raw_line in diff_text.splitlines():
|
|
208
|
+
if raw_line.startswith("diff --git "):
|
|
209
|
+
parts = raw_line.split()
|
|
210
|
+
if len(parts) >= 4:
|
|
211
|
+
current_file = parts[3].lstrip("b/")
|
|
212
|
+
line_num = 0
|
|
213
|
+
continue
|
|
214
|
+
elif raw_line.startswith("+++ b/"):
|
|
215
|
+
current_file = raw_line[6:].strip()
|
|
216
|
+
line_num = 0
|
|
217
|
+
continue
|
|
218
|
+
elif raw_line.startswith("@@"):
|
|
219
|
+
m = re.search(r'\+(\d+)', raw_line)
|
|
220
|
+
if m:
|
|
221
|
+
line_num = int(m.group(1)) - 1
|
|
222
|
+
continue
|
|
223
|
+
|
|
224
|
+
if raw_line.startswith("+") and not raw_line.startswith("+++"):
|
|
225
|
+
line_num += 1
|
|
226
|
+
line = raw_line[1:]
|
|
227
|
+
base_name = os.path.basename(current_file)
|
|
228
|
+
if base_name in exempt_files or current_file.endswith(
|
|
229
|
+
(".png", ".jpg", ".jpeg", ".zip", ".tar", ".gz", ".ico", ".bin", ".db")
|
|
230
|
+
):
|
|
231
|
+
continue
|
|
232
|
+
|
|
233
|
+
if allowlist_token in line or "#gate6-allowlist" in line:
|
|
234
|
+
continue
|
|
235
|
+
|
|
236
|
+
# Check high-confidence token patterns
|
|
237
|
+
for pat, desc in GATE_6_SECRET_PATTERNS:
|
|
238
|
+
if pat.search(line):
|
|
239
|
+
violations.append((current_file, line_num, desc))
|
|
240
|
+
break
|
|
241
|
+
|
|
242
|
+
# Check password patterns
|
|
243
|
+
if not any(ind in line for ind in PASSWORD_ALLOWLIST_INDICATORS):
|
|
244
|
+
for pat, desc in PASSWORD_PATTERNS:
|
|
245
|
+
if pat.search(line):
|
|
246
|
+
violations.append((current_file, line_num, desc))
|
|
247
|
+
break
|
|
248
|
+
|
|
249
|
+
# 2. If files list is provided, scan files directly
|
|
250
|
+
if files:
|
|
251
|
+
for f in files:
|
|
252
|
+
if not os.path.exists(f) or os.path.isdir(f):
|
|
253
|
+
continue
|
|
254
|
+
base_name = os.path.basename(f)
|
|
255
|
+
if base_name in exempt_files or f.endswith(
|
|
256
|
+
(".png", ".jpg", ".jpeg", ".zip", ".tar", ".gz", ".ico", ".bin", ".db")
|
|
257
|
+
):
|
|
258
|
+
continue
|
|
259
|
+
try:
|
|
260
|
+
with open(f, "r", encoding="utf-8", errors="ignore") as fp:
|
|
261
|
+
for line_no, line in enumerate(fp, 1):
|
|
262
|
+
if allowlist_token in line or "#gate6-allowlist" in line:
|
|
263
|
+
continue
|
|
264
|
+
|
|
265
|
+
# Check high-confidence tokens
|
|
266
|
+
for pat, desc in GATE_6_SECRET_PATTERNS:
|
|
267
|
+
if pat.search(line):
|
|
268
|
+
violations.append((f, line_no, desc))
|
|
269
|
+
break
|
|
270
|
+
|
|
271
|
+
# Check passwords
|
|
272
|
+
if not any(ind in line for ind in PASSWORD_ALLOWLIST_INDICATORS):
|
|
273
|
+
for pat, desc in PASSWORD_PATTERNS:
|
|
274
|
+
if pat.search(line):
|
|
275
|
+
violations.append((f, line_no, desc))
|
|
276
|
+
break
|
|
277
|
+
except OSError as err:
|
|
278
|
+
sys.stderr.write(f"Notice: Could not scan {f} for secrets: {err}\n")
|
|
279
|
+
|
|
280
|
+
# De-duplicate violations while preserving order
|
|
281
|
+
deduped = []
|
|
282
|
+
seen = set()
|
|
283
|
+
for v in violations:
|
|
284
|
+
key = (v[0], v[1], v[2])
|
|
285
|
+
if key not in seen:
|
|
286
|
+
seen.add(key)
|
|
287
|
+
deduped.append(v)
|
|
288
|
+
return deduped
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
# Alias for backward-compatibility and diverse test imports
|
|
292
|
+
scan_secrets = check_secrets
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def check_author_integrity(files=None, repo_root=None):
|
|
296
|
+
"""
|
|
297
|
+
Pre-flight author integrity check ensuring staged source files preserve
|
|
298
|
+
mandatory SPDX and author attribution headers.
|
|
299
|
+
Returns list of missing/violating file descriptions.
|
|
300
|
+
"""
|
|
301
|
+
violations = []
|
|
302
|
+
root = repo_root or os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
303
|
+
target_files = files if files is not None else []
|
|
304
|
+
|
|
305
|
+
# If no files specified, run full author_integrity tool check
|
|
306
|
+
if not target_files:
|
|
307
|
+
author_tool = os.path.join(os.path.dirname(__file__), "author_integrity.py")
|
|
308
|
+
if os.path.exists(author_tool):
|
|
309
|
+
res = run_cmd([sys.executable, author_tool], timeout=60.0)
|
|
310
|
+
if res.returncode != 0:
|
|
311
|
+
violations.append("Author attribution or license integrity check failed")
|
|
312
|
+
return violations
|
|
313
|
+
|
|
314
|
+
source_exts = (".py", ".ts", ".groovy")
|
|
315
|
+
for f in target_files:
|
|
316
|
+
if not f.endswith(source_exts) or not os.path.isfile(f):
|
|
317
|
+
continue
|
|
318
|
+
# Skip vendor/build/cache directories
|
|
319
|
+
norm = f.replace("\\", "/")
|
|
320
|
+
if any(ignored in norm for ignored in ("node_modules/", ".git/", "__pycache__/", "build/", "dist/")):
|
|
321
|
+
continue
|
|
322
|
+
try:
|
|
323
|
+
with open(f, "r", encoding="utf-8", errors="ignore") as fp:
|
|
324
|
+
header = fp.read(800)
|
|
325
|
+
has_author = ("Thế Vị" in header or "TeeVee98" in header or "TeeVee998" in header) and "SPDX-FileCopyrightText" in header
|
|
326
|
+
has_license = "SPDX-License-Identifier" in header
|
|
327
|
+
if not (has_author and has_license):
|
|
328
|
+
violations.append(f"{f}: Missing mandatory SPDX author header or MIT license notice")
|
|
329
|
+
except OSError as err:
|
|
330
|
+
violations.append(f"{f}: Could not inspect file header: {err}")
|
|
331
|
+
|
|
332
|
+
return violations
|
|
333
|
+
|
|
154
334
|
def main():
|
|
155
335
|
# If called with --install
|
|
156
336
|
if len(sys.argv) > 1 and sys.argv[1] == "--install":
|
|
@@ -204,6 +384,10 @@ def main():
|
|
|
204
384
|
print(f" - Pre-push: {pre_push_path} (Auto-runs cache_resolver.py sync on git push)")
|
|
205
385
|
sys.exit(0)
|
|
206
386
|
|
|
387
|
+
# Block --no-verify attempt
|
|
388
|
+
if not check_no_verify_attempt(sys.argv[1:]):
|
|
389
|
+
sys.exit(1)
|
|
390
|
+
|
|
207
391
|
# Get staged files
|
|
208
392
|
res = run_cmd("git diff --cached --name-only")
|
|
209
393
|
staged_files = [f.strip() for f in res.stdout.splitlines() if f.strip()]
|
|
@@ -299,11 +483,28 @@ def main():
|
|
|
299
483
|
print(res.stdout.strip())
|
|
300
484
|
errors_found = True
|
|
301
485
|
|
|
486
|
+
# 7. Credential Security & Secret Scanning (Gate 6 on Staged Diffs & Files)
|
|
487
|
+
diff_res = run_cmd("git diff --cached")
|
|
488
|
+
secret_violations = check_secrets(files=staged_files, diff_text=diff_res.stdout)
|
|
489
|
+
if secret_violations:
|
|
490
|
+
print("❌ [PRE-COMMIT BLOCKED] Hardcoded secrets/credentials detected in staged changes (Gate 6):")
|
|
491
|
+
for f, line_no, desc in secret_violations:
|
|
492
|
+
print(f" - {f}:{line_no} contains '{desc}'")
|
|
493
|
+
errors_found = True
|
|
494
|
+
|
|
495
|
+
# 8. Author Integrity Pre-Flight Guard
|
|
496
|
+
author_violations = check_author_integrity(staged_files)
|
|
497
|
+
if author_violations:
|
|
498
|
+
print("❌ [PRE-COMMIT BLOCKED] Author attribution / SPDX header integrity violation:")
|
|
499
|
+
for av in author_violations:
|
|
500
|
+
print(f" - {av}")
|
|
501
|
+
errors_found = True
|
|
502
|
+
|
|
302
503
|
if errors_found:
|
|
303
504
|
print("\n🚫 Commit aborted. Please fix violations before committing.")
|
|
304
505
|
sys.exit(1)
|
|
305
506
|
else:
|
|
306
|
-
print("✅ [PRE-COMMIT GUARD] All quality gates passed (No BOM, Clean POM, Clean Paths, Docs Aligned, Static Lint Pass).")
|
|
507
|
+
print("✅ [PRE-COMMIT GUARD] All quality gates passed (No BOM, Clean POM, Clean Paths, Docs Aligned, Static Lint Pass, Secrets Clean, Author Verified).")
|
|
307
508
|
sys.exit(0)
|
|
308
509
|
|
|
309
510
|
if __name__ == "__main__":
|
package/tools/humanize_linter.py
CHANGED
|
@@ -180,6 +180,9 @@ CLICHE_PHRASES: List[Tuple[str, str]] = [
|
|
|
180
180
|
(r"\bwithout further ado\b", "dive directly into technical content"),
|
|
181
181
|
(r"\bi hope this helps\b", "omit conversational fluff"),
|
|
182
182
|
(r"\bhere is the updated code\b", "deliver code directly"),
|
|
183
|
+
(r"\byou(?:'re| are) absolutely right\b", "omit sycophantic praise (Coder rule)"),
|
|
184
|
+
(r"\bi apologize for the confusion\b", "omit conversational apology; state factual fix (Ruff rule)"),
|
|
185
|
+
(r"\bgreat question\b", "omit sycophantic opener; answer directly"),
|
|
183
186
|
]
|
|
184
187
|
|
|
185
188
|
# Words that are fine in isolation, but suspicious when piled up (>= 3 times)
|
package/tools/mcp_docx_server.py
CHANGED
|
@@ -60,7 +60,7 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
60
60
|
except Exception:
|
|
61
61
|
pass
|
|
62
62
|
|
|
63
|
-
SERVER_VERSION = "4.1
|
|
63
|
+
SERVER_VERSION = "4.2.1"
|
|
64
64
|
MAX_DOCX_SIZE = 50 * 1024 * 1024 # 50 MB
|
|
65
65
|
MAX_UNCOMPRESSED_SIZE = 200 * 1024 * 1024 # 200 MB
|
|
66
66
|
MAX_RATIO = 100 # 100:1 compression ratio limit
|
|
@@ -55,7 +55,7 @@ if hasattr(sys.stdout, 'reconfigure'):
|
|
|
55
55
|
except Exception:
|
|
56
56
|
pass
|
|
57
57
|
|
|
58
|
-
SERVER_VERSION = "4.1
|
|
58
|
+
SERVER_VERSION = "4.2.1"
|
|
59
59
|
MAX_XLSX_SIZE = 50 * 1024 * 1024 # 50 MB
|
|
60
60
|
MAX_UNCOMPRESSED_SIZE = 200 * 1024 * 1024 # 200 MB
|
|
61
61
|
MAX_RATIO = 100 # 100:1 compression ratio limit
|
package/tools/mcp_server.py
CHANGED
|
@@ -14,6 +14,7 @@ import os
|
|
|
14
14
|
import sys
|
|
15
15
|
import json
|
|
16
16
|
import re
|
|
17
|
+
import tempfile
|
|
17
18
|
from pathlib import Path
|
|
18
19
|
from typing import Dict, Any, Optional, Set
|
|
19
20
|
|
|
@@ -49,7 +50,7 @@ import gherkin_suite
|
|
|
49
50
|
import api_fuzzer
|
|
50
51
|
|
|
51
52
|
SERVER_NAME = "enterprise-agent-qa"
|
|
52
|
-
SERVER_VERSION = "4.1
|
|
53
|
+
SERVER_VERSION = "4.2.1"
|
|
53
54
|
|
|
54
55
|
MCP_TOOLS = [
|
|
55
56
|
{
|
|
@@ -132,7 +133,7 @@ MCP_TOOLS = [
|
|
|
132
133
|
},
|
|
133
134
|
{
|
|
134
135
|
"name": "distill_log",
|
|
135
|
-
"description": "Filters verbose CLI or Gradle build logs
|
|
136
|
+
"description": "Filters verbose CLI or Gradle build logs, retaining only actionable stacktraces and pointers.",
|
|
136
137
|
"inputSchema": {
|
|
137
138
|
"type": "object",
|
|
138
139
|
"properties": {
|
|
@@ -214,7 +215,8 @@ MCP_TOOLS = [
|
|
|
214
215
|
"action": {"type": "string", "enum": ["snapshot", "restore", "audit_and_purge"], "description": "Sandbox operation to execute."},
|
|
215
216
|
"db_path": {"type": "string", "description": "Path to database file (optional for SQLite)."},
|
|
216
217
|
"snapshot_id": {"type": "string", "description": "Snapshot identifier (default: pristine_baseline)."},
|
|
217
|
-
"dry_run": {"type": "boolean", "description": "For audit_and_purge: preview
|
|
218
|
+
"dry_run": {"type": "boolean", "default": True, "description": "For restore and audit_and_purge: preview actions without modifying database (default: true)."},
|
|
219
|
+
"consent": {"type": "boolean", "default": False, "description": "Explicit consent acknowledgement for destructive state modification when dry_run=False."}
|
|
218
220
|
},
|
|
219
221
|
"required": ["action"]
|
|
220
222
|
}
|
|
@@ -262,8 +264,9 @@ MCP_TOOLS = [
|
|
|
262
264
|
"properties": {
|
|
263
265
|
"base_url": {"type": "string", "description": "Base URL of target API (non-production allowlist enforced)."},
|
|
264
266
|
"spec_path": {"type": "string", "description": "Path or URL to OpenAPI/Swagger JSON spec."},
|
|
265
|
-
"mode": {"type": "string", "enum": ["active", "passive"], "description": "active fuzzing or passive offline spec audit."},
|
|
266
|
-
"dry_run": {"type": "boolean", "description": "Deterministic offline mock (default true for safety)."}
|
|
267
|
+
"mode": {"type": "string", "enum": ["active", "passive"], "default": "passive", "description": "active fuzzing or passive offline spec audit (default: passive)."},
|
|
268
|
+
"dry_run": {"type": "boolean", "default": True, "description": "Deterministic offline mock (default true for safety)."},
|
|
269
|
+
"consent": {"type": "boolean", "default": False, "description": "Explicit consent acknowledgement for active mutations when mode=active and dry_run=False."}
|
|
267
270
|
},
|
|
268
271
|
"required": ["base_url"]
|
|
269
272
|
}
|
|
@@ -295,8 +298,12 @@ def _validate_safe_path(filepath: str, allowed_root: Optional[str] = None, allow
|
|
|
295
298
|
root_norm = os.path.normcase(str(root_path))
|
|
296
299
|
target_norm = os.path.normcase(str(target_path))
|
|
297
300
|
|
|
298
|
-
# Path must reside within the allowed root
|
|
299
|
-
|
|
301
|
+
# Path must reside within the allowed root OR within the OS temporary directory
|
|
302
|
+
temp_dir_norm = os.path.normcase(str(Path(tempfile.gettempdir()).resolve()))
|
|
303
|
+
is_temp_path = target_norm == temp_dir_norm or target_norm.startswith(temp_dir_norm + os.sep)
|
|
304
|
+
is_in_root = (target_norm == root_norm or target_norm.startswith(root_norm + os.sep))
|
|
305
|
+
|
|
306
|
+
if not is_in_root and not is_temp_path:
|
|
300
307
|
raise PermissionError(f"Access denied: path '{filepath}' resolves outside allowed project root '{root_path}'")
|
|
301
308
|
|
|
302
309
|
# Reject explicit sensitive configuration / secret files and private keys
|
|
@@ -334,8 +341,16 @@ def _validate_safe_path(filepath: str, allowed_root: Optional[str] = None, allow
|
|
|
334
341
|
except OSError:
|
|
335
342
|
sensitive_prefixes.append(Path(win_val))
|
|
336
343
|
|
|
344
|
+
temp_dir_norm = os.path.normcase(str(Path(tempfile.gettempdir()).resolve()))
|
|
345
|
+
is_temp_path = target_norm == temp_dir_norm or target_norm.startswith(temp_dir_norm + os.sep)
|
|
346
|
+
|
|
337
347
|
for sp in sensitive_prefixes:
|
|
338
348
|
sp_norm = os.path.normcase(str(sp))
|
|
349
|
+
if is_temp_path and sys.platform == "win32" and sp_norm in (
|
|
350
|
+
os.path.normcase(os.environ.get("LOCALAPPDATA", "")),
|
|
351
|
+
os.path.normcase(os.environ.get("APPDATA", "")),
|
|
352
|
+
):
|
|
353
|
+
continue
|
|
339
354
|
if target_norm == sp_norm or target_norm.startswith(sp_norm + os.sep):
|
|
340
355
|
raise PermissionError(f"Access denied: path references restricted system directory '{sp}'")
|
|
341
356
|
|
|
@@ -504,15 +519,55 @@ def _handle_manage_db_sandbox(arguments: Dict[str, Any]) -> str:
|
|
|
504
519
|
safe_db = _validate_safe_path(raw_db) if raw_db else ""
|
|
505
520
|
raw_id = arguments.get("snapshot_id", "pristine_baseline")
|
|
506
521
|
safe_id = re.sub(r'[^a-zA-Z0-9_\-]', '', raw_id) or "pristine_baseline"
|
|
522
|
+
consent = bool(arguments.get("consent", False)) or (os.environ.get("PENTEST_CONSENT_ACKNOWLEDGED", "").strip().lower() in ("1", "true", "yes"))
|
|
507
523
|
|
|
508
524
|
sandbox = db_sandbox.DBSandbox(db_path=safe_db)
|
|
509
525
|
if action == "snapshot":
|
|
510
526
|
res = sandbox.create_snapshot(safe_id)
|
|
511
527
|
elif action == "restore":
|
|
512
|
-
|
|
528
|
+
dry_run = bool(arguments.get("dry_run", True))
|
|
529
|
+
if dry_run:
|
|
530
|
+
res = {
|
|
531
|
+
"status": "dry_run_preview",
|
|
532
|
+
"action": "restore",
|
|
533
|
+
"snapshot_id": safe_id,
|
|
534
|
+
"db_path": safe_db or sandbox.db_path,
|
|
535
|
+
"dry_run": True,
|
|
536
|
+
"impact_summary": f"DRY-RUN PREVIEW: Would restore database snapshot '{safe_id}' to '{safe_db or sandbox.db_path}'. Pass dry_run=False and consent=True to execute."
|
|
537
|
+
}
|
|
538
|
+
else:
|
|
539
|
+
if not consent:
|
|
540
|
+
raise PermissionError(
|
|
541
|
+
f"Active restore operation on database '{safe_db or sandbox.db_path}' requires explicit consent. "
|
|
542
|
+
f"Pass consent=True to confirm state modification."
|
|
543
|
+
)
|
|
544
|
+
from pentest_scope_guard import create_consent_grant, ConsentGrant
|
|
545
|
+
grant = consent if isinstance(consent, (ConsentGrant, dict)) and not isinstance(consent, bool) else create_consent_grant(
|
|
546
|
+
action="db:restore",
|
|
547
|
+
target=safe_db or sandbox.db_path,
|
|
548
|
+
caller_session=f"mcp_{os.getpid()}",
|
|
549
|
+
db_identity=safe_db or sandbox.db_path,
|
|
550
|
+
ttl_seconds=300
|
|
551
|
+
)
|
|
552
|
+
res = sandbox.restore_snapshot(safe_id, consent=grant, dry_run=dry_run)
|
|
513
553
|
elif action == "audit_and_purge":
|
|
514
|
-
dry_run = bool(arguments.get("dry_run",
|
|
515
|
-
|
|
554
|
+
dry_run = bool(arguments.get("dry_run", True))
|
|
555
|
+
if not dry_run and not consent:
|
|
556
|
+
raise PermissionError(
|
|
557
|
+
f"Active purge operation on database '{safe_db or sandbox.db_path}' requires explicit consent. "
|
|
558
|
+
f"Pass consent=True to confirm record deletion."
|
|
559
|
+
)
|
|
560
|
+
from pentest_scope_guard import create_consent_grant, ConsentGrant
|
|
561
|
+
grant = None
|
|
562
|
+
if not dry_run:
|
|
563
|
+
grant = consent if isinstance(consent, (ConsentGrant, dict)) and not isinstance(consent, bool) else create_consent_grant(
|
|
564
|
+
action="db:purge",
|
|
565
|
+
target=safe_db or sandbox.db_path,
|
|
566
|
+
caller_session=f"mcp_{os.getpid()}",
|
|
567
|
+
db_identity=safe_db or sandbox.db_path,
|
|
568
|
+
ttl_seconds=300
|
|
569
|
+
)
|
|
570
|
+
res = sandbox.audit_and_purge_pollution(dry_run=dry_run, consent=grant)
|
|
516
571
|
else:
|
|
517
572
|
raise ValueError(f"Unknown sandbox action: {action}")
|
|
518
573
|
return json.dumps(res, indent=2)
|
|
@@ -556,14 +611,46 @@ def _handle_compile_gherkin_suite(arguments: Dict[str, Any]) -> str:
|
|
|
556
611
|
|
|
557
612
|
|
|
558
613
|
def _handle_fuzz_api(arguments: Dict[str, Any]) -> str:
|
|
559
|
-
mode = arguments.get("mode", "
|
|
560
|
-
dry_run = arguments.get("dry_run", True)
|
|
614
|
+
mode = arguments.get("mode", "passive")
|
|
615
|
+
dry_run = bool(arguments.get("dry_run", True))
|
|
616
|
+
consent = bool(arguments.get("consent", False)) or (os.environ.get("PENTEST_CONSENT_ACKNOWLEDGED", "").strip().lower() in ("1", "true", "yes"))
|
|
561
617
|
spec_path = arguments.get("spec_path")
|
|
562
|
-
|
|
563
|
-
|
|
618
|
+
base_url = arguments.get("base_url", "")
|
|
619
|
+
|
|
620
|
+
from pentest_scope_guard import PentestScopeGuard
|
|
621
|
+
guard = PentestScopeGuard(allow_internal=True)
|
|
622
|
+
ok, reason = guard.validate_target(base_url, actor="mcp_server.fuzz_api")
|
|
623
|
+
if not ok:
|
|
624
|
+
raise PermissionError(f"[PENTEST SCOPE GUARD - REJECTED] Target base_url '{base_url}' blocked: {reason}")
|
|
625
|
+
|
|
626
|
+
if spec_path:
|
|
627
|
+
if spec_path.startswith(("http://", "https://")):
|
|
628
|
+
spec_ok, spec_reason = guard.validate_target(spec_path, actor="mcp_server.fuzz_api.spec_url")
|
|
629
|
+
if not spec_ok:
|
|
630
|
+
raise PermissionError(f"[PENTEST SCOPE GUARD - REJECTED] spec_path URL '{spec_path}' blocked: {spec_reason}")
|
|
631
|
+
else:
|
|
632
|
+
spec_path = _validate_safe_path(spec_path)
|
|
633
|
+
|
|
634
|
+
grant = None
|
|
635
|
+
if mode == "active" and not dry_run:
|
|
636
|
+
if not consent:
|
|
637
|
+
raise PermissionError(
|
|
638
|
+
"Active API fuzzing (dry_run=False) requires explicit consent. Set consent=True or run with dry_run=True / mode=passive."
|
|
639
|
+
)
|
|
640
|
+
from pentest_scope_guard import create_consent_grant, ConsentGrant
|
|
641
|
+
grant = consent if isinstance(consent, (ConsentGrant, dict)) and not isinstance(consent, bool) else create_consent_grant(
|
|
642
|
+
action="http:fuzz",
|
|
643
|
+
target=base_url,
|
|
644
|
+
caller_session=f"mcp_{os.getpid()}",
|
|
645
|
+
ttl_seconds=300
|
|
646
|
+
)
|
|
647
|
+
|
|
564
648
|
fuzzer = api_fuzzer.ApiFuzzer(
|
|
565
|
-
base_url=
|
|
649
|
+
base_url=base_url,
|
|
566
650
|
spec_path_or_url=spec_path,
|
|
651
|
+
scope_guard=guard,
|
|
652
|
+
dry_run=dry_run,
|
|
653
|
+
consent=grant
|
|
567
654
|
)
|
|
568
655
|
if mode == "passive":
|
|
569
656
|
scorecard = fuzzer.run_passive_scan()
|
|
@@ -573,13 +660,14 @@ def _handle_fuzz_api(arguments: Dict[str, Any]) -> str:
|
|
|
573
660
|
"severity_summary": scorecard["severity_summary"],
|
|
574
661
|
"findings": scorecard["findings"],
|
|
575
662
|
}, indent=2)
|
|
576
|
-
scorecard = fuzzer.run_fuzz_suite(dry_run=dry_run)
|
|
663
|
+
scorecard = fuzzer.run_fuzz_suite(dry_run=dry_run, consent=grant)
|
|
577
664
|
return json.dumps({
|
|
578
665
|
"mode": scorecard["mode"],
|
|
579
666
|
"total_mutations": scorecard["total_mutations"],
|
|
580
667
|
"passed": scorecard["passed"],
|
|
581
668
|
"failed": scorecard["failed"],
|
|
582
669
|
"severity_summary": scorecard["severity_summary"],
|
|
670
|
+
"dry_run": scorecard["dry_run"],
|
|
583
671
|
}, indent=2)
|
|
584
672
|
|
|
585
673
|
|