@teevee98/synapse-hub 0.0.0-stage → 3.8.3
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 +67 -0
- package/.agents/agents/failure-analyst.md +75 -0
- package/.agents/agents/live-explorer.md +70 -0
- package/.agents/agents/orchestrator.md +104 -0
- package/.agents/agents/perf-engineer.md +74 -0
- package/.agents/agents/pom-crafter.md +112 -0
- package/.agents/agents/quality-gatekeeper.md +87 -0
- package/.agents/agents/test-designer.md +73 -0
- package/.agents/agents/test-runner.md +67 -0
- package/.agents/rules/author-integrity-guard.md +33 -0
- package/.agents/rules/communication-style.md +18 -0
- package/.agents/rules/context-engineering.md +37 -0
- package/.agents/rules/git-push-protocol.md +33 -0
- package/.agents/rules/graphify.md +14 -0
- package/.agents/rules/lessons-learned.md +25 -0
- package/.agents/rules/mandatory-playwright-live.md +25 -0
- package/.agents/rules/mobile_appium_rules.md +43 -0
- package/.agents/rules/performance_testing_rules.md +35 -0
- package/.agents/rules/skill-precedence.md +29 -0
- package/.agents/rules/systematic-debugging.md +36 -0
- package/.agents/skills/actor-qa-swarm/SKILL.md +77 -0
- package/.agents/skills/actor-qa-swarm/examples/broker_sharding_sample.json +12 -0
- package/.agents/skills/agent-orchestration-multi-agent-optimize/SKILL.md +88 -0
- package/.agents/skills/agent-orchestration-multi-agent-optimize/examples/swarm_workload_config.json +15 -0
- package/.agents/skills/agentless-qa-repair/SKILL.md +69 -0
- package/.agents/skills/agentless-qa-repair/examples/healing_report_sample.json +17 -0
- package/.agents/skills/agentless-qa-repair/examples/three_phase_repair_workflow.md +40 -0
- package/.agents/skills/antigravity-test-sentinel/SKILL.md +63 -0
- package/.agents/skills/antigravity-test-sentinel/examples/dod_gate_policy.json +11 -0
- package/.agents/skills/antigravity-test-sentinel/examples/sprint_dod_enforcement.md +47 -0
- package/.agents/skills/api-network-mocking-interception/SKILL.md +142 -0
- package/.agents/skills/api-network-mocking-interception/examples/network_route_stub.json +9 -0
- package/.agents/skills/api-spec-to-e2e-matrix/SKILL.md +80 -0
- package/.agents/skills/api-spec-to-e2e-matrix/examples/sample_openapi.json +19 -0
- package/.agents/skills/architecture-decision-records/SKILL.md +64 -0
- package/.agents/skills/architecture-decision-records/examples/0001-record-architecture-decisions.md +12 -0
- package/.agents/skills/auth-session-and-cookie-manager/SKILL.md +75 -0
- package/.agents/skills/auth-session-and-cookie-manager/examples/multi_role_auth_matrix.md +70 -0
- package/.agents/skills/auth-session-and-cookie-manager/examples/storage_state_sample.json +11 -0
- package/.agents/skills/backend-load-and-stress-patterns/SKILL.md +85 -0
- package/.agents/skills/backend-load-and-stress-patterns/examples/k6_load_test_sample.js +13 -0
- package/.agents/skills/backend-load-and-stress-patterns/references/k6_load_template.js +82 -0
- package/.agents/skills/bats-testing-patterns/SKILL.md +100 -0
- package/.agents/skills/bats-testing-patterns/examples/cli_runner_test.bats +6 -0
- package/.agents/skills/bats-testing-patterns/resources/implementation-playbook.md +614 -0
- package/.agents/skills/clean-pom-crafter/SKILL.md +110 -0
- package/.agents/skills/clean-pom-crafter/examples/standard_test_case.groovy +28 -0
- package/.agents/skills/clean-pom-crafter/references/pom_patterns.groovy +138 -0
- package/.agents/skills/code-refactoring-refactor-clean/SKILL.md +64 -0
- package/.agents/skills/code-refactoring-refactor-clean/examples/refactored_page_sample.groovy +9 -0
- package/.agents/skills/code-refactoring-refactor-clean/examples/refactored_playwright_pom.ts +52 -0
- package/.agents/skills/code-refactoring-refactor-clean/resources/implementation-playbook.md +881 -0
- package/.agents/skills/consumer-driven-contract-testing/SKILL.md +147 -0
- package/.agents/skills/consumer-driven-contract-testing/examples/order_service_pact.json +45 -0
- package/.agents/skills/db-state-verifier-and-seeder/SKILL.md +123 -0
- package/.agents/skills/db-state-verifier-and-seeder/examples/db_fixture_seed.json +12 -0
- package/.agents/skills/e2e-testing-patterns/SKILL.md +103 -0
- package/.agents/skills/e2e-testing-patterns/examples/playwright_sharded_config.ts +12 -0
- package/.agents/skills/e2e-testing-patterns/resources/implementation-playbook.md +522 -0
- package/.agents/skills/event-stream-qa-orchestrator/SKILL.md +79 -0
- package/.agents/skills/event-stream-qa-orchestrator/examples/timeline_sample.jsonl +2 -0
- package/.agents/skills/failure-autopsy-and-healing/SKILL.md +66 -0
- package/.agents/skills/failure-autopsy-and-healing/examples/closed_loop_healing_walkthrough.md +48 -0
- package/.agents/skills/failure-autopsy-and-healing/examples/sample_junit_failure.xml +8 -0
- package/.agents/skills/failure-autopsy-and-healing/references/healing_matrix.md +64 -0
- package/.agents/skills/failure-autopsy-and-healing/references/qa_investigation_protocol.md +56 -0
- package/.agents/skills/failure-autopsy-and-healing/scripts/triage_failures.sh +83 -0
- package/.agents/skills/file-and-report-validator/SKILL.md +90 -0
- package/.agents/skills/file-and-report-validator/examples/sample_export_schema.json +14 -0
- package/.agents/skills/flaky-test-sentinel-and-quarantine/SKILL.md +114 -0
- package/.agents/skills/flaky-test-sentinel-and-quarantine/examples/quarantine_registry.json +11 -0
- package/.agents/skills/gherkin-to-suite/SKILL.md +103 -0
- package/.agents/skills/gherkin-to-suite/examples/checkout.feature +39 -0
- package/.agents/skills/gherkin-to-suite/examples/suite_report_sample.json +334 -0
- package/.agents/skills/github-actions-templates/SKILL.md +77 -0
- package/.agents/skills/github-actions-templates/examples/matrix_test_pipeline.yml +8 -0
- package/.agents/skills/graphify-impact-analyzer/SKILL.md +76 -0
- package/.agents/skills/graphify-impact-analyzer/examples/dependency_blast_radius.json +8 -0
- package/.agents/skills/katalon-cli-runner/SKILL.md +76 -0
- package/.agents/skills/katalon-cli-runner/examples/headless_kre_exec.sh +3 -0
- package/.agents/skills/katalon-cli-runner/references/groovy-patterns.md +209 -0
- package/.agents/skills/katalon-cli-runner/references/katalon-api.md +155 -0
- package/.agents/skills/katalon-cli-runner/references/runner_commands.md +67 -0
- package/.agents/skills/lam-script-generator/SKILL.md +123 -0
- package/.agents/skills/lam-script-generator/examples/user_story_sample.md +8 -0
- package/.agents/skills/lean-code-ladder/SKILL.md +94 -0
- package/.agents/skills/lean-code-ladder/examples/ladder_walkthrough.md +37 -0
- package/.agents/skills/lean-impact-scoreboard/SKILL.md +48 -0
- package/.agents/skills/lean-impact-scoreboard/examples/sample_benchmark_gain.md +20 -0
- package/.agents/skills/lean-impact-scoreboard/examples/sample_scoreboard.md +15 -0
- package/.agents/skills/meta-prompt-crafter/SKILL.md +107 -0
- package/.agents/skills/meta-prompt-crafter/examples/qa_prompt_template.md +35 -0
- package/.agents/skills/mipro-prompt-compiler/SKILL.md +59 -0
- package/.agents/skills/mipro-prompt-compiler/examples/compiled_module_sample.json +22 -0
- package/.agents/skills/mipro-prompt-compiler/examples/dspy_assertion_optimizer_case.md +46 -0
- package/.agents/skills/mobile-appium-som/SKILL.md +88 -0
- package/.agents/skills/mobile-appium-som/examples/BaseScreen.java +88 -0
- package/.agents/skills/mobile-appium-som/examples/LoginScreen.java +46 -0
- package/.agents/skills/mobile-appium-som/examples/TC_MobileLogin.java +43 -0
- package/.agents/skills/persistent-planning-files/SKILL.md +108 -0
- package/.agents/skills/persistent-planning-files/examples/task_plan_example.md +56 -0
- package/.agents/skills/playwright-live-interaction/SKILL.md +131 -0
- package/.agents/skills/playwright-live-interaction/examples/live_probe_script.js +5 -0
- package/.agents/skills/playwright-live-interaction/references/advanced_superpowers.md +160 -0
- package/.agents/skills/playwright-live-interaction/references/compact_accessibility_snapshots.md +75 -0
- package/.agents/skills/playwright-live-interaction/references/recipes.md +388 -0
- package/.agents/skills/playwright-live-interaction/references/swarm_orchestration.md +134 -0
- package/.agents/skills/playwright-webapp-testing/SKILL.md +93 -0
- package/.agents/skills/playwright-webapp-testing/examples/server_lifecycle_playwright.py +63 -0
- package/.agents/skills/qa-aci-interface/SKILL.md +67 -0
- package/.agents/skills/qa-aci-interface/examples/surgical_code_window_walkthrough.md +40 -0
- package/.agents/skills/qa-aci-interface/examples/surgical_edit_sample.json +12 -0
- package/.agents/skills/qa-memory-os/SKILL.md +80 -0
- package/.agents/skills/qa-memory-os/examples/archival_memory_sample.json +21 -0
- package/.agents/skills/rbt-manual-testing/SKILL.md +137 -0
- package/.agents/skills/rbt-manual-testing/examples/checkout_rbt_manual_suite.md +25 -0
- package/.agents/skills/rbt-manual-testing/references/field_validation_checklist.md +29 -0
- package/.agents/skills/repo-quality-audit/SKILL.md +68 -0
- package/.agents/skills/repo-quality-audit/examples/sample_audit_walkthrough.md +15 -0
- package/.agents/skills/repo-quality-audit/examples/sample_repo_audit.md +33 -0
- package/.agents/skills/review-spec/SKILL.md +60 -0
- package/.agents/skills/review-spec/examples/pocock_grilling_decision_rubric.md +40 -0
- package/.agents/skills/review-spec/examples/sample_spec_review.md +33 -0
- package/.agents/skills/security-dast-sentinel/SKILL.md +119 -0
- package/.agents/skills/security-dast-sentinel/examples/dast_scan_config.json +10 -0
- package/.agents/skills/security-dast-sentinel/references/AI-AND-LLM.md +113 -0
- package/.agents/skills/security-dast-sentinel/references/ATTACK-CLASSES.md +89 -0
- package/.agents/skills/security-dast-sentinel/references/dast_recipes.ts +33 -0
- package/.agents/skills/self-healing-locator/SKILL.md +86 -0
- package/.agents/skills/self-healing-locator/examples/aom_diff_sample.json +16 -0
- package/.agents/skills/senior-code-review/SKILL.md +108 -0
- package/.agents/skills/senior-code-review/examples/sample_review_walkthrough.md +29 -0
- package/.agents/skills/skillspector-security-guard/SKILL.md +57 -0
- package/.agents/skills/skillspector-security-guard/examples/audit_threat_vectors_report.json +35 -0
- package/.agents/skills/skillspector-security-guard/examples/safe_mcp_config.json +12 -0
- package/.agents/skills/surgical-coding-principles/SKILL.md +89 -0
- package/.agents/skills/surgical-coding-principles/examples/surgical_vs_scope_creep.md +46 -0
- package/.agents/skills/synthetic-test-data-generator/SKILL.md +135 -0
- package/.agents/skills/synthetic-test-data-generator/examples/idempotent_data_recipe.json +9 -0
- package/.agents/skills/systematic-debugging/SKILL.md +100 -0
- package/.agents/skills/systematic-debugging/examples/four_phase_case.md +44 -0
- package/.agents/skills/technical-debt-harvester/SKILL.md +70 -0
- package/.agents/skills/technical-debt-harvester/examples/sample_debt_ledger.md +25 -0
- package/.agents/skills/technical-debt-harvester/examples/sample_ledger_output.md +20 -0
- package/.agents/skills/test-driven-development/SKILL.md +114 -0
- package/.agents/skills/test-driven-development/examples/red_green_refactor_qa.md +78 -0
- package/.agents/skills/token-and-context-optimizer/SKILL.md +70 -0
- package/.agents/skills/token-and-context-optimizer/examples/distilled_log_sample.txt +3 -0
- package/.agents/skills/token-and-context-optimizer/references/context_engineering_guide.md +49 -0
- package/.agents/skills/tot-exploratory-testing/SKILL.md +59 -0
- package/.agents/skills/tot-exploratory-testing/examples/payment_gateway_tot_tree.json +62 -0
- package/.agents/skills/tot-exploratory-testing/examples/tot_graph_sample.json +35 -0
- package/.agents/skills/verification-before-completion/SKILL.md +100 -0
- package/.agents/skills/verification-before-completion/examples/evidence_log_example.md +46 -0
- package/.agents/skills/visual-regression-sentinel/SKILL.md +82 -0
- package/.agents/skills/visual-regression-sentinel/examples/visual_mask_rules.json +9 -0
- package/.agents/skills/wcag-audit-patterns/SKILL.md +77 -0
- package/.agents/skills/wcag-audit-patterns/examples/wcag_compliance_checklist.json +10 -0
- package/.agents/skills/wcag-audit-patterns/resources/implementation-playbook.md +541 -0
- package/.agents/skills/web-agent-gym-benchmarking/SKILL.md +62 -0
- package/.agents/skills/web-agent-gym-benchmarking/examples/benchmark_report_sample.json +22 -0
- package/.agents/skills/web-agent-gym-benchmarking/examples/enterprise_tasks_suite.json +38 -0
- package/.agents/skills/web-vitals-and-performance-profiler/SKILL.md +65 -0
- package/.agents/skills/web-vitals-and-performance-profiler/examples/cwv_budget_policy.json +6 -0
- package/.agents/skills/web-vitals-and-performance-profiler/examples/playwright_cwv_profiler_fixture.ts +118 -0
- package/.agents/templates/completion_report.md +57 -0
- package/.agents/workflows/analyze_requirement_document.md +18 -0
- package/.agents/workflows/export_testcases_excel.md +32 -0
- package/.agents/workflows/generate_combinatorial_test_data.md +28 -0
- package/.agents/workflows/generate_cross_module_test_plan.md +37 -0
- package/.agents/workflows/generate_manual_testcases_rbt.md +56 -0
- package/.agents/workflows/generate_requirements_from_website.md +25 -0
- package/.agents/workflows/generate_testcases_from_requirements.md +21 -0
- package/.agents/workflows/graphify.md +10 -0
- package/.agents/workflows/test-impact.md +15 -0
- package/.agents/workflows/verify.md +34 -0
- package/.cursor/rules/agents.mdc +16 -0
- package/.cursor/rules/language.mdc +7 -0
- package/.cursor/rules/synapse-qa.mdc +24 -0
- package/.cursorrules +27 -0
- package/.dockerignore +53 -0
- package/.pre-commit-hooks.yaml +14 -0
- package/.windsurfrules +26 -0
- package/AGENTS.md +86 -0
- package/CLAUDE.md +54 -0
- package/Dockerfile +81 -0
- package/LICENSE +52 -0
- package/NOTICE +264 -0
- package/README.en.md +171 -0
- package/README.md +170 -2
- package/action.yml +51 -0
- package/agentskills.json +16 -0
- package/bin/agent-qa.js +138 -0
- package/docker-compose.yml +74 -0
- package/docs/ARCHITECTURE.en.md +198 -0
- package/docs/ARCHITECTURE.md +199 -0
- package/docs/CI_CD_INTEGRATION.en.md +170 -0
- package/docs/CI_CD_INTEGRATION.md +170 -0
- package/docs/CLI_REFERENCE.en.md +174 -0
- package/docs/CLI_REFERENCE.md +176 -0
- package/docs/CONTRIBUTING.en.md +49 -0
- package/docs/CONTRIBUTING.md +49 -0
- package/docs/PERFORMANCE_AUDIT_REPORT.md +783 -0
- package/docs/PLUGIN_DEVELOPMENT_GUIDE.md +127 -0
- package/docs/QUALITY_GATES.en.md +118 -0
- package/docs/QUALITY_GATES.md +118 -0
- package/docs/TOKEN_QUOTA_PLAYBOOK.md +41 -0
- package/docs/TOOL_CATALOG.md +129 -0
- package/docs/adopted-ecosystem-tools.md +96 -0
- package/docs/research/EXTERNAL_AGENT_SKILLS_SURVEY.md +1062 -0
- package/docs/research/agent_skill_training_analysis.md +1358 -0
- package/docs/schemas/synapse.config.schema.json +86 -0
- package/package.json +94 -4
- package/plugin.json +31 -0
- package/scripts/generate_skill_examples.py +244 -0
- package/scripts/install.ps1 +112 -0
- package/scripts/install_global_plugin.ps1 +94 -0
- package/scripts/install_global_plugin.sh +49 -0
- package/scripts/lint_skills.ps1 +57 -0
- package/scripts/package_dist.py +337 -0
- package/scripts/setup.sh +59 -0
- package/scripts/update_hub.ps1 +19 -0
- package/scripts/update_hub.sh +15 -0
- package/skills_manifest.json +854 -0
- package/synapse.config.json +31 -0
- package/templates/PROJECT_AI_GUIDE_TEMPLATE.md +111 -0
- package/templates/PROJECT_STATE_TEMPLATE.md +20 -0
- package/templates/ai_bridges/CLAUDE.md +54 -0
- package/templates/ai_bridges/copilot-instructions.md +20 -0
- package/templates/ai_bridges/cursor_synapse_qa.mdc +24 -0
- package/templates/ai_bridges/windsurfrules +26 -0
- package/templates/ci/github-actions-synapse.yml +95 -0
- package/templates/ci/gitlab-ci-synapse.yml +16 -0
- package/templates/ui/index.html +1069 -0
- package/templates/welcome.html.tmpl +2074 -0
- package/tools/.infer_baseline.json +30 -0
- package/tools/TOOLS_RUNBOOK.md +1553 -0
- package/tools/TOOL_CATALOG.json +1769 -0
- package/tools/__init__.py +43 -0
- package/tools/_openapi_parser.py +158 -0
- package/tools/agent_canary.py +525 -0
- package/tools/agentless_patcher.py +417 -0
- package/tools/analyze_project.py +262 -0
- package/tools/api_drift_sentinel.py +208 -0
- package/tools/api_fuzzer.py +762 -0
- package/tools/author_integrity.py +190 -0
- package/tools/auto_heal.py +271 -0
- package/tools/auto_heal_reflexion.py +532 -0
- package/tools/autogen_qa_broker.py +844 -0
- package/tools/benchmark_swarm_context.py +394 -0
- package/tools/browser_helpers.js +746 -0
- package/tools/browsergym_eval.py +236 -0
- package/tools/bug_reporter.py +252 -0
- package/tools/bump_version.py +423 -0
- package/tools/cache_resolver.py +1214 -0
- package/tools/check_env.py +426 -0
- package/tools/check_version_sync.py +256 -0
- package/tools/ci_healing_hook.py +126 -0
- package/tools/cli.py +1598 -0
- package/tools/config_decoupler.py +253 -0
- package/tools/contract_validator.py +141 -0
- package/tools/core/__init__.py +70 -0
- package/tools/core/adapters.py +431 -0
- package/tools/core/circuit_breaker.py +263 -0
- package/tools/core/cli_runtime.py +66 -0
- package/tools/core/file_lock.py +159 -0
- package/tools/core/i18n.py +394 -0
- package/tools/core/memory_bus.py +905 -0
- package/tools/core/process_supervisor.py +332 -0
- package/tools/core/telemetry.py +329 -0
- package/tools/count_tokens.py +1267 -0
- package/tools/create_mock_docx.py +104 -0
- package/tools/dashboard_generator.py +2403 -0
- package/tools/db_sandbox.py +675 -0
- package/tools/debt_harvester.py +237 -0
- package/tools/distill_log.py +161 -0
- package/tools/dspy_qa_signatures.py +356 -0
- package/tools/e2e_flow_prober.py +132 -0
- package/tools/export_postman_collection.py +945 -0
- package/tools/flaky_detector.py +389 -0
- package/tools/fsm_enforcer.py +450 -0
- package/tools/fsm_middleware.py +401 -0
- package/tools/fuzz_payloads.py +197 -0
- package/tools/generate_allure_report.py +88 -0
- package/tools/generate_api_matrix.py +193 -0
- package/tools/generate_jmx_plan.py +1322 -0
- package/tools/generate_sbom.py +252 -0
- package/tools/generate_tc_from_story.py +203 -0
- package/tools/generate_test_reports.py +133 -0
- package/tools/generate_tool_catalog.py +482 -0
- package/tools/gherkin_suite.py +758 -0
- package/tools/git_pre_commit_guard.py +298 -0
- package/tools/goldfish_review.py +366 -0
- package/tools/heal/__init__.py +28 -0
- package/tools/heal_pr_automator.py +220 -0
- package/tools/heuristic_locator_matcher.py +351 -0
- package/tools/hub_publisher.py +623 -0
- package/tools/humanize_linter.py +438 -0
- package/tools/infer_linter.py +977 -0
- package/tools/init_config.py +306 -0
- package/tools/interview_story.py +116 -0
- package/tools/jira_sync.py +566 -0
- package/tools/jtl_analyzer.py +474 -0
- package/tools/lint/__init__.py +30 -0
- package/tools/lint_ai_docs.py +374 -0
- package/tools/lookup_tc.py +165 -0
- package/tools/lookup_xpath.py +167 -0
- package/tools/matrix_sharder.py +148 -0
- package/tools/mcp/__init__.py +18 -0
- package/tools/mcp_docx_server.ps1 +13 -0
- package/tools/mcp_docx_server.py +851 -0
- package/tools/mcp_excel_server.ps1 +13 -0
- package/tools/mcp_excel_server.py +441 -0
- package/tools/mcp_server.py +725 -0
- package/tools/md_to_xlsx.py +327 -0
- package/tools/micro_mutator.py +887 -0
- package/tools/mipro_assertion_tuner.py +210 -0
- package/tools/network_mock_shield.py +311 -0
- package/tools/newman_analyzer.py +384 -0
- package/tools/omni_emitter.py +579 -0
- package/tools/omni_parser.py +450 -0
- package/tools/omni_transpiler.py +168 -0
- package/tools/openxml_guard.py +438 -0
- package/tools/output_formatter.py +182 -0
- package/tools/package_release.py +325 -0
- package/tools/perf/__init__.py +24 -0
- package/tools/pinpoint_failure.py +190 -0
- package/tools/project_state.py +171 -0
- package/tools/qa_event_stream.py +358 -0
- package/tools/repo_map.py +346 -0
- package/tools/report/__init__.py +32 -0
- package/tools/reversible_sandbox.py +344 -0
- package/tools/safety_firewall.py +437 -0
- package/tools/security_coverage_ledger.py +538 -0
- package/tools/security_scanner.py +229 -0
- package/tools/senior_code_review.py +393 -0
- package/tools/setup_project.py +770 -0
- package/tools/skill_collision_guard.py +304 -0
- package/tools/skill_profiles.py +217 -0
- package/tools/skill_vault.py +481 -0
- package/tools/skillspector.py +1278 -0
- package/tools/smart_visual_masker.py +132 -0
- package/tools/spec_drift_sentinel.py +438 -0
- package/tools/swe_qa_aci.py +369 -0
- package/tools/synapse_observer.py +485 -0
- package/tools/synapse_qa_bench.py +190 -0
- package/tools/sync_agent_rules.py +274 -0
- package/tools/telemetry_correlator.py +397 -0
- package/tools/template_excel_exporter.py +514 -0
- package/tools/templates/jmeter-distributed/README.md +54 -0
- package/tools/templates/jmeter-distributed/docker-compose.yml +83 -0
- package/tools/test_impact.py +419 -0
- package/tools/test_memory_os.py +462 -0
- package/tools/textgrad_mutation_optimizer.py +237 -0
- package/tools/tms_sync_bridge.py +834 -0
- package/tools/tot_exploratory_tester.py +239 -0
- package/tools/trace_data_flow.py +240 -0
- package/tools/traffic_session_converter.py +256 -0
- package/tools/trend_analytics.py +314 -0
- package/tools/ui_server.py +401 -0
- package/tools/universal_ir.py +488 -0
- package/tools/update_sentinel.py +383 -0
- package/tools/validate_groovy_scripts.py +173 -0
- package/tools/verify_all.py +1271 -0
- package/tools/visual_diff_canvas.py +143 -0
- package/tools/visual_som_helper.py +550 -0
- package/tools/watch_mode.py +308 -0
- package/tools/wcag_audit.py +239 -0
- package/tools/welcome_page.py +290 -0
|
@@ -0,0 +1,762 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
Enterprise Autonomous API Fuzzing & Chaos Breaker
|
|
5
|
+
-------------------------------------------------
|
|
6
|
+
Zero-dependency, active runtime API mutator and resilience tester.
|
|
7
|
+
Ingests OpenAPI 3.x / Swagger 2.0 specifications (or endpoint catalogs),
|
|
8
|
+
generates dynamic boundary, type-inverted, and adversarial fuzzing payloads,
|
|
9
|
+
and executes live HTTP/S requests against staging/test APIs.
|
|
10
|
+
|
|
11
|
+
Three-Alarm Oracle Detection:
|
|
12
|
+
1. HTTP 500 / 502 / 503 Internal Server Error (Backend crash / unhandled fault)
|
|
13
|
+
2. Database & Framework Stacktrace Leaks (SQL injection reflection, Django/Spring/Postgres traces)
|
|
14
|
+
3. SLA Latency Breach (> 3000ms response time - potential ReDoS or lock contention)
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import os
|
|
18
|
+
import re
|
|
19
|
+
import sys
|
|
20
|
+
import json
|
|
21
|
+
import time
|
|
22
|
+
import ssl
|
|
23
|
+
import urllib.request
|
|
24
|
+
import urllib.error
|
|
25
|
+
import urllib.parse
|
|
26
|
+
import argparse
|
|
27
|
+
from typing import Dict, Any, List, Optional
|
|
28
|
+
|
|
29
|
+
# Enforce UTF-8 stdout encoding for Windows/macOS/Linux compatibility
|
|
30
|
+
if hasattr(sys.stdout, 'reconfigure'):
|
|
31
|
+
try:
|
|
32
|
+
sys.stdout.reconfigure(encoding='utf-8')
|
|
33
|
+
sys.stderr.reconfigure(encoding='utf-8')
|
|
34
|
+
except Exception:
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
38
|
+
HUB_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, ".."))
|
|
39
|
+
REPORTS_DIR = os.path.join(HUB_ROOT, "reports")
|
|
40
|
+
|
|
41
|
+
if SCRIPT_DIR not in sys.path:
|
|
42
|
+
sys.path.insert(0, SCRIPT_DIR)
|
|
43
|
+
|
|
44
|
+
try:
|
|
45
|
+
from fuzz_payloads import get_fuzz_payloads, get_field_fuzz_scenarios
|
|
46
|
+
except ImportError:
|
|
47
|
+
get_fuzz_payloads = None
|
|
48
|
+
get_field_fuzz_scenarios = None
|
|
49
|
+
|
|
50
|
+
# Stacktrace and DB leak pattern signatures
|
|
51
|
+
STACKTRACE_LEAK_PATTERNS = [
|
|
52
|
+
re.compile(r'Traceback \(most recent call last\):', re.IGNORECASE),
|
|
53
|
+
re.compile(r'Exception in thread "[^"]+"', re.IGNORECASE),
|
|
54
|
+
re.compile(r'\b(org\.springframework|org\.hibernate|java\.lang\.NullPointerException)\b', re.IGNORECASE),
|
|
55
|
+
re.compile(r'\b(psycopg2\.(OperationalError|ProgrammingError)|PSQLException)\b', re.IGNORECASE),
|
|
56
|
+
re.compile(r'\b(mysql_error|mysqli_sql_exception|pymysql\.err)\b', re.IGNORECASE),
|
|
57
|
+
re.compile(r'\b(sqlite3\.OperationalError|SQLiteException)\b', re.IGNORECASE),
|
|
58
|
+
re.compile(r'\b(django\.db\.utils|sqlalchemy\.exc)\b', re.IGNORECASE),
|
|
59
|
+
re.compile(r'SQLSTATE\[[0-9A-Z]{5}\]', re.IGNORECASE),
|
|
60
|
+
re.compile(r'syntax error at or near\s+"', re.IGNORECASE),
|
|
61
|
+
re.compile(r'ODBC SQL Server Driver', re.IGNORECASE),
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
# Severity taxonomy (concept borrowed from OWASP ZAP's alert risk levels,
|
|
65
|
+
# Apache-2.0 - re-expressed for the fuzz oracle). Each alarm class maps to a
|
|
66
|
+
# fixed risk level so CI can gate on CRITICAL findings alone.
|
|
67
|
+
ALARM_SEVERITY = {
|
|
68
|
+
"HTTP_": "HIGH", # HTTP_500/502/503_SERVER_CRASH
|
|
69
|
+
"STACKTRACE_LEAK": "CRITICAL",
|
|
70
|
+
"SLA_TIMEOUT": "LOW",
|
|
71
|
+
"AUTH_BYPASS": "CRITICAL",
|
|
72
|
+
"CONNECTION_ERROR": "MEDIUM",
|
|
73
|
+
}
|
|
74
|
+
SEVERITY_LEVELS = ["INFO", "LOW", "MEDIUM", "HIGH", "CRITICAL"]
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def classify_alarm_severity(alarm: str) -> str:
|
|
78
|
+
"""Maps an alarm string onto the ZAP-style severity taxonomy."""
|
|
79
|
+
for prefix, severity in ALARM_SEVERITY.items():
|
|
80
|
+
if alarm.startswith(prefix):
|
|
81
|
+
return severity
|
|
82
|
+
return "INFO"
|
|
83
|
+
|
|
84
|
+
GREEN = "\033[92m"
|
|
85
|
+
RED = "\033[91m"
|
|
86
|
+
YELLOW = "\033[93m"
|
|
87
|
+
CYAN = "\033[96m"
|
|
88
|
+
BOLD = "\033[1m"
|
|
89
|
+
RESET = "\033[0m"
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class ApiFuzzer:
|
|
93
|
+
"""Autonomous runtime API fuzzer with three-alarm defect Oracle."""
|
|
94
|
+
|
|
95
|
+
def __init__(
|
|
96
|
+
self,
|
|
97
|
+
base_url: str,
|
|
98
|
+
spec_path_or_url: Optional[str] = None,
|
|
99
|
+
headers: Optional[Dict[str, str]] = None,
|
|
100
|
+
timeout_sec: float = 10.0,
|
|
101
|
+
sla_ms: float = 3000.0,
|
|
102
|
+
verify_ssl: bool = True,
|
|
103
|
+
insecure: bool = False
|
|
104
|
+
):
|
|
105
|
+
self.base_url = base_url.rstrip("/")
|
|
106
|
+
self.spec_path = spec_path_or_url
|
|
107
|
+
self.custom_headers = headers or {"Content-Type": "application/json", "User-Agent": "AgentQA-Fuzzer/2.0"}
|
|
108
|
+
self.timeout_sec = timeout_sec
|
|
109
|
+
self.sla_ms = sla_ms
|
|
110
|
+
self.insecure = insecure or (not verify_ssl)
|
|
111
|
+
self.verify_ssl = not self.insecure
|
|
112
|
+
|
|
113
|
+
# Environment Allowlist Guard (F2 Safety Discipline)
|
|
114
|
+
# Prevents accidental fuzzing or stress bombardment against production environments
|
|
115
|
+
parsed = urllib.parse.urlparse(self.base_url)
|
|
116
|
+
host = (parsed.hostname or "").lower().strip()
|
|
117
|
+
is_safe_env = self._is_safe_non_prod_host(host)
|
|
118
|
+
allowed_hosts = {
|
|
119
|
+
h.strip().lower() for h in os.environ.get("SYNAPSE_ALLOW_PROD_HOSTS", "").split(",") if h.strip()
|
|
120
|
+
}
|
|
121
|
+
is_host_specifically_allowed = host in allowed_hosts
|
|
122
|
+
global_override = os.environ.get("SYNAPSE_ALLOW_PROD_FUZZ") in ("1", "true", "TRUE")
|
|
123
|
+
|
|
124
|
+
if host and not is_safe_env and not (is_host_specifically_allowed or global_override):
|
|
125
|
+
raise PermissionError(
|
|
126
|
+
f"[SAFETY FIREWALL - REJECTED] Target host '{host}' is not in the allowed non-production environment allowlist "
|
|
127
|
+
"(localhost, private IP, .local/.internal, or verified dev/staging/qa/test subdomain). "
|
|
128
|
+
f"To authorize this host specifically, set SYNAPSE_ALLOW_PROD_HOSTS='{host}' or SYNAPSE_ALLOW_PROD_FUZZ=1 if authorized."
|
|
129
|
+
)
|
|
130
|
+
if host and not is_safe_env and global_override and not is_host_specifically_allowed:
|
|
131
|
+
print(f" ⚠️ [SECURITY WARNING] SYNAPSE_ALLOW_PROD_FUZZ=1 global override active for host '{host}'. "
|
|
132
|
+
f"Prefer setting SYNAPSE_ALLOW_PROD_HOSTS='{host}' for host-scoped permission.")
|
|
133
|
+
|
|
134
|
+
# Prepare SSL context (support self-signed staging certificates via explicit --insecure flag)
|
|
135
|
+
self.ssl_context = ssl.create_default_context()
|
|
136
|
+
if self.insecure:
|
|
137
|
+
print(" ⚠️ [SECURITY NOTICE] TLS certificate verification is explicitly disabled (--insecure).")
|
|
138
|
+
self.ssl_context.check_hostname = False
|
|
139
|
+
self.ssl_context.verify_mode = ssl.CERT_NONE
|
|
140
|
+
|
|
141
|
+
@staticmethod
|
|
142
|
+
def _is_safe_non_prod_host(host: str) -> bool:
|
|
143
|
+
"""
|
|
144
|
+
Validates whether a hostname strictly belongs to a local, private, or non-production environment.
|
|
145
|
+
Prevents substring false positives on production domains like 'devex.com', 'contest.gov', or 'attestation-bank.com'.
|
|
146
|
+
"""
|
|
147
|
+
if not host:
|
|
148
|
+
return False
|
|
149
|
+
|
|
150
|
+
host = host.lower().strip()
|
|
151
|
+
|
|
152
|
+
# 0. User-specified explicit host allowlist via SYNAPSE_ALLOWED_HOSTS
|
|
153
|
+
allowed_env = os.environ.get("SYNAPSE_ALLOWED_HOSTS", "").strip()
|
|
154
|
+
if allowed_env:
|
|
155
|
+
for item in allowed_env.split(","):
|
|
156
|
+
pattern = item.strip().lower()
|
|
157
|
+
if pattern:
|
|
158
|
+
if pattern.startswith("*.") and (host.endswith(pattern[1:]) or host == pattern[2:]):
|
|
159
|
+
return True
|
|
160
|
+
if host == pattern:
|
|
161
|
+
return True
|
|
162
|
+
|
|
163
|
+
# 1. Exact loopback / special names
|
|
164
|
+
if host in ("localhost", "127.0.0.1", "::1", "0.0.0.0"): # nosec B104
|
|
165
|
+
return True
|
|
166
|
+
|
|
167
|
+
# 2. Check IP address (loopback or private RFC 1918, disallowing link-local metadata like 169.254.169.254)
|
|
168
|
+
try:
|
|
169
|
+
import ipaddress
|
|
170
|
+
ip = ipaddress.ip_address(host)
|
|
171
|
+
if ip.is_link_local or ip in ipaddress.ip_network("169.254.0.0/16"):
|
|
172
|
+
return False
|
|
173
|
+
return ip.is_loopback or ip.is_private
|
|
174
|
+
except ValueError:
|
|
175
|
+
ip = None # host is a domain name, not an IP literal
|
|
176
|
+
|
|
177
|
+
# 2b. DNS resolution check (anti-SSRF / DNS rebinding against cloud metadata 169.254.0.0/16)
|
|
178
|
+
try:
|
|
179
|
+
import socket
|
|
180
|
+
import ipaddress
|
|
181
|
+
addr_info = socket.getaddrinfo(host, None, socket.AF_UNSPEC, socket.SOCK_STREAM)
|
|
182
|
+
for _, _, _, _, sockaddr in addr_info:
|
|
183
|
+
resolved_ip = ipaddress.ip_address(sockaddr[0])
|
|
184
|
+
if resolved_ip.is_link_local or resolved_ip in ipaddress.ip_network("169.254.0.0/16"):
|
|
185
|
+
return False
|
|
186
|
+
except (socket.gaierror, OSError) as dns_err:
|
|
187
|
+
# Offline test environment or unresolvable mock domain; fall through to lexical verification
|
|
188
|
+
_dns_unresolved = str(dns_err)
|
|
189
|
+
|
|
190
|
+
# 3. Special-use TLDs (RFC 6761 / RFC 2606)
|
|
191
|
+
if any(host.endswith(tld) for tld in (".local", ".localhost", ".internal", ".test")):
|
|
192
|
+
return True
|
|
193
|
+
|
|
194
|
+
labels = host.split('.')
|
|
195
|
+
|
|
196
|
+
# 4. Reject production markers anywhere in hostname (e.g. prod-test.bank.com)
|
|
197
|
+
if any(re.search(r'(?:^|[-_])(prod|production)(?:$|[-_])', lbl) for lbl in labels):
|
|
198
|
+
return False
|
|
199
|
+
|
|
200
|
+
# 5. Prevent domain spoofing (e.g. bank.com.test.evil.io where public TLD appears in subdomains)
|
|
201
|
+
common_public_tlds = {
|
|
202
|
+
'com', 'org', 'net', 'edu', 'gov', 'mil', 'io', 'co', 'vn', 'uk', 'de',
|
|
203
|
+
'fr', 'jp', 'cn', 'ru', 'br', 'in', 'ca', 'au', 'info', 'biz'
|
|
204
|
+
}
|
|
205
|
+
if any(lbl in common_public_tlds for lbl in labels[:-2]):
|
|
206
|
+
return False
|
|
207
|
+
|
|
208
|
+
# 6. Apex domains (e.g. bank-test.com, test.com) cannot be assumed non-prod without explicit config
|
|
209
|
+
if len(labels) < 3:
|
|
210
|
+
return False
|
|
211
|
+
|
|
212
|
+
# 7. Subdomain verification (must be in leading subdomains preceding the root domain)
|
|
213
|
+
subdomain_labels = labels[:-2]
|
|
214
|
+
safe_exact_tokens = {"dev", "development", "staging", "qa", "test", "sandbox", "uat", "local", "internal"}
|
|
215
|
+
safe_sub_regex = re.compile(
|
|
216
|
+
r"^(dev|development|staging|qa|test|sandbox|uat)(?:[-_][a-zA-Z0-9]+)*$|^(?:[a-zA-Z0-9]+[-_])+(dev|development|staging|qa|test|sandbox|uat)(?:[-_][a-zA-Z0-9]+)*$",
|
|
217
|
+
re.IGNORECASE
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
for sub in subdomain_labels:
|
|
221
|
+
if sub in safe_exact_tokens or safe_sub_regex.match(sub):
|
|
222
|
+
return True
|
|
223
|
+
|
|
224
|
+
return False
|
|
225
|
+
|
|
226
|
+
def load_spec(self) -> Dict[str, Any]:
|
|
227
|
+
"""Loads OpenAPI or Swagger specification from file or URL."""
|
|
228
|
+
if not self.spec_path:
|
|
229
|
+
# Fallback default health and mock endpoints
|
|
230
|
+
return {
|
|
231
|
+
"paths": {
|
|
232
|
+
"/api/v1/users": {
|
|
233
|
+
"post": {
|
|
234
|
+
"summary": "Create user",
|
|
235
|
+
"requestBody": {
|
|
236
|
+
"content": {
|
|
237
|
+
"application/json": {
|
|
238
|
+
"schema": {
|
|
239
|
+
"type": "object",
|
|
240
|
+
"properties": {
|
|
241
|
+
"username": {"type": "string", "maxLength": 50},
|
|
242
|
+
"age": {"type": "integer", "minimum": 1, "maximum": 120},
|
|
243
|
+
"email": {"type": "string"}
|
|
244
|
+
},
|
|
245
|
+
"required": ["username"]
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if self.spec_path.startswith(("http://", "https://")):
|
|
256
|
+
req = urllib.request.Request(self.spec_path, headers={"User-Agent": "AgentQA-Fuzzer/2.0"})
|
|
257
|
+
with urllib.request.urlopen(req, context=self.ssl_context, timeout=10.0) as resp: # nosec B310
|
|
258
|
+
raw = resp.read().decode("utf-8")
|
|
259
|
+
return json.loads(raw)
|
|
260
|
+
else:
|
|
261
|
+
if not os.path.exists(self.spec_path):
|
|
262
|
+
raise FileNotFoundError(f"OpenAPI spec not found: {self.spec_path}")
|
|
263
|
+
with open(self.spec_path, "r", encoding="utf-8") as f:
|
|
264
|
+
return json.load(f)
|
|
265
|
+
|
|
266
|
+
def extract_fuzz_targets(self, spec: Dict[str, Any]) -> List[Dict[str, Any]]:
|
|
267
|
+
"""Extracts actionable API routes and property schemas from spec."""
|
|
268
|
+
targets = []
|
|
269
|
+
paths = spec.get("paths", {})
|
|
270
|
+
for path, path_item in paths.items():
|
|
271
|
+
for method, details in path_item.items():
|
|
272
|
+
if method.lower() not in ("get", "post", "put", "patch", "delete"):
|
|
273
|
+
continue
|
|
274
|
+
|
|
275
|
+
req_body = details.get("requestBody", {}).get("content", {}).get("application/json", {}).get("schema", {})
|
|
276
|
+
props = req_body.get("properties", {})
|
|
277
|
+
required = req_body.get("required", [])
|
|
278
|
+
|
|
279
|
+
targets.append({
|
|
280
|
+
"path": path,
|
|
281
|
+
"method": method.upper(),
|
|
282
|
+
"summary": details.get("summary", f"{method.upper()} {path}"),
|
|
283
|
+
"parameters": details.get("parameters", []),
|
|
284
|
+
"properties": props,
|
|
285
|
+
"required": required
|
|
286
|
+
})
|
|
287
|
+
return targets
|
|
288
|
+
|
|
289
|
+
def generate_mutations(self, target: Dict[str, Any]) -> List[Dict[str, Any]]:
|
|
290
|
+
"""Generates dynamic mutation vectors for query params and request body."""
|
|
291
|
+
mutations = []
|
|
292
|
+
props = target.get("properties", {})
|
|
293
|
+
method = target["method"]
|
|
294
|
+
path = target["path"]
|
|
295
|
+
|
|
296
|
+
# Base valid skeleton
|
|
297
|
+
valid_body: Dict[str, Any] = {}
|
|
298
|
+
for p_name, p_schema in props.items():
|
|
299
|
+
t = p_schema.get("type", "string")
|
|
300
|
+
if t == "string":
|
|
301
|
+
valid_body[p_name] = f"valid_{p_name}"
|
|
302
|
+
elif t in ("integer", "number"):
|
|
303
|
+
valid_body[p_name] = 10
|
|
304
|
+
elif t == "boolean":
|
|
305
|
+
valid_body[p_name] = True
|
|
306
|
+
else:
|
|
307
|
+
valid_body[p_name] = "test"
|
|
308
|
+
|
|
309
|
+
# 1. Baseline Happy-Path
|
|
310
|
+
mutations.append({
|
|
311
|
+
"name": f"{method} {path} - Baseline Happy-Path",
|
|
312
|
+
"type": "BASELINE",
|
|
313
|
+
"path": path,
|
|
314
|
+
"method": method,
|
|
315
|
+
"body": valid_body,
|
|
316
|
+
"headers": self.custom_headers
|
|
317
|
+
})
|
|
318
|
+
|
|
319
|
+
# 2. Field Fuzzing Payloads
|
|
320
|
+
for p_name, p_schema in props.items():
|
|
321
|
+
p_type = p_schema.get("type", "string")
|
|
322
|
+
|
|
323
|
+
# A. Extreme Buffer Stress (10,000 chars)
|
|
324
|
+
mut_body = dict(valid_body)
|
|
325
|
+
mut_body[p_name] = "A" * 10000
|
|
326
|
+
mutations.append({
|
|
327
|
+
"name": f"{method} {path} - Buffer Stress on '{p_name}'",
|
|
328
|
+
"type": "BUFFER_STRESS",
|
|
329
|
+
"path": path,
|
|
330
|
+
"method": method,
|
|
331
|
+
"body": mut_body,
|
|
332
|
+
"headers": self.custom_headers
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
# B. SQLi Polyglot Probe
|
|
336
|
+
mut_body = dict(valid_body)
|
|
337
|
+
mut_body[p_name] = "' OR '1'='1' -- /* injected */"
|
|
338
|
+
mutations.append({
|
|
339
|
+
"name": f"{method} {path} - SQLi Polyglot Probe on '{p_name}'",
|
|
340
|
+
"type": "SQLI_INJECTION",
|
|
341
|
+
"path": path,
|
|
342
|
+
"method": method,
|
|
343
|
+
"body": mut_body,
|
|
344
|
+
"headers": self.custom_headers
|
|
345
|
+
})
|
|
346
|
+
|
|
347
|
+
# C. Unicode BiDi / RTL Trojan Source
|
|
348
|
+
mut_body = dict(valid_body)
|
|
349
|
+
mut_body[p_name] = "\u202E\u0041\u0042\u0043_AUTO_TX"
|
|
350
|
+
mutations.append({
|
|
351
|
+
"name": f"{method} {path} - Unicode BiDi RTL Override on '{p_name}'",
|
|
352
|
+
"type": "BIDI_UNICODE",
|
|
353
|
+
"path": path,
|
|
354
|
+
"method": method,
|
|
355
|
+
"body": mut_body,
|
|
356
|
+
"headers": self.custom_headers
|
|
357
|
+
})
|
|
358
|
+
|
|
359
|
+
# D. Null Byte Injection
|
|
360
|
+
mut_body = dict(valid_body)
|
|
361
|
+
mut_body[p_name] = f"data\x00{p_name}.json"
|
|
362
|
+
mutations.append({
|
|
363
|
+
"name": f"{method} {path} - Null Byte Injection on '{p_name}'",
|
|
364
|
+
"type": "NULL_BYTE",
|
|
365
|
+
"path": path,
|
|
366
|
+
"method": method,
|
|
367
|
+
"body": mut_body,
|
|
368
|
+
"headers": self.custom_headers
|
|
369
|
+
})
|
|
370
|
+
|
|
371
|
+
# E. Numeric Boundaries (if integer)
|
|
372
|
+
if p_type in ("integer", "number"):
|
|
373
|
+
mut_body = dict(valid_body)
|
|
374
|
+
mut_body[p_name] = 2147483648 # 32-bit overflow
|
|
375
|
+
mutations.append({
|
|
376
|
+
"name": f"{method} {path} - 32-bit Integer Overflow on '{p_name}'",
|
|
377
|
+
"type": "NUMERIC_OVERFLOW",
|
|
378
|
+
"path": path,
|
|
379
|
+
"method": method,
|
|
380
|
+
"body": mut_body,
|
|
381
|
+
"headers": self.custom_headers
|
|
382
|
+
})
|
|
383
|
+
|
|
384
|
+
# F. Type Inversion (String where integer expected or vice versa)
|
|
385
|
+
mut_body = dict(valid_body)
|
|
386
|
+
mut_body[p_name] = 99999 if p_type == "string" else "NOT_A_NUMBER"
|
|
387
|
+
mutations.append({
|
|
388
|
+
"name": f"{method} {path} - Type Mutation on '{p_name}'",
|
|
389
|
+
"type": "TYPE_MUTATION",
|
|
390
|
+
"path": path,
|
|
391
|
+
"method": method,
|
|
392
|
+
"body": mut_body,
|
|
393
|
+
"headers": self.custom_headers
|
|
394
|
+
})
|
|
395
|
+
|
|
396
|
+
# 3. Auth Bypass Vector (Remove Authorization Header)
|
|
397
|
+
mut_headers = {k: v for k, v in self.custom_headers.items() if k.lower() != "authorization"}
|
|
398
|
+
mutations.append({
|
|
399
|
+
"name": f"{method} {path} - Auth Token Omission Probe",
|
|
400
|
+
"type": "AUTH_OMISSION",
|
|
401
|
+
"path": path,
|
|
402
|
+
"method": method,
|
|
403
|
+
"body": valid_body,
|
|
404
|
+
"headers": mut_headers
|
|
405
|
+
})
|
|
406
|
+
|
|
407
|
+
# 4. Catalog-Driven Vectors via tools/fuzz_payloads.py (XSS polyglots,
|
|
408
|
+
# emoji surrogates, numeric boundaries). Formerly a dead import -
|
|
409
|
+
# now wired into generation so the catalog actually fires.
|
|
410
|
+
if get_field_fuzz_scenarios is not None:
|
|
411
|
+
existing_names = {m["name"] for m in mutations}
|
|
412
|
+
for p_name, p_schema in props.items():
|
|
413
|
+
p_type = p_schema.get("type", "string")
|
|
414
|
+
for scen in get_field_fuzz_scenarios(p_name, p_type):
|
|
415
|
+
mut_body = dict(valid_body)
|
|
416
|
+
mut_body[p_name] = scen["value"]
|
|
417
|
+
name = f"{method} {path} - {scen['scenario']}"
|
|
418
|
+
if name in existing_names:
|
|
419
|
+
continue
|
|
420
|
+
existing_names.add(name)
|
|
421
|
+
mutations.append({
|
|
422
|
+
"name": name,
|
|
423
|
+
"type": scen["category"],
|
|
424
|
+
"path": path,
|
|
425
|
+
"method": method,
|
|
426
|
+
"body": mut_body,
|
|
427
|
+
"headers": self.custom_headers
|
|
428
|
+
})
|
|
429
|
+
|
|
430
|
+
return mutations
|
|
431
|
+
|
|
432
|
+
def execute_request(self, mutation: Dict[str, Any], dry_run: bool = False) -> Dict[str, Any]:
|
|
433
|
+
"""Dispatches HTTP mutation and evaluates the three-alarm Oracle."""
|
|
434
|
+
url = f"{self.base_url}{mutation['path']}"
|
|
435
|
+
method = mutation["method"]
|
|
436
|
+
body_data = None
|
|
437
|
+
if method in ("POST", "PUT", "PATCH") and mutation.get("body") is not None:
|
|
438
|
+
body_data = json.dumps(mutation["body"]).encode("utf-8")
|
|
439
|
+
|
|
440
|
+
if dry_run:
|
|
441
|
+
# Deterministic offline mock for CI & local checks
|
|
442
|
+
return {
|
|
443
|
+
"name": mutation["name"],
|
|
444
|
+
"type": mutation["type"],
|
|
445
|
+
"url": url,
|
|
446
|
+
"method": method,
|
|
447
|
+
"status_code": 400 if mutation["type"] != "BASELINE" else 200,
|
|
448
|
+
"duration_ms": 42.5,
|
|
449
|
+
"verdict": "PASS",
|
|
450
|
+
"severity": "INFO",
|
|
451
|
+
"alarms": [],
|
|
452
|
+
"response_preview": '{"status": "handled_by_dry_run"}'
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
req = urllib.request.Request(
|
|
456
|
+
url=url,
|
|
457
|
+
data=body_data,
|
|
458
|
+
headers=mutation["headers"],
|
|
459
|
+
method=method
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
start_time = time.time()
|
|
463
|
+
status_code = 0
|
|
464
|
+
response_body = ""
|
|
465
|
+
duration_ms = 0.0
|
|
466
|
+
|
|
467
|
+
try:
|
|
468
|
+
with urllib.request.urlopen(req, context=self.ssl_context, timeout=self.timeout_sec) as resp: # nosec B310
|
|
469
|
+
status_code = resp.getcode()
|
|
470
|
+
response_body = resp.read().decode("utf-8", errors="replace")
|
|
471
|
+
except urllib.error.HTTPError as he:
|
|
472
|
+
status_code = he.code
|
|
473
|
+
try:
|
|
474
|
+
response_body = he.read().decode("utf-8", errors="replace")
|
|
475
|
+
except Exception:
|
|
476
|
+
response_body = str(he)
|
|
477
|
+
except urllib.error.URLError as ue:
|
|
478
|
+
status_code = -1
|
|
479
|
+
response_body = str(ue.reason)
|
|
480
|
+
except Exception as e:
|
|
481
|
+
status_code = -2
|
|
482
|
+
response_body = str(e)
|
|
483
|
+
|
|
484
|
+
duration_ms = round((time.time() - start_time) * 1000, 2)
|
|
485
|
+
|
|
486
|
+
# ----------------------------------------------------
|
|
487
|
+
# THREE-ALARM DEFECT ORACLE EVALUATION
|
|
488
|
+
# ----------------------------------------------------
|
|
489
|
+
alarms = []
|
|
490
|
+
|
|
491
|
+
# Alarm 1: HTTP 500 / 502 / 503 Internal Server Error
|
|
492
|
+
if status_code in (500, 502, 503):
|
|
493
|
+
alarms.append(f"HTTP_{status_code}_SERVER_CRASH: Unhandled backend exception / server panic")
|
|
494
|
+
|
|
495
|
+
# Alarm 2: Database / Framework Stacktrace Leak
|
|
496
|
+
for pattern in STACKTRACE_LEAK_PATTERNS:
|
|
497
|
+
if pattern.search(response_body):
|
|
498
|
+
matched = pattern.pattern
|
|
499
|
+
alarms.append(f"STACKTRACE_LEAK: Response leaks backend internals matching '{matched}'")
|
|
500
|
+
break
|
|
501
|
+
|
|
502
|
+
# Alarm 3: SLA Latency Breach (> 3000ms)
|
|
503
|
+
if duration_ms > self.sla_ms:
|
|
504
|
+
alarms.append(f"SLA_TIMEOUT: Response took {duration_ms}ms (threshold: {self.sla_ms}ms), possible ReDoS or DB lock")
|
|
505
|
+
|
|
506
|
+
# Alarm 4: Auth Bypass (OMISSION succeeded with 200/201)
|
|
507
|
+
if mutation["type"] == "AUTH_OMISSION" and status_code in (200, 201):
|
|
508
|
+
alarms.append("AUTH_BYPASS_VULNERABILITY: Endpoint returned 200 OK without Authorization header")
|
|
509
|
+
|
|
510
|
+
# Alarm 5: Target unreachable - an endpoint that could not be tested
|
|
511
|
+
# must NEVER be reported as PASS (Truth Anchor discipline).
|
|
512
|
+
if status_code < 0:
|
|
513
|
+
alarms.append("CONNECTION_ERROR: Target unreachable or transport failure - endpoint could not be verified")
|
|
514
|
+
|
|
515
|
+
verdict = "FAIL" if alarms else "PASS"
|
|
516
|
+
severity = "INFO"
|
|
517
|
+
if alarms:
|
|
518
|
+
severity = max(
|
|
519
|
+
(classify_alarm_severity(a) for a in alarms),
|
|
520
|
+
key=lambda s: SEVERITY_LEVELS.index(s)
|
|
521
|
+
)
|
|
522
|
+
|
|
523
|
+
return {
|
|
524
|
+
"name": mutation["name"],
|
|
525
|
+
"type": mutation["type"],
|
|
526
|
+
"url": url,
|
|
527
|
+
"method": method,
|
|
528
|
+
"status_code": status_code,
|
|
529
|
+
"duration_ms": duration_ms,
|
|
530
|
+
"verdict": verdict,
|
|
531
|
+
"severity": severity,
|
|
532
|
+
"alarms": alarms,
|
|
533
|
+
"response_preview": response_body[:300]
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
def run_fuzz_suite(self, dry_run: bool = False) -> Dict[str, Any]:
|
|
537
|
+
"""Runs the complete fuzzing suite against all extracted targets."""
|
|
538
|
+
spec = self.load_spec()
|
|
539
|
+
targets = self.extract_fuzz_targets(spec)
|
|
540
|
+
|
|
541
|
+
all_mutations = []
|
|
542
|
+
for t in targets:
|
|
543
|
+
all_mutations.extend(self.generate_mutations(t))
|
|
544
|
+
|
|
545
|
+
results = []
|
|
546
|
+
total_failures = 0
|
|
547
|
+
|
|
548
|
+
print(f"\n{BOLD}{CYAN}======================================================================{RESET}")
|
|
549
|
+
print(f"{BOLD}{CYAN} ENTERPRISE AUTONOMOUS API FUZZING & CHAOS BREAKER {RESET}")
|
|
550
|
+
print(f"{BOLD}{CYAN}======================================================================{RESET}")
|
|
551
|
+
print(f" Target Base URL : {self.base_url}")
|
|
552
|
+
print(f" Spec Source : {self.spec_path or 'Default Archetype'}")
|
|
553
|
+
print(f" Total Endpoints : {len(targets)}")
|
|
554
|
+
print(f" Total Mutations : {len(all_mutations)}")
|
|
555
|
+
print(f" SLA Threshold : {self.sla_ms} ms")
|
|
556
|
+
print(f" Mode : {'DRY-RUN (Air-Gapped / Deterministic)' if dry_run else 'LIVE STAGING ATTACK'}\n")
|
|
557
|
+
|
|
558
|
+
for idx, m in enumerate(all_mutations, start=1):
|
|
559
|
+
res = self.execute_request(m, dry_run=dry_run)
|
|
560
|
+
results.append(res)
|
|
561
|
+
|
|
562
|
+
status_str = f"{GREEN}PASS{RESET}" if res["verdict"] == "PASS" else f"{RED}ALARM{RESET}"
|
|
563
|
+
sys.stdout.write(f" [{idx:03d}/{len(all_mutations):03d}] {status_str} | HTTP {res['status_code']} ({res['duration_ms']}ms) | {m['name']}\n")
|
|
564
|
+
if res["alarms"]:
|
|
565
|
+
total_failures += 1
|
|
566
|
+
for alarm in res["alarms"]:
|
|
567
|
+
print(f" 👉 {RED}{BOLD}[DEFECT]{RESET} {alarm}")
|
|
568
|
+
|
|
569
|
+
scorecard = {
|
|
570
|
+
"base_url": self.base_url,
|
|
571
|
+
"timestamp": time.strftime("%Y-%m-%d %H:%M:%S"),
|
|
572
|
+
"mode": "ACTIVE",
|
|
573
|
+
"total_mutations": len(all_mutations),
|
|
574
|
+
"passed": len(all_mutations) - total_failures,
|
|
575
|
+
"failed": total_failures,
|
|
576
|
+
"sla_ms": self.sla_ms,
|
|
577
|
+
"dry_run": dry_run,
|
|
578
|
+
"severity_summary": self._severity_summary(results),
|
|
579
|
+
"results": results
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
# Print Summary Scorecard
|
|
583
|
+
print(f"\n{BOLD}======================================================================{RESET}")
|
|
584
|
+
print(f"{BOLD} API FUZZING ORACLE SCORECARD {RESET}")
|
|
585
|
+
print(f"{BOLD}======================================================================{RESET}")
|
|
586
|
+
print(f" Mutations Executed: {scorecard['total_mutations']}")
|
|
587
|
+
print(f" Clean Handled : {GREEN}{scorecard['passed']}{RESET}")
|
|
588
|
+
print(f" Defects Detected : {RED if total_failures > 0 else GREEN}{scorecard['failed']}{RESET}")
|
|
589
|
+
print(f" Severity Mix : {scorecard['severity_summary']}")
|
|
590
|
+
if total_failures == 0:
|
|
591
|
+
print(f" Verdict : {GREEN}[PASS] API resilient against input fuzzing & chaos.{RESET}")
|
|
592
|
+
else:
|
|
593
|
+
print(f" Verdict : {RED}[FAIL] {total_failures} defect alarms detected. Backend fixes required!{RESET}")
|
|
594
|
+
print("======================================================================\n")
|
|
595
|
+
|
|
596
|
+
# Save Report
|
|
597
|
+
os.makedirs(REPORTS_DIR, exist_ok=True)
|
|
598
|
+
report_path = os.path.join(REPORTS_DIR, "api_fuzz_report.json")
|
|
599
|
+
with open(report_path, "w", encoding="utf-8") as out_file:
|
|
600
|
+
json.dump(scorecard, out_file, indent=2)
|
|
601
|
+
print(f"Full telemetry report saved to: {report_path}")
|
|
602
|
+
|
|
603
|
+
return scorecard
|
|
604
|
+
|
|
605
|
+
@staticmethod
|
|
606
|
+
def _severity_summary(results: List[Dict[str, Any]]) -> Dict[str, int]:
|
|
607
|
+
"""Counts findings per severity level (ZAP-style risk mix)."""
|
|
608
|
+
summary = {level: 0 for level in SEVERITY_LEVELS}
|
|
609
|
+
for res in results:
|
|
610
|
+
sev = res.get("severity", "INFO")
|
|
611
|
+
if sev in summary:
|
|
612
|
+
summary[sev] += 1
|
|
613
|
+
return summary
|
|
614
|
+
|
|
615
|
+
def run_passive_scan(self) -> Dict[str, Any]:
|
|
616
|
+
"""Offline spec-level audit (no HTTP dispatched).
|
|
617
|
+
|
|
618
|
+
Concept borrowed from OWASP ZAP's passive scanning (Apache-2.0):
|
|
619
|
+
findings are pre-flight advisories derived purely from the OpenAPI/
|
|
620
|
+
Swagger document - unreachable endpoints cannot fake a pass here
|
|
621
|
+
because nothing is dispatched at all.
|
|
622
|
+
"""
|
|
623
|
+
spec = self.load_spec()
|
|
624
|
+
has_global_security = bool(spec.get("security"))
|
|
625
|
+
findings: List[Dict[str, Any]] = []
|
|
626
|
+
|
|
627
|
+
for path, methods in spec.get("paths", {}).items():
|
|
628
|
+
for method, op in methods.items():
|
|
629
|
+
if method.lower() not in ("get", "post", "put", "patch", "delete"):
|
|
630
|
+
continue
|
|
631
|
+
op_security = op.get("security") if isinstance(op, dict) else None
|
|
632
|
+
is_protected = has_global_security or bool(op_security)
|
|
633
|
+
label = f"{method.upper()} {path}"
|
|
634
|
+
|
|
635
|
+
if not is_protected and method.lower() in ("post", "put", "patch", "delete"):
|
|
636
|
+
severity = "HIGH" if re.search(r"admin|internal|user", path, re.IGNORECASE) else "MEDIUM"
|
|
637
|
+
findings.append({
|
|
638
|
+
"finding": "AUTH_NOT_DECLARED: Mutating endpoint declares no security requirement",
|
|
639
|
+
"severity": severity,
|
|
640
|
+
"target": label,
|
|
641
|
+
"recommendation": "Declare securitySchemes/security for this operation or document why it is public.",
|
|
642
|
+
})
|
|
643
|
+
|
|
644
|
+
if not is_protected and re.search(r"admin|internal", path, re.IGNORECASE):
|
|
645
|
+
findings.append({
|
|
646
|
+
"finding": "SENSITIVE_PATH_UNPROTECTED: Administrative/internal path is publicly declared",
|
|
647
|
+
"severity": "HIGH",
|
|
648
|
+
"target": label,
|
|
649
|
+
"recommendation": "Gate this path behind an authentication scheme and network policy.",
|
|
650
|
+
})
|
|
651
|
+
|
|
652
|
+
body = op.get("requestBody", {}) if isinstance(op, dict) else {}
|
|
653
|
+
content = body.get("content", {}).get("application/json", {}) if isinstance(body, dict) else {}
|
|
654
|
+
schema = content.get("schema", {})
|
|
655
|
+
props = schema.get("properties", {}) if isinstance(schema, dict) else {}
|
|
656
|
+
unbounded = [
|
|
657
|
+
p_name for p_name, p_schema in props.items()
|
|
658
|
+
if isinstance(p_schema, dict)
|
|
659
|
+
and p_schema.get("type") == "string"
|
|
660
|
+
and not any(k in p_schema for k in ("maxLength", "pattern", "enum", "format"))
|
|
661
|
+
]
|
|
662
|
+
if unbounded:
|
|
663
|
+
findings.append({
|
|
664
|
+
"finding": f"NO_INPUT_VALIDATION_DECLARED: unbounded string props {unbounded[:5]}",
|
|
665
|
+
"severity": "LOW",
|
|
666
|
+
"target": label,
|
|
667
|
+
"recommendation": "Add maxLength/pattern/enum constraints so the contract rejects oversized input.",
|
|
668
|
+
})
|
|
669
|
+
|
|
670
|
+
if not spec.get("info") and spec.get("paths"):
|
|
671
|
+
findings.append({
|
|
672
|
+
"finding": "SPEC_METADATA_MISSING: OpenAPI info block absent",
|
|
673
|
+
"severity": "INFO",
|
|
674
|
+
"target": self.spec_path or "inline-spec",
|
|
675
|
+
"recommendation": "Document title/version/contact so scan reports are traceable to an owner.",
|
|
676
|
+
})
|
|
677
|
+
|
|
678
|
+
severity_summary = {level: 0 for level in SEVERITY_LEVELS}
|
|
679
|
+
for f in findings:
|
|
680
|
+
severity_summary[f["severity"]] += 1
|
|
681
|
+
|
|
682
|
+
blocking = severity_summary["HIGH"] + severity_summary["CRITICAL"]
|
|
683
|
+
|
|
684
|
+
print(f"\n{BOLD}{CYAN}======================================================================{RESET}")
|
|
685
|
+
print(f"{BOLD}{CYAN} API PASSIVE SCAN (Offline Spec Audit - Zero Traffic) {RESET}")
|
|
686
|
+
print(f"{BOLD}{CYAN}======================================================================{RESET}")
|
|
687
|
+
print(f" Spec Source : {self.spec_path or 'Default Archetype'}")
|
|
688
|
+
print(f" Findings : {YELLOW if findings else GREEN}{len(findings)}{RESET}")
|
|
689
|
+
print(f" Severity Mix : {severity_summary}")
|
|
690
|
+
if blocking:
|
|
691
|
+
print(f" Verdict : {RED}[FAIL] {blocking} HIGH/CRITICAL pre-flight finding(s).{RESET}")
|
|
692
|
+
else:
|
|
693
|
+
print(f" Verdict : {GREEN}[PASS] No HIGH/CRITICAL spec-level finding.{RESET}")
|
|
694
|
+
print("======================================================================\n")
|
|
695
|
+
for f in findings:
|
|
696
|
+
print(f" - [{f['severity']}] {f['target']} - {f['finding']}")
|
|
697
|
+
print(f" 👉 {f['recommendation']}")
|
|
698
|
+
|
|
699
|
+
os.makedirs(REPORTS_DIR, exist_ok=True)
|
|
700
|
+
report_path = os.path.join(REPORTS_DIR, "api_fuzz_report.json")
|
|
701
|
+
scorecard = {
|
|
702
|
+
"base_url": self.base_url,
|
|
703
|
+
"timestamp": time.strftime("%Y-%m-%d %H:%M:%S"),
|
|
704
|
+
"mode": "PASSIVE",
|
|
705
|
+
"spec_source": self.spec_path or "Default Archetype",
|
|
706
|
+
"total_findings": len(findings),
|
|
707
|
+
"severity_summary": severity_summary,
|
|
708
|
+
"findings": findings,
|
|
709
|
+
}
|
|
710
|
+
with open(report_path, "w", encoding="utf-8") as out_file:
|
|
711
|
+
json.dump(scorecard, out_file, indent=2)
|
|
712
|
+
print(f"\nFull telemetry report saved to: {report_path}")
|
|
713
|
+
|
|
714
|
+
return scorecard
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
def main():
|
|
718
|
+
parser = argparse.ArgumentParser(description="Enterprise Autonomous API Fuzzer & Chaos Breaker")
|
|
719
|
+
parser.add_argument("--base-url", default="http://localhost:8080", help="Base URL of target API server")
|
|
720
|
+
parser.add_argument("--spec", default=None, help="Path or URL to OpenAPI/Swagger JSON specification")
|
|
721
|
+
parser.add_argument("--token", default=None, help="Bearer token for authenticated endpoints")
|
|
722
|
+
parser.add_argument("--sla-ms", type=float, default=3000.0, help="SLA latency ceiling in ms (default: 3000ms)")
|
|
723
|
+
parser.add_argument("--mode", choices=["active", "passive"], default="active",
|
|
724
|
+
help="active = live fuzzing (default); passive = offline spec audit, zero traffic")
|
|
725
|
+
parser.add_argument("--insecure", action="store_true", help="Explicitly bypass TLS certificate verification (for staging/self-signed certs)")
|
|
726
|
+
parser.add_argument("--dry-run", action="store_true", help="Simulate mutation generation without live requests")
|
|
727
|
+
parser.add_argument("--json", action="store_true", help="Output summary in JSON format")
|
|
728
|
+
|
|
729
|
+
args = parser.parse_args()
|
|
730
|
+
|
|
731
|
+
headers = {"Content-Type": "application/json", "User-Agent": "AgentQA-Fuzzer/2.0"}
|
|
732
|
+
if args.token:
|
|
733
|
+
headers["Authorization"] = f"Bearer {args.token}"
|
|
734
|
+
|
|
735
|
+
fuzzer = ApiFuzzer(
|
|
736
|
+
base_url=args.base_url,
|
|
737
|
+
spec_path_or_url=args.spec,
|
|
738
|
+
headers=headers,
|
|
739
|
+
sla_ms=args.sla_ms,
|
|
740
|
+
insecure=args.insecure
|
|
741
|
+
)
|
|
742
|
+
|
|
743
|
+
if args.mode == "passive":
|
|
744
|
+
scorecard = fuzzer.run_passive_scan()
|
|
745
|
+
if args.json:
|
|
746
|
+
print(json.dumps(scorecard, indent=2))
|
|
747
|
+
severity_dict = scorecard.get("severity_summary", {})
|
|
748
|
+
blocking = int(severity_dict.get("HIGH", 0)) + int(severity_dict.get("CRITICAL", 0))
|
|
749
|
+
return 1 if blocking > 0 else 0
|
|
750
|
+
|
|
751
|
+
scorecard = fuzzer.run_fuzz_suite(dry_run=args.dry_run)
|
|
752
|
+
if args.json:
|
|
753
|
+
print(json.dumps(scorecard, indent=2))
|
|
754
|
+
|
|
755
|
+
critical = scorecard["severity_summary"].get("CRITICAL", 0)
|
|
756
|
+
if critical > 0:
|
|
757
|
+
return 1
|
|
758
|
+
return 1 if scorecard["failed"] > 0 else 0
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
if __name__ == "__main__":
|
|
762
|
+
sys.exit(main())
|