pwn 0.5.795 → 0.5.796
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/bin/pwn_autoinc_version +4 -5
- data/bin/pwn_web_cache_deception +40 -29
- data/documentation/AWS.md +15 -5
- data/documentation/Diagrams.md +1 -1
- data/documentation/Home.md +2 -2
- data/documentation/How-PWN-Works.md +1 -1
- data/documentation/What-is-PWN.md +1 -1
- data/documentation/diagrams/aws-cloud-security.svg +1 -1
- data/documentation/diagrams/dot/aws-cloud-security.dot +1 -1
- data/documentation/diagrams/dot/network-infra-testing.dot +1 -1
- data/documentation/diagrams/network-infra-testing.svg +1 -1
- data/etc/default_cron/session_cleanup.rb +84 -51
- data/lib/pwn/ai/agent/assembly.rb +0 -2
- data/lib/pwn/ai/agent/btc.rb +0 -2
- data/lib/pwn/ai/agent/burp_suite.rb +0 -2
- data/lib/pwn/ai/agent/curriculum.rb +2 -2
- data/lib/pwn/ai/agent/dispatch.rb +3 -0
- data/lib/pwn/ai/agent/engagement.rb +96 -41
- data/lib/pwn/ai/agent/extrospection/osint/bridges.rb +2 -0
- data/lib/pwn/ai/agent/extrospection.rb +50 -13
- data/lib/pwn/ai/agent/gqrx.rb +0 -2
- data/lib/pwn/ai/agent/hacker_one.rb +0 -2
- data/lib/pwn/ai/agent/learning.rb +45 -13
- data/lib/pwn/ai/agent/loop.rb +12 -11
- data/lib/pwn/ai/agent/metrics.rb +1 -1
- data/lib/pwn/ai/agent/mission.rb +6 -3
- data/lib/pwn/ai/agent/policy.rb +1 -1
- data/lib/pwn/ai/agent/policy_evaluation.rb +2 -2
- data/lib/pwn/ai/agent/reflect.rb +1 -0
- data/lib/pwn/ai/agent/request_runtime.rb +1 -1
- data/lib/pwn/ai/agent/reward.rb +155 -53
- data/lib/pwn/ai/agent/sast.rb +0 -2
- data/lib/pwn/ai/agent/task_dag.rb +5 -3
- data/lib/pwn/ai/agent/task_summarizer.rb +21 -11
- data/lib/pwn/ai/agent/tool_guard.rb +19 -0
- data/lib/pwn/ai/agent/tools/ruby_eval.rb +1 -1
- data/lib/pwn/ai/agent/tools/verify.rb +7 -3
- data/lib/pwn/ai/agent/transparent_browser.rb +0 -2
- data/lib/pwn/ai/agent/turn_finalizer.rb +3 -0
- data/lib/pwn/ai/anthropic.rb +3 -3
- data/lib/pwn/ai/context.rb +2 -1
- data/lib/pwn/ai/gemini.rb +7 -5
- data/lib/pwn/ai/grok.rb +37 -18
- data/lib/pwn/ai/mcp.rb +17 -5
- data/lib/pwn/ai/ollama.rb +76 -35
- data/lib/pwn/ai/open_ai.rb +7 -19
- data/lib/pwn/ai/open_web_ui.rb +76 -40
- data/lib/pwn/aws/cloud_search_domain.rb +6 -0
- data/lib/pwn/aws/iam.rb +2 -2
- data/lib/pwn/aws/workspaces.rb +2 -2
- data/lib/pwn/aws.rb +0 -5
- data/lib/pwn/bounty/lifecycle_authz_replay.rb +1 -1
- data/lib/pwn/config.rb +17 -10
- data/lib/pwn/corpus.rb +33 -5
- data/lib/pwn/cron.rb +60 -17
- data/lib/pwn/driver.rb +2 -3
- data/lib/pwn/engagement.rb +28 -10
- data/lib/pwn/ffi/capstone.rb +3 -2
- data/lib/pwn/ffi/fftw.rb +8 -6
- data/lib/pwn/ffi/keystone.rb +3 -2
- data/lib/pwn/ffi/soapy_sdr.rb +10 -6
- data/lib/pwn/json_text.rb +25 -13
- data/lib/pwn/memory_index.rb +6 -4
- data/lib/pwn/module_skills.rb +3 -1
- data/lib/pwn/plugins/aflplusplus.rb +1 -0
- data/lib/pwn/plugins/ai_sandbox.rb +42 -10
- data/lib/pwn/plugins/android.rb +429 -466
- data/lib/pwn/plugins/artifact_registry.rb +12 -2
- data/lib/pwn/plugins/assembly.rb +9 -42
- data/lib/pwn/plugins/authentication_helper.rb +4 -3
- data/lib/pwn/plugins/baresip.rb +70 -28
- data/lib/pwn/plugins/binary_analysis.rb +14 -5
- data/lib/pwn/plugins/binary_parser.rb +42 -7
- data/lib/pwn/plugins/black_duck_binary_analysis.rb +3 -3
- data/lib/pwn/plugins/burp_suite.rb +15 -12
- data/lib/pwn/plugins/bus_pirate.rb +3 -7
- data/lib/pwn/plugins/char.rb +9 -3
- data/lib/pwn/plugins/credit_card.rb +7 -0
- data/lib/pwn/plugins/dao_ldap.rb +2 -2
- data/lib/pwn/plugins/dao_mongo.rb +1 -1
- data/lib/pwn/plugins/debugger.rb +1 -1
- data/lib/pwn/plugins/defect_dojo.rb +7 -3
- data/lib/pwn/plugins/detect_os.rb +1 -1
- data/lib/pwn/plugins/detonate.rb +9 -19
- data/lib/pwn/plugins/exploit_db.rb +1 -1
- data/lib/pwn/plugins/file_fu.rb +4 -1
- data/lib/pwn/plugins/findings.rb +76 -2
- data/lib/pwn/plugins/fuzz.rb +12 -3
- data/lib/pwn/plugins/gdb.rb +7 -2
- data/lib/pwn/plugins/gdbmi.rb +10 -6
- data/lib/pwn/plugins/git.rb +18 -13
- data/lib/pwn/plugins/github.rb +11 -6
- data/lib/pwn/plugins/google_workspace.rb +11 -3
- data/lib/pwn/plugins/hacker_one.rb +5 -1
- data/lib/pwn/plugins/httpx.rb +24 -8
- data/lib/pwn/plugins/ip_info.rb +11 -8
- data/lib/pwn/plugins/irc.rb +73 -45
- data/lib/pwn/plugins/jenkins.rb +2 -2
- data/lib/pwn/plugins/jira_data_center.rb +13 -6
- data/lib/pwn/plugins/jobs.rb +62 -4
- data/lib/pwn/plugins/log.rb +1 -1
- data/lib/pwn/plugins/monkey_patch.rb +1 -1
- data/lib/pwn/plugins/msr206.rb +157 -182
- data/lib/pwn/plugins/nessus_cloud.rb +2 -2
- data/lib/pwn/plugins/nexpose_vuln_scan.rb +44 -33
- data/lib/pwn/plugins/nuclei.rb +24 -8
- data/lib/pwn/plugins/ocr.rb +3 -1
- data/lib/pwn/plugins/open_api.rb +0 -4
- data/lib/pwn/plugins/openvas.rb +31 -43
- data/lib/pwn/plugins/packet.rb +40 -25
- data/lib/pwn/plugins/pony.rb +2 -2
- data/lib/pwn/plugins/preflight_checker.rb +1 -1
- data/lib/pwn/plugins/process_tube.rb +17 -2
- data/lib/pwn/plugins/ps.rb +6 -1
- data/lib/pwn/plugins/repl/ai.rb +1 -0
- data/lib/pwn/plugins/repl/ai_console.rb +12 -5
- data/lib/pwn/plugins/repl/mesh.rb +10 -2
- data/lib/pwn/plugins/sbom.rb +59 -27
- data/lib/pwn/plugins/scannable_codes.rb +3 -1
- data/lib/pwn/plugins/serial.rb +102 -44
- data/lib/pwn/plugins/shodan.rb +4 -10
- data/lib/pwn/plugins/sock.rb +16 -11
- data/lib/pwn/plugins/ssn.rb +3 -1
- data/lib/pwn/plugins/transparent_browser.rb +43 -3
- data/lib/pwn/plugins/vault.rb +92 -30
- data/lib/pwn/plugins/vin.rb +2 -1
- data/lib/pwn/plugins/vsphere.rb +2 -1
- data/lib/pwn/plugins/xxd.rb +3 -5
- data/lib/pwn/plugins/yubikey/security_domain/scp.rb +4 -0
- data/lib/pwn/plugins/yubikey/transport.rb +42 -11
- data/lib/pwn/plugins/yubikey.rb +21 -6
- data/lib/pwn/plugins/zaproxy.rb +3 -4
- data/lib/pwn/reports/ai_red_team.rb +4 -4
- data/lib/pwn/reports/pdf.rb +9 -5
- data/lib/pwn/reports/sast.rb +4 -4
- data/lib/pwn/sast/keystore.rb +2 -2
- data/lib/pwn/sast/logger.rb +1 -1
- data/lib/pwn/sast/php_type_juggling.rb +3 -6
- data/lib/pwn/sast/pom_version.rb +12 -6
- data/lib/pwn/sast/port.rb +1 -1
- data/lib/pwn/sast/sql.rb +3 -7
- data/lib/pwn/sast/test_case_engine.rb +62 -16
- data/lib/pwn/sast/type_script_type_juggling.rb +3 -6
- data/lib/pwn/sdr/decoder/base.rb +8 -0
- data/lib/pwn/sdr/decoder/lora.rb +1 -1
- data/lib/pwn/sdr/flipper_zero.rb +4 -7
- data/lib/pwn/sdr/gqrx.rb +35 -16
- data/lib/pwn/sdr/son_micro_rfid.rb +44 -26
- data/lib/pwn/sdr.rb +1 -1
- data/lib/pwn/session_trace.rb +7 -2
- data/lib/pwn/sessions.rb +307 -39
- data/lib/pwn/setup.rb +4 -3
- data/lib/pwn/version.rb +1 -1
- data/lib/pwn/www/app_cobalt_io.rb +14 -2
- data/lib/pwn/www/bing.rb +13 -1
- data/lib/pwn/www/bug_crowd.rb +14 -2
- data/lib/pwn/www/checkip.rb +13 -1
- data/lib/pwn/www/coinbase_pro.rb +14 -2
- data/lib/pwn/www/duckduckgo.rb +13 -1
- data/lib/pwn/www/facebook.rb +14 -2
- data/lib/pwn/www/github.rb +14 -2
- data/lib/pwn/www/google.rb +13 -1
- data/lib/pwn/www/hacker_one.rb +117 -33
- data/lib/pwn/www/linkedin.rb +14 -2
- data/lib/pwn/www/pandora.rb +14 -2
- data/lib/pwn/www/pastebin.rb +13 -1
- data/lib/pwn/www/paypal.rb +16 -4
- data/lib/pwn/www/synack.rb +14 -2
- data/lib/pwn/www/torch.rb +17 -3
- data/lib/pwn/www/trading_view.rb +14 -2
- data/lib/pwn/www/twitter.rb +14 -2
- data/lib/pwn/www/uber.rb +14 -2
- data/lib/pwn/www/upwork.rb +14 -2
- data/lib/pwn/www/wayback_machine.rb +16 -2
- data/lib/pwn/www/youtube.rb +13 -1
- data/pwn.gemspec +4 -0
- data/spec/integration/authentication_helper_oath_spec.rb +1 -1
- data/spec/integration/autoinc_lifecycle_supplement_spec.rb +47 -0
- data/spec/integration/gemspec_deleted_files_spec.rb +43 -0
- data/spec/integration/spec_curriculum_isolation_spec.rb +41 -0
- data/spec/integration/verify_acceptance_eui_regression_spec.rb +162 -0
- data/spec/integration/web_cache_lifecycle_closure_spec.rb +89 -0
- data/spec/integration/web_cache_lifecycle_supplement_spec.rb +70 -0
- data/spec/lib/pwn/ai/agent/analysis_errors_regression_spec.rb +33 -0
- data/spec/lib/pwn/ai/agent/curriculum_cooldown_regression_spec.rb +19 -0
- data/spec/lib/pwn/ai/agent/curriculum_spec.rb +2 -0
- data/spec/lib/pwn/ai/agent/engagement_boundary_regression_spec.rb +42 -0
- data/spec/lib/pwn/ai/agent/engagement_dispatch_review_spec.rb +82 -0
- data/spec/lib/pwn/ai/agent/engagement_roe_regression_spec.rb +25 -0
- data/spec/lib/pwn/ai/agent/engagement_scope_regression_spec.rb +37 -0
- data/spec/lib/pwn/ai/agent/extrospection/osint/bridges_spec.rb +4 -0
- data/spec/lib/pwn/ai/agent/extrospection_input_regression_spec.rb +31 -0
- data/spec/lib/pwn/ai/agent/extrospection_review_spec.rb +61 -0
- data/spec/lib/pwn/ai/agent/extrospection_serial_review_spec.rb +42 -0
- data/spec/lib/pwn/ai/agent/extrospection_spec.rb +9 -0
- data/spec/lib/pwn/ai/agent/extrospection_verification_regression_spec.rb +39 -0
- data/spec/lib/pwn/ai/agent/learning_last_answer_regression_spec.rb +32 -0
- data/spec/lib/pwn/ai/agent/learning_lifecycle_closure_spec.rb +84 -0
- data/spec/lib/pwn/ai/agent/learning_prune_regression_spec.rb +17 -0
- data/spec/lib/pwn/ai/agent/learning_spec.rb +2 -1
- data/spec/lib/pwn/ai/agent/loop_execution_audit_spec.rb +30 -0
- data/spec/lib/pwn/ai/agent/metrics_usage_regression_spec.rb +20 -0
- data/spec/lib/pwn/ai/agent/mission_execution_audit_spec.rb +27 -0
- data/spec/lib/pwn/ai/agent/mission_namespace_spec.rb +210 -18
- data/spec/lib/pwn/ai/agent/policy_confidence_regression_spec.rb +16 -0
- data/spec/lib/pwn/ai/agent/policy_evaluation_spec.rb +1 -1
- data/spec/lib/pwn/ai/agent/policy_evaluation_tmp_regression_spec.rb +36 -0
- data/spec/lib/pwn/ai/agent/reflect_model_regression_spec.rb +15 -0
- data/spec/lib/pwn/ai/agent/request_runtime_execution_audit_spec.rb +43 -0
- data/spec/lib/pwn/ai/agent/reward_binding_review_spec.rb +129 -0
- data/spec/lib/pwn/ai/agent/reward_dispatch_review_spec.rb +154 -0
- data/spec/lib/pwn/ai/agent/reward_envelope_regression_spec.rb +45 -0
- data/spec/lib/pwn/ai/agent/reward_turn_regression_spec.rb +40 -0
- data/spec/lib/pwn/ai/agent/swarm_spec.rb +2 -2
- data/spec/lib/pwn/ai/agent/task_dag_execution_audit_spec.rb +45 -0
- data/spec/lib/pwn/ai/agent/task_summarizer_failure_regression_spec.rb +26 -0
- data/spec/lib/pwn/ai/agent/tools/verify_execution_audit_spec.rb +33 -0
- data/spec/lib/pwn/ai/context_range_audit_spec.rb +24 -0
- data/spec/lib/pwn/ai/gemini_roundtrip_audit_spec.rb +33 -0
- data/spec/lib/pwn/ai/grok_reasoning_effort_spec.rb +43 -0
- data/spec/lib/pwn/ai/mcp_session_audit_spec.rb +36 -0
- data/spec/lib/pwn/ai/ollama_spec.rb +6 -11
- data/spec/lib/pwn/ai/open_web_ui_spec.rb +6 -11
- data/spec/lib/pwn/ai/provider_history_audit_spec.rb +44 -0
- data/spec/lib/pwn/ai/provider_operations_audit_spec.rb +53 -0
- data/spec/lib/pwn/ai/provider_review_history_stream_regression_spec.rb +143 -0
- data/spec/lib/pwn/ai/provider_review_tls_regression_spec.rb +62 -0
- data/spec/lib/pwn/ai/provider_stream_audit_spec.rb +49 -0
- data/spec/lib/pwn/aws/iam_decoding_regression_spec.rb +23 -0
- data/spec/lib/pwn/aws/services_runtime_regression_spec.rb +51 -0
- data/spec/lib/pwn/aws_spec.rb +6 -0
- data/spec/lib/pwn/banner_operational_audit_spec.rb +105 -0
- data/spec/lib/pwn/bounty/lifecycle_authz_replay_spec.rb +17 -0
- data/spec/lib/pwn/config_redaction_regression_spec.rb +24 -0
- data/spec/lib/pwn/config_skills_regression_spec.rb +38 -0
- data/spec/lib/pwn/corpus_core_review_regression_spec.rb +96 -0
- data/spec/lib/pwn/corpus_spec.rb +13 -0
- data/spec/lib/pwn/cron_core_review_regression_spec.rb +95 -0
- data/spec/lib/pwn/cron_execution_spec.rb +75 -0
- data/spec/lib/pwn/driver_core_review_regression_spec.rb +38 -0
- data/spec/lib/pwn/driver_spec.rb +13 -0
- data/spec/lib/pwn/engagement_core_review_regression_spec.rb +88 -0
- data/spec/lib/pwn/engagement_storage_regression_spec.rb +44 -0
- data/spec/lib/pwn/ffi/capstone_spec.rb +19 -0
- data/spec/lib/pwn/ffi/fftw_spec.rb +19 -0
- data/spec/lib/pwn/ffi/keystone_spec.rb +13 -0
- data/spec/lib/pwn/ffi/soapy_sdr_spec.rb +13 -0
- data/spec/lib/pwn/json_text_spec.rb +25 -0
- data/spec/lib/pwn/memory_index_spec.rb +23 -0
- data/spec/lib/pwn/module_skills_parsing_regression_spec.rb +34 -0
- data/spec/lib/pwn/plugins/ai_sandbox_boundary_review_spec.rb +57 -0
- data/spec/lib/pwn/plugins/ai_sandbox_spec.rb +10 -18
- data/spec/lib/pwn/plugins/android_review_fixes_spec.rb +121 -0
- data/spec/lib/pwn/plugins/android_transport_audit_spec.rb +64 -0
- data/spec/lib/pwn/plugins/api_import_namespace_audit_spec.rb +49 -0
- data/spec/lib/pwn/plugins/artifact_registry_namespace_audit_spec.rb +20 -0
- data/spec/lib/pwn/plugins/artifact_registry_review_fixes_spec.rb +63 -0
- data/spec/lib/pwn/plugins/assembly_namespace_audit_spec.rb +16 -0
- data/spec/lib/pwn/plugins/assembly_review_fixes_spec.rb +33 -0
- data/spec/lib/pwn/plugins/authentication_helper_spec.rb +14 -0
- data/spec/lib/pwn/plugins/baresip_review_fixes_spec.rb +127 -0
- data/spec/lib/pwn/plugins/baresip_transport_audit_spec.rb +59 -0
- data/spec/lib/pwn/plugins/binary_analysis_process_review_spec.rb +57 -0
- data/spec/lib/pwn/plugins/black_duck_namespace_audit_spec.rb +25 -0
- data/spec/lib/pwn/plugins/burp_suite_har_review_fixes_spec.rb +60 -0
- data/spec/lib/pwn/plugins/burp_suite_import_review_fixes_spec.rb +62 -0
- data/spec/lib/pwn/plugins/burp_suite_namespace_audit_spec.rb +37 -0
- data/spec/lib/pwn/plugins/bus_pirate_transport_audit_spec.rb +19 -0
- data/spec/lib/pwn/plugins/file_fu_namespace_audit_spec.rb +17 -0
- data/spec/lib/pwn/plugins/findings_structured_spec.rb +1 -1
- data/spec/lib/pwn/plugins/gdbmi_namespace_audit_spec.rb +28 -0
- data/spec/lib/pwn/plugins/gdbmi_review_fixes_spec.rb +73 -0
- data/spec/lib/pwn/plugins/github_argv_review_spec.rb +49 -0
- data/spec/lib/pwn/plugins/google_workspace_provider_review_oauth_spec.rb +80 -0
- data/spec/lib/pwn/plugins/irc_review_fixes_spec.rb +92 -0
- data/spec/lib/pwn/plugins/irc_transport_audit_spec.rb +37 -0
- data/spec/lib/pwn/plugins/jenkins_namespace_audit_spec.rb +12 -0
- data/spec/lib/pwn/plugins/jira_data_center_namespace_audit_spec.rb +44 -0
- data/spec/lib/pwn/plugins/jira_data_center_review_fixes_spec.rb +81 -0
- data/spec/lib/pwn/plugins/jsonl_elf_review_fixes_spec.rb +59 -0
- data/spec/lib/pwn/plugins/log_spec.rb +36 -20
- data/spec/lib/pwn/plugins/monkey_patch_spec.rb +16 -0
- data/spec/lib/pwn/plugins/msr206_readback_review_fixes_spec.rb +119 -0
- data/spec/lib/pwn/plugins/msr206_review_fixes_spec.rb +50 -0
- data/spec/lib/pwn/plugins/msr206_transport_audit_spec.rb +64 -0
- data/spec/lib/pwn/plugins/nessus_cloud_namespace_audit_spec.rb +14 -0
- data/spec/lib/pwn/plugins/nexpose_review_fixes_spec.rb +55 -0
- data/spec/lib/pwn/plugins/open_api_namespace_audit_spec.rb +22 -0
- data/spec/lib/pwn/plugins/packet_transport_audit_spec.rb +47 -0
- data/spec/lib/pwn/plugins/plugins_b_operational_regression_spec.rb +600 -0
- data/spec/lib/pwn/plugins/pony_namespace_audit_spec.rb +17 -0
- data/spec/lib/pwn/plugins/pony_review_fixes_spec.rb +33 -0
- data/spec/lib/pwn/plugins/process_tube_namespace_audit_spec.rb +19 -0
- data/spec/lib/pwn/plugins/ps_namespace_audit_spec.rb +12 -0
- data/spec/lib/pwn/plugins/repl/ai_console_spec.rb +111 -0
- data/spec/lib/pwn/plugins/repl/ai_spec.rb +38 -0
- data/spec/lib/pwn/plugins/repl/mesh_spec.rb +52 -0
- data/spec/lib/pwn/plugins/sandbox_spec.rb +9 -7
- data/spec/lib/pwn/plugins/sbom_review_fixes_spec.rb +43 -0
- data/spec/lib/pwn/plugins/scannable_codes_namespace_audit_spec.rb +15 -0
- data/spec/lib/pwn/plugins/serial_review_fixes_spec.rb +76 -0
- data/spec/lib/pwn/plugins/serial_transport_audit_spec.rb +102 -0
- data/spec/lib/pwn/plugins/shodan_namespace_audit_spec.rb +10 -0
- data/spec/lib/pwn/plugins/sock_transport_audit_spec.rb +55 -0
- data/spec/lib/pwn/plugins/transparent_browser_navigation_review_spec.rb +21 -0
- data/spec/lib/pwn/plugins/vault_master_key_eui_regression_spec.rb +242 -0
- data/spec/lib/pwn/plugins/vault_spec.rb +58 -0
- data/spec/lib/pwn/plugins/vault_store_safety_spec.rb +1 -1
- data/spec/lib/pwn/plugins/xxd_namespace_audit_spec.rb +34 -0
- data/spec/lib/pwn/plugins/yubikey_hid_cleanup_review_fixes_spec.rb +52 -0
- data/spec/lib/pwn/plugins/yubikey_lifecycle_audit_spec.rb +65 -0
- data/spec/lib/pwn/plugins/yubikey_options_audit_spec.rb +30 -0
- data/spec/lib/pwn/plugins/yubikey_selector_audit_spec.rb +26 -0
- data/spec/lib/pwn/plugins/yubikey_spec.rb +1 -1
- data/spec/lib/pwn/plugins/zaproxy_namespace_audit_spec.rb +30 -0
- data/spec/lib/pwn/reports/empty_report_audit_spec.rb +18 -0
- data/spec/lib/pwn/reports/pdf_spec.rb +25 -0
- data/spec/lib/pwn/reports/provider_review_encoding_regression_spec.rb +45 -0
- data/spec/lib/pwn/sast/engine_runtime_regression_spec.rb +91 -0
- data/spec/lib/pwn/sast/filter_edge_regression_spec.rb +39 -0
- data/spec/lib/pwn/sast/formatter_review_fixes_spec.rb +178 -0
- data/spec/lib/pwn/sast/path_review_fixes_spec.rb +60 -0
- data/spec/lib/pwn/sast/pom_runtime_regression_spec.rb +37 -0
- data/spec/lib/pwn/sast/rules_runtime_regression_spec.rb +78 -0
- data/spec/lib/pwn/sast/sql_review_fixes_spec.rb +38 -0
- data/spec/lib/pwn/sdr/decoder/base_iq_spec.rb +21 -18
- data/spec/lib/pwn/sdr/decoder/base_review_fixes_spec.rb +49 -0
- data/spec/lib/pwn/sdr/decoder/base_validation_spec.rb +78 -0
- data/spec/lib/pwn/sdr/decoder/lora_spec.rb +9 -0
- data/spec/lib/pwn/sdr/flipper_zero_review_fixes_spec.rb +34 -0
- data/spec/lib/pwn/sdr/gqrx_operational_spec.rb +83 -0
- data/spec/lib/pwn/sdr/gqrx_review_fixes_spec.rb +22 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_review_fixes_spec.rb +113 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_serial_review_fixes_spec.rb +76 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_spec.rb +39 -0
- data/spec/lib/pwn/sdr_spec.rb +5 -0
- data/spec/lib/pwn/session_cleanup_default_spec.rb +1 -1
- data/spec/lib/pwn/session_cleanup_lifecycle_supplement_spec.rb +39 -0
- data/spec/lib/pwn/session_cleanup_payload_spec.rb +3 -2
- data/spec/lib/pwn/session_trace_lifecycle_supplement_spec.rb +39 -0
- data/spec/lib/pwn/sessions_archive_closure_spec.rb +126 -0
- data/spec/lib/pwn/sessions_lifecycle_closure_spec.rb +373 -0
- data/spec/lib/pwn/sessions_lifecycle_supplement_spec.rb +204 -0
- data/spec/lib/pwn/setup_operational_regression_spec.rb +36 -0
- data/spec/lib/pwn/www/browser_review_fixes_spec.rb +70 -0
- data/spec/lib/pwn/www/browser_runtime_regression_spec.rb +100 -0
- data/spec/lib/pwn/www/hacker_one_runtime_regression_spec.rb +146 -0
- data/spec/lib/pwn/www/pagination_review_fixes_spec.rb +84 -0
- data/spec/support/namespace_controller_observability_fixture.rb +141 -0
- data/spec/support/sandbox.rb +8 -5
- data/third_party/pwn_rdoc.jsonl +73 -31
- metadata +137 -18
- data/etc/default_skills/pwn/aws/elastic_transcoder/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/lambda_preview/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/ops_works/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/ops_works_cm/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/sms/SKILL.md +0 -48
- data/lib/pwn/aws/elastic_transcoder.rb +0 -95
- data/lib/pwn/aws/lambda_preview.rb +0 -95
- data/lib/pwn/aws/ops_works.rb +0 -95
- data/lib/pwn/aws/ops_works_cm.rb +0 -95
- data/lib/pwn/aws/sms.rb +0 -95
- data/spec/lib/pwn/aws/elastic_transcoder_spec.rb +0 -15
- data/spec/lib/pwn/aws/lambda_preview_spec.rb +0 -15
- data/spec/lib/pwn/aws/ops_works_cm_spec.rb +0 -15
- data/spec/lib/pwn/aws/ops_works_spec.rb +0 -15
- data/spec/lib/pwn/aws/sms_spec.rb +0 -15
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::Sessions, 'lifecycle audit regressions' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
allow(Dir).to receive(:home).and_return(@tmp)
|
|
10
|
+
FileUtils.mkdir_p(File.join(@tmp, '.pwn'))
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def cold_session
|
|
14
|
+
session = described_class.create
|
|
15
|
+
File.utime(Time.at(1), Time.at(1), session[:path])
|
|
16
|
+
session
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'pins a cold session with an actual activity lease' do
|
|
20
|
+
session = cold_session
|
|
21
|
+
lease = described_class.activate(session_id: session[:id])
|
|
22
|
+
expect(described_class.protected_session_ids(hot_days: 0)).to include(session[:id])
|
|
23
|
+
ensure
|
|
24
|
+
described_class.deactivate(lease: lease)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'keeps live transcripts and metadata during lean deletion' do
|
|
28
|
+
session = cold_session
|
|
29
|
+
lease = described_class.activate(session_id: session[:id])
|
|
30
|
+
result = described_class.lean!(hot_days: 0, retain_days: 1)
|
|
31
|
+
expect(result[:deleted]).to eq(0)
|
|
32
|
+
expect(File).to exist(session[:path])
|
|
33
|
+
expect(File).to exist(described_class.support_path(kind: :metadata, session_id: session[:id]))
|
|
34
|
+
ensure
|
|
35
|
+
described_class.deactivate(lease: lease)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it 'does not compact a transcript while an independent live lease is held' do
|
|
39
|
+
session = cold_session
|
|
40
|
+
File.open(session[:path], 'a') { |file| file.puts(JSON.generate(role: 'tool', content: 'fixture ' * 100)) }
|
|
41
|
+
bytes = File.binread(session[:path])
|
|
42
|
+
lease = described_class.activate(session_id: session[:id])
|
|
43
|
+
expect(described_class.send(:compact_transcript!, path: session[:path], tool_max: 10)).to be(false)
|
|
44
|
+
expect(File.binread(session[:path])).to eq(bytes)
|
|
45
|
+
described_class.deactivate(lease: lease)
|
|
46
|
+
expect(described_class.send(:compact_transcript!, path: session[:path], tool_max: 10)).to be(true)
|
|
47
|
+
ensure
|
|
48
|
+
described_class.deactivate(lease: lease)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'previews compaction without creating activity or writer files' do
|
|
52
|
+
session = cold_session
|
|
53
|
+
File.open(session[:path], 'a') { |file| file.puts(JSON.generate(role: 'tool', content: 'fixture ' * 100)) }
|
|
54
|
+
files = Dir.glob(File.join(described_class.sessions_dir, '**', '*'), File::FNM_DOTMATCH)
|
|
55
|
+
expect(described_class.send(:compact_transcript!, path: session[:path], tool_max: 10, dry_run: true)).to be(true)
|
|
56
|
+
expect(Dir.glob(File.join(described_class.sessions_dir, '**', '*'), File::FNM_DOTMATCH)).to eq(files)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
[1, 20, 21, 39, 40, 41].each do |count|
|
|
60
|
+
it "retains disjoint head and tail windows for a #{count}-line transcript" do
|
|
61
|
+
session = cold_session
|
|
62
|
+
rows = Array.new(count) { |index| { 'role' => 'user', 'content' => "fixture #{index}" } }
|
|
63
|
+
File.write(session[:path], rows.map { |row| "#{JSON.generate(row)}\n" }.join)
|
|
64
|
+
File.utime(Time.at(1), Time.at(1), session[:path])
|
|
65
|
+
expect(described_class.retain(days: 1)[:gzipped]).to eq(1)
|
|
66
|
+
actual = Zlib::GzipReader.open("#{session[:path]}.gz") { |gzip| gzip.each_line.map { |line| JSON.parse(line) } }
|
|
67
|
+
expected = count <= 40 ? rows : rows.first(20) + rows.last(20)
|
|
68
|
+
expect(actual).to eq(expected)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it 'rejects export failure without publishing a success or replacing the previous archive' do
|
|
73
|
+
session = cold_session
|
|
74
|
+
directory = File.join(@tmp, '.pwn', 'exports')
|
|
75
|
+
FileUtils.mkdir_p(directory)
|
|
76
|
+
destination = File.join(directory, "#{session[:id]}.tar.gz")
|
|
77
|
+
File.write(destination, 'previous archive fixture')
|
|
78
|
+
allow(described_class).to receive(:system) do |*_arguments, **options|
|
|
79
|
+
options.fetch(:out).write('incomplete archive')
|
|
80
|
+
false
|
|
81
|
+
end
|
|
82
|
+
expect { described_class.export(session_id: session[:id]) }.to raise_error(IOError, /export|archive|tar/i)
|
|
83
|
+
expect(File.binread(destination)).to eq('previous archive fixture')
|
|
84
|
+
expect(Dir.children(directory)).to eq([File.basename(destination)])
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
%i[load export].each do |operation|
|
|
88
|
+
it "rejects traversal before #{operation} can access another store" do
|
|
89
|
+
described_class.sessions_dir
|
|
90
|
+
File.write(File.join(@tmp, 'outside.jsonl'), "#{JSON.generate(role: 'user', content: 'outside fixture')}\n")
|
|
91
|
+
expect { described_class.public_send(operation, session_id: '../outside') }.to raise_error(ArgumentError, /session/i)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
it 'refuses to load a symlinked transcript outside the session store' do
|
|
96
|
+
directory = described_class.sessions_dir
|
|
97
|
+
outside = File.join(@tmp, 'outside.jsonl')
|
|
98
|
+
File.write(outside, "#{JSON.generate(role: 'user', content: 'outside fixture')}\n")
|
|
99
|
+
File.symlink(outside, File.join(directory, 'linked.jsonl'))
|
|
100
|
+
expect { described_class.load(session_id: 'linked') }.to raise_error(IOError, /Unsafe/)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it 'refuses to export through a symlinked destination directory' do
|
|
104
|
+
session = cold_session
|
|
105
|
+
outside = File.join(@tmp, 'outside-exports')
|
|
106
|
+
Dir.mkdir(outside)
|
|
107
|
+
File.symlink(outside, File.join(@tmp, '.pwn', 'exports'))
|
|
108
|
+
expect { described_class.export(session_id: session[:id]) }.to raise_error(IOError, /Unsafe/)
|
|
109
|
+
expect(Dir.children(outside)).to eq([])
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
%i[lean! retain].each do |operation|
|
|
113
|
+
it "rechecks newly published dependencies before #{operation} changes a transcript" do
|
|
114
|
+
session = cold_session
|
|
115
|
+
File.open(session[:path], 'a') { |file| file.puts(JSON.generate(role: 'tool', content: 'fixture ' * 15_000)) }
|
|
116
|
+
cold = Time.now - (20 * 86_400)
|
|
117
|
+
File.utime(cold, cold, session[:path])
|
|
118
|
+
original = File.binread(session[:path])
|
|
119
|
+
published = false
|
|
120
|
+
allow(described_class).to receive(:protected_session_ids).and_wrap_original do |method, opts|
|
|
121
|
+
pins = method.call(opts)
|
|
122
|
+
unless published
|
|
123
|
+
File.write(File.join(@tmp, '.pwn', 'learning.jsonl'), "#{JSON.generate(session_id: session[:id], lesson: 'preserved fixture evidence')}\n")
|
|
124
|
+
published = true
|
|
125
|
+
end
|
|
126
|
+
pins
|
|
127
|
+
end
|
|
128
|
+
result = operation == :lean! ? described_class.lean!(hot_days: 0, retain_days: 30) : described_class.retain(days: 1)
|
|
129
|
+
expect(result[:compacted] || result[:gzipped]).to eq(0)
|
|
130
|
+
expect(File.binread(session[:path])).to eq(original)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
it 'reports unlink failures instead of falsely reporting a deleted session' do
|
|
135
|
+
session = cold_session
|
|
136
|
+
allow(File).to receive(:unlink).and_call_original
|
|
137
|
+
allow(File).to receive(:unlink).with(session[:path]).and_raise(Errno::EACCES)
|
|
138
|
+
expect { described_class.delete(session_id: session[:id], force: true) }.to raise_error(Errno::EACCES)
|
|
139
|
+
expect(File).to exist(session[:path])
|
|
140
|
+
ensure
|
|
141
|
+
allow(File).to receive(:unlink).with(session[:path]).and_call_original if session
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
it 'does not overwrite an existing retention archive' do
|
|
145
|
+
session = cold_session
|
|
146
|
+
archive = "#{session[:path]}.gz"
|
|
147
|
+
File.write(archive, 'previous evidence fixture')
|
|
148
|
+
expect(described_class.retain(days: 1)[:records]).to include(hash_including(id: session[:id], state: 'conflict'))
|
|
149
|
+
expect(File.binread(archive)).to eq('previous evidence fixture')
|
|
150
|
+
expect(File).to exist(session[:path])
|
|
151
|
+
expect(Dir.glob("#{session[:path]}.*.tmp")).to eq([])
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
it 'retains a session when dependency discovery encounters a symlink archive' do
|
|
155
|
+
session = cold_session
|
|
156
|
+
outside = File.join(@tmp, 'outside-archive')
|
|
157
|
+
File.write(outside, 'previous evidence fixture')
|
|
158
|
+
File.symlink(outside, "#{session[:path]}.gz")
|
|
159
|
+
expect(described_class.retain(days: 1)[:gzipped]).to eq(0)
|
|
160
|
+
expect(File.binread(outside)).to eq('previous evidence fixture')
|
|
161
|
+
expect(File).to exist(session[:path])
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
it 'protects a lease acquired after preflight during max-files enforcement' do
|
|
165
|
+
session = cold_session
|
|
166
|
+
File.open(session[:path], 'a') { |file| file.puts(JSON.generate(role: 'user', content: 'substantive fixture conversation ' * 12)) }
|
|
167
|
+
File.utime(Time.at(1), Time.at(1), session[:path])
|
|
168
|
+
lease = nil
|
|
169
|
+
allow(described_class).to receive(:protected_session_ids).and_wrap_original do |original, opts|
|
|
170
|
+
pins = original.call(opts)
|
|
171
|
+
lease ||= described_class.activate(session_id: session[:id])
|
|
172
|
+
pins
|
|
173
|
+
end
|
|
174
|
+
result = described_class.lean!(hot_days: 0, retain_days: 100_000, max_files: 0)
|
|
175
|
+
expect(result[:deleted]).to eq(0)
|
|
176
|
+
expect(File).to exist(session[:path])
|
|
177
|
+
ensure
|
|
178
|
+
described_class.deactivate(lease: lease)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
it 'keeps malformed retention input without publishing a partial archive' do
|
|
182
|
+
session = cold_session
|
|
183
|
+
File.write(session[:path], "not json\n")
|
|
184
|
+
File.utime(Time.at(1), Time.at(1), session[:path])
|
|
185
|
+
# The dependency index already protects malformed evidence, before gzip.
|
|
186
|
+
expect(described_class.retain(days: 1)[:gzipped]).to eq(0)
|
|
187
|
+
expect(File.binread(session[:path])).to eq("not json\n")
|
|
188
|
+
expect(File).not_to exist("#{session[:path]}.gz")
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
it 'rechecks a lease acquired after lean preflight before deleting' do
|
|
192
|
+
session = cold_session
|
|
193
|
+
lease = nil
|
|
194
|
+
allow(described_class).to receive(:protected_session_ids).and_wrap_original do |original, opts|
|
|
195
|
+
pins = original.call(opts)
|
|
196
|
+
lease ||= described_class.activate(session_id: session[:id])
|
|
197
|
+
pins
|
|
198
|
+
end
|
|
199
|
+
expect(described_class.lean!(hot_days: 0, retain_days: 1)[:deleted]).to eq(0)
|
|
200
|
+
expect(File).to exist(session[:path])
|
|
201
|
+
ensure
|
|
202
|
+
described_class.deactivate(lease: lease)
|
|
203
|
+
end
|
|
204
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe 'PWN::Setup operational checks' do
|
|
6
|
+
include_context 'pwn tmp sandbox'
|
|
7
|
+
|
|
8
|
+
before { allow(Dir).to receive(:home).and_return(@tmp) }
|
|
9
|
+
|
|
10
|
+
it 'does not request interactive confirmation for a terminal dry run' do
|
|
11
|
+
allow(ENV).to receive(:[]).and_call_original
|
|
12
|
+
allow(ENV).to receive(:[]).with('TERMINATOR_UUID').and_return('fixture-terminal')
|
|
13
|
+
expect($stdin).not_to receive(:gets)
|
|
14
|
+
result = PWN::Setup.terminal(dry_run: true, io: StringIO.new)
|
|
15
|
+
expect(result).to include(installed: false, reason: :dry_run)
|
|
16
|
+
expect(File).not_to exist(File.join(@tmp, '.config', 'terminator'))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'checks only the selected profile after planning its dependencies' do
|
|
20
|
+
allow(PWN::Setup).to receive(:pkg_manager).and_return(key: :apt, install: 'fixture-install', sudo: false)
|
|
21
|
+
allow(PWN::Setup).to receive(:gem_loadable?).and_return(true)
|
|
22
|
+
allow(PWN::Setup).to receive(:native_library_available?).and_return(false)
|
|
23
|
+
allow(PWN::Setup).to receive(:which).and_return('')
|
|
24
|
+
allow(PWN::Migrate).to receive(:check).and_return(incompatible: [])
|
|
25
|
+
expect(PWN::Setup).not_to receive(:system)
|
|
26
|
+
result = PWN::Setup.deps(profile: :core, distro: :debian, version: 'fixture', dry_run: true, io: StringIO.new)
|
|
27
|
+
expect(result.dig(:check, :ok)).to be(true)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'does not mistake template key descriptions for configured authentication' do
|
|
31
|
+
PWN::Env[:ai][:grok] = { key: 'required - xAI Grok API Key' }
|
|
32
|
+
expect(PWN::Setup.send(:ai_key_configured?, engine: :grok)).to be(false)
|
|
33
|
+
PWN::Env[:ai][:grok][:key] = 'synthetic-fixture-key'
|
|
34
|
+
expect(PWN::Setup.send(:ai_key_configured?, engine: :grok)).to be(true)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'watir'
|
|
5
|
+
|
|
6
|
+
RSpec.describe 'WWW real browser-helper review contracts' do
|
|
7
|
+
before do
|
|
8
|
+
@driver = Selenium::WebDriver::Driver.allocate
|
|
9
|
+
@navigation = instance_double(Selenium::WebDriver::Navigation, to: nil)
|
|
10
|
+
timeouts = instance_double(Selenium::WebDriver::Timeouts, 'page_load=': nil, 'script=': nil)
|
|
11
|
+
management = instance_double(Selenium::WebDriver::Manager, timeouts: timeouts)
|
|
12
|
+
allow(@driver).to receive_messages(navigate: @navigation, quit: nil, manage: management, page_source: '<pre>192.0.2.1</pre>')
|
|
13
|
+
allow(Selenium::WebDriver).to receive(:for).and_return(@driver)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
names = %i[AppCobaltIO Bing BugCrowd Checkip CoinbasePro Duckduckgo Facebook GitHub Google HackerOne
|
|
17
|
+
Linkedin Pandora Pastebin Paypal Synack Torch TradingView Twitter Uber Upwork WaybackMachine Youtube].freeze
|
|
18
|
+
|
|
19
|
+
it 'covers every WWW wrapper rather than an incidental subset' do
|
|
20
|
+
expect(PWN::WWW.constants(false).sort).to eq(names.sort)
|
|
21
|
+
expect(Dir[File.expand_path('../../../../lib/pwn/www/*.rb', __dir__)].length).to eq(names.length)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
names.each do |name|
|
|
25
|
+
it "SERVICES-REVIEW-006 preserves #{name} navigation error when driver quit fails" do
|
|
26
|
+
original = IOError.new('fixture navigation failure')
|
|
27
|
+
allow(@navigation).to receive(:to).and_raise(original)
|
|
28
|
+
expect(@driver).to receive(:quit).once.and_raise(RuntimeError, 'fixture driver cleanup failure')
|
|
29
|
+
|
|
30
|
+
expect { PWN::WWW.const_get(name).open({}.freeze) }.to(raise_error { |error| expect(error).to equal(original) })
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "SERVICES-REVIEW-006 still closes #{name} browser if its owned Tor cleanup fails" do
|
|
34
|
+
original = IOError.new('fixture navigation failure')
|
|
35
|
+
allow(@navigation).to receive(:to).and_raise(original)
|
|
36
|
+
tor = { ip: '127.0.0.1', port: 1 }
|
|
37
|
+
allow(PWN::Plugins::Tor).to receive(:start).and_return(tor)
|
|
38
|
+
expect(PWN::Plugins::Tor).to receive(:stop).with(tor_obj: tor).once.and_raise(RuntimeError, 'fixture Tor cleanup failure')
|
|
39
|
+
expect(@driver).to receive(:quit).once
|
|
40
|
+
|
|
41
|
+
expect { PWN::WWW.const_get(name).open(proxy: 'tor') }.to(raise_error { |error| expect(error).to equal(original) })
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
[false, true].each do |frozen|
|
|
45
|
+
it "SERVICES-REVIEW-004 preserves #{frozen ? 'frozen' : 'mutable'} caller options through real #{name} and Watir" do
|
|
46
|
+
options = {}
|
|
47
|
+
options.freeze if frozen
|
|
48
|
+
handle = PWN::WWW.const_get(name).open(options)
|
|
49
|
+
|
|
50
|
+
expect(handle[:browser]).to be_a(Watir::Browser)
|
|
51
|
+
expect(handle[:browser].driver).to equal(@driver)
|
|
52
|
+
expect(options).to eq({})
|
|
53
|
+
ensure
|
|
54
|
+
PWN::WWW.const_get(name).close(browser_obj: handle) if handle
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it "SERVICES-REVIEW-004 preserves explicit false and nested options through real #{name}" do
|
|
59
|
+
capture_proxy = { url: 'http://fixture.invalid:8080', metadata: ['synthetic'].freeze }.freeze
|
|
60
|
+
options = { browser_type: :chrome, devtools: false, capture_proxy: capture_proxy }.freeze
|
|
61
|
+
original = Marshal.dump(options)
|
|
62
|
+
handle = PWN::WWW.const_get(name).open(options)
|
|
63
|
+
|
|
64
|
+
expect(Marshal.dump(options)).to eq(original)
|
|
65
|
+
expect(handle[:capture_proxy]).to equal(capture_proxy)
|
|
66
|
+
ensure
|
|
67
|
+
PWN::WWW.const_get(name).close(browser_obj: handle) if handle
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'watir'
|
|
5
|
+
|
|
6
|
+
RSpec.describe 'WWW browser runtime regressions' do
|
|
7
|
+
let(:browser) { instance_double(Watir::Browser) }
|
|
8
|
+
let(:handle) { { browser: browser, type: :firefox } }
|
|
9
|
+
let(:field) { instance_double(Watir::TextField, set: nil, send_keys: nil) }
|
|
10
|
+
let(:button) { instance_double(Watir::Button, click!: nil, click: nil) }
|
|
11
|
+
let(:element) { instance_double(Watir::HTMLElement, click!: nil, click: nil, hover: nil) }
|
|
12
|
+
|
|
13
|
+
before do
|
|
14
|
+
allow(field).to receive(:wait_until).and_return(field)
|
|
15
|
+
allow(button).to receive(:wait_until).and_return(button)
|
|
16
|
+
allow(element).to receive(:wait_until).and_return(element)
|
|
17
|
+
allow(browser).to receive_messages(goto: nil, text_field: field, button: button, input: button, span: element, div: element, li: element, link: element, img: element, i: element)
|
|
18
|
+
allow(PWN::Plugins::TransparentBrowser).to receive(:open).and_return(handle)
|
|
19
|
+
allow(PWN::Plugins::TransparentBrowser).to receive(:close).and_return(nil)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
destinations = {
|
|
23
|
+
AppCobaltIO: 'https://app.cobalt.io', Bing: 'https://www.bing.com', BugCrowd: 'https://bugcrowd.com',
|
|
24
|
+
Checkip: 'http://checkip.amazonaws.com', CoinbasePro: 'https://pro.coinbase.com', Duckduckgo: 'https://duckduckgo.com',
|
|
25
|
+
Facebook: 'https://www.facebook.com', GitHub: 'https://github.com', Google: 'https://www.google.com',
|
|
26
|
+
HackerOne: 'https://www.hackerone.com', Linkedin: 'https://www.linkedin.com', Pandora: 'https://www.pandora.com',
|
|
27
|
+
Pastebin: 'https://pastebin.com', Paypal: 'https://www.paypal.com', Synack: 'https://www.synack.com',
|
|
28
|
+
Torch: 'http://www.torchtorsearch.com', TradingView: 'https://tradingview.com', Twitter: 'https://twitter.com',
|
|
29
|
+
Uber: 'https://www.uber.com', Upwork: 'https://www.upwork.com', WaybackMachine: 'https://web.archive.org', Youtube: 'https://www.youtube.com'
|
|
30
|
+
}
|
|
31
|
+
destinations.each do |name, destination|
|
|
32
|
+
it "opens #{name} through the browser transport and returns its handle" do
|
|
33
|
+
allow(browser).to receive(:html).and_return('<pre>192.0.2.1</pre>')
|
|
34
|
+
options = { browser_type: :firefox, proxy: 'http://fixture.invalid:8080' }
|
|
35
|
+
expect(PWN::Plugins::TransparentBrowser).to receive(:open).with(options).and_return(handle)
|
|
36
|
+
expect(browser).to receive(:goto).with(destination)
|
|
37
|
+
expect(PWN::WWW.const_get(name).open(options)).to equal(handle)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "closes the newly opened #{name} transport when initial navigation fails" do
|
|
41
|
+
error = IOError.new('fixture navigation failure')
|
|
42
|
+
allow(browser).to receive(:goto).and_raise(error)
|
|
43
|
+
expect(PWN::Plugins::TransparentBrowser).to receive(:close).with(browser_obj: handle)
|
|
44
|
+
expect { PWN::WWW.const_get(name).open(browser_type: :firefox) }.to(raise_error { |actual| expect(actual).to equal(error) })
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
it "closes #{name} through the browser transport" do
|
|
48
|
+
expect(PWN::Plugins::TransparentBrowser).to receive(:close).with(browser_obj: handle).and_return(nil)
|
|
49
|
+
expect(PWN::WWW.const_get(name).close(browser_obj: handle)).to be_nil
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
passwords = {
|
|
54
|
+
AppCobaltIO: { index: 10 }, BugCrowd: { id: 'user_password' }, CoinbasePro: { name: 'password' },
|
|
55
|
+
Facebook: { id: 'pass' }, GitHub: { name: 'password' }, HackerOne: { name: 'user[password]' },
|
|
56
|
+
Linkedin: { name: 'session_password' }, Pandora: { id: 'login_password' }, Paypal: { id: 'password' },
|
|
57
|
+
Synack: { name: 'password' }, TradingView: { name: 'password' }, Twitter: { index: 3 },
|
|
58
|
+
Uber: { id: 'password' }, Upwork: { id: 'login_password' }
|
|
59
|
+
}
|
|
60
|
+
passwords.each do |name, selector|
|
|
61
|
+
it "preserves the exact supplied password in #{name} login" do
|
|
62
|
+
password = " \tfixture-only password \n"
|
|
63
|
+
password_field = instance_double(Watir::TextField)
|
|
64
|
+
allow(password_field).to receive(:wait_until).and_return(password_field)
|
|
65
|
+
expect(browser).to receive(:text_field).with(selector).and_return(password_field)
|
|
66
|
+
expect(password_field).to receive(:set).with(password)
|
|
67
|
+
expect(PWN::WWW.const_get(name).login(browser_obj: handle, username: 'fixture@example.invalid', password: password)).to equal(handle)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
%i[Bing Duckduckgo Google Torch Youtube].each do |name|
|
|
72
|
+
it "submits #{name} search using the open browser" do
|
|
73
|
+
allow(browser).to receive(:url).and_return('https://duckduckgo.com/')
|
|
74
|
+
expect(field).to receive(:set).with('fixture query')
|
|
75
|
+
expect(button).to receive(:click!)
|
|
76
|
+
expect(PWN::WWW.const_get(name).search(browser_obj: handle, q: 'fixture query')).to equal(handle)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it 'preserves both password fields during simulated PayPal signup' do
|
|
81
|
+
password = ' fixture-only password '
|
|
82
|
+
select = instance_double(Watir::Select)
|
|
83
|
+
allow(select).to receive(:wait_until).and_return(select)
|
|
84
|
+
allow(browser).to receive(:select).and_return(select)
|
|
85
|
+
expect(select).to receive(:select).with(value: 'AZ')
|
|
86
|
+
expect(field).to receive(:set).with(password).twice
|
|
87
|
+
expect(PWN::WWW::Paypal.signup(browser_obj: handle, password: password, state: 'AZ')).to equal(handle)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'submits Wayback search using a supported Watir element action' do
|
|
91
|
+
expect(field).to receive(:set).with('fixture query').and_return(nil)
|
|
92
|
+
expect(field).to receive(:send_keys).with(:enter)
|
|
93
|
+
expect(PWN::WWW::WaybackMachine.search(browser_obj: handle, q: 'fixture query')).to equal(handle)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it 'accepts the documented browser options for Torch onion navigation' do
|
|
97
|
+
expect(browser).to receive(:goto).with('http://xmh57jrzrnw6insl.onion')
|
|
98
|
+
expect(PWN::WWW::Torch.onion(browser_obj: handle)).to equal(handle)
|
|
99
|
+
end
|
|
100
|
+
end
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'rest-client'
|
|
5
|
+
require 'open3'
|
|
6
|
+
require 'tmpdir'
|
|
7
|
+
|
|
8
|
+
RSpec.describe PWN::WWW::HackerOne, 'GraphQL runtime regressions' do
|
|
9
|
+
let(:handle) { { browser: RestClient, type: :rest } }
|
|
10
|
+
|
|
11
|
+
before do
|
|
12
|
+
stub_const('PWN::Env', { ai: { module_reflection: false } })
|
|
13
|
+
allow(PWN::Plugins::TransparentBrowser).to receive(:open).and_return(handle)
|
|
14
|
+
allow(PWN::Plugins::TransparentBrowser).to receive(:close).and_return(nil)
|
|
15
|
+
allow(PWN::AI::Agent::HackerOne).to receive(:analyze).and_return(nil)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
%i[get_bounty_programs get_scope_details get_hacktivity].each do |method|
|
|
19
|
+
it "validates TLS for #{method}" do
|
|
20
|
+
response = { data: {
|
|
21
|
+
teams: { edges: [], pageInfo: { hasNextPage: false } },
|
|
22
|
+
team: { structured_scopes_search: { nodes: [], total_count: 0, pageInfo: { hasNextPage: false } } },
|
|
23
|
+
search: { nodes: [], total_count: 0 }
|
|
24
|
+
} }
|
|
25
|
+
expect(RestClient::Request).to receive(:execute) do |options|
|
|
26
|
+
expect(options[:verify_ssl]).to be(true)
|
|
27
|
+
instance_double(RestClient::Response, body: response.to_json)
|
|
28
|
+
end
|
|
29
|
+
described_class.public_send(method, program_name: 'fixture', suppress_progress: true)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "surfaces GraphQL errors from #{method} and closes the transport" do
|
|
33
|
+
allow(RestClient::Request).to receive(:execute).and_return(instance_double(RestClient::Response, body: { errors: [{ message: 'fixture query rejected' }] }.to_json))
|
|
34
|
+
expect(PWN::Plugins::TransparentBrowser).to receive(:close).with(browser_obj: handle)
|
|
35
|
+
expect do
|
|
36
|
+
described_class.public_send(method, program_name: 'fixture', suppress_progress: true)
|
|
37
|
+
end.to raise_error(RuntimeError, /GraphQL.*fixture query rejected/)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'collects all scope pages instead of silently truncating the scope at the first page' do
|
|
42
|
+
offsets = []
|
|
43
|
+
allow(RestClient::Request).to receive(:execute) do |options|
|
|
44
|
+
offset = JSON.parse(options[:payload]).fetch('variables').fetch('from')
|
|
45
|
+
offsets << offset
|
|
46
|
+
response = { data: { team: { structured_scopes_search: {
|
|
47
|
+
nodes: [{ id: "scope-#{offset}" }], total_count: 2, pageInfo: { hasNextPage: offset.zero?, endCursor: offset.to_s }
|
|
48
|
+
} } } }
|
|
49
|
+
instance_double(RestClient::Response, body: response.to_json)
|
|
50
|
+
end
|
|
51
|
+
result = described_class.get_scope_details(program_name: 'fixture')
|
|
52
|
+
expect(result[:scope_details][:data][:team][:structured_scopes_search][:nodes].map { |node| node[:id] }).to eq(%w[scope-0 scope-1])
|
|
53
|
+
expect(offsets).to eq([0, 1])
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it 'collects every hacktivity page up to the reported total count' do
|
|
57
|
+
offsets = []
|
|
58
|
+
allow(RestClient::Request).to receive(:execute) do |options|
|
|
59
|
+
offset = JSON.parse(options[:payload]).fetch('variables').fetch('from')
|
|
60
|
+
offsets << offset
|
|
61
|
+
response = { data: { search: { nodes: [{ id: "report-#{offset}" }], total_count: 2 } } }
|
|
62
|
+
instance_double(RestClient::Response, body: response.to_json)
|
|
63
|
+
end
|
|
64
|
+
result = described_class.get_hacktivity(program_name: 'fixture')
|
|
65
|
+
expect(result[:hacktivity][:data][:search][:nodes].map { |node| node[:id] }).to eq(%w[report-0 report-1])
|
|
66
|
+
expect(offsets).to eq([0, 1])
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
%i[get_scope_details get_hacktivity].each do |method|
|
|
70
|
+
it "rejects repeated result IDs in #{method} pagination" do
|
|
71
|
+
requests = 0
|
|
72
|
+
allow(RestClient::Request).to receive(:execute) do
|
|
73
|
+
requests += 1
|
|
74
|
+
raise 'unexpected third request' if requests > 2
|
|
75
|
+
|
|
76
|
+
search = { nodes: [{ id: 'same' }], total_count: 2, pageInfo: { hasNextPage: true } }
|
|
77
|
+
data = method == :get_scope_details ? { team: { structured_scopes_search: search } } : { search: search }
|
|
78
|
+
instance_double(RestClient::Response, body: { data: data }.to_json)
|
|
79
|
+
end
|
|
80
|
+
expect { described_class.public_send(method, program_name: 'fixture') }.to raise_error(RuntimeError, /pagination.*repeated/)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it 'does not mask preflight validation with an unloaded RestClient rescue constant' do
|
|
85
|
+
script = <<~'RUBY'
|
|
86
|
+
require 'pwn'
|
|
87
|
+
begin
|
|
88
|
+
PWN::WWW::HackerOne.get_bounty_programs(min_payouts_enabled: 'invalid')
|
|
89
|
+
rescue StandardError => e
|
|
90
|
+
puts "#{e.class}: #{e.message}"
|
|
91
|
+
end
|
|
92
|
+
RUBY
|
|
93
|
+
stdout, stderr, status = Open3.capture3(RbConfig.ruby, '-I', File.expand_path('../../../../lib', __dir__), '-e', script)
|
|
94
|
+
expect(status.success?).to be(true), stderr
|
|
95
|
+
expect(stdout).to include('ERROR: min_payouts_enabled should be true or false')
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
%i[get_bounty_programs get_scope_details get_hacktivity].each do |method|
|
|
99
|
+
it "does not invoke optional AI without configuration in #{method}" do
|
|
100
|
+
stub_const('PWN::Env', {})
|
|
101
|
+
expect(PWN::AI::Agent::HackerOne).not_to receive(:analyze)
|
|
102
|
+
response = { data: {
|
|
103
|
+
teams: { edges: [], pageInfo: { hasNextPage: false } },
|
|
104
|
+
team: { structured_scopes_search: { nodes: [], total_count: 0, pageInfo: { hasNextPage: false } } },
|
|
105
|
+
search: { nodes: [], total_count: 0 }
|
|
106
|
+
} }
|
|
107
|
+
allow(RestClient::Request).to receive(:execute).and_return(instance_double(RestClient::Response, body: response.to_json))
|
|
108
|
+
described_class.public_send(method, program_name: 'fixture', suppress_progress: true)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
it 'closes the export transport and leaves caller browser options unchanged' do
|
|
113
|
+
Dir.mktmpdir('pwn-h1-export-') do |dir|
|
|
114
|
+
options = { proxy: 'http://fixture.invalid:8080' }.freeze
|
|
115
|
+
programs = [{ name: 'fixture', burp_target_config: 'https://example.invalid/scope.json' }]
|
|
116
|
+
allow(RestClient::Request).to receive(:execute).and_return(instance_double(RestClient::Response, body: '{"target":{"scope":{}}}'))
|
|
117
|
+
expect(PWN::Plugins::TransparentBrowser).to receive(:close).with(browser_obj: handle)
|
|
118
|
+
described_class.save_burp_target_config_file(programs_arr: programs, browser_opts: options, name: 'fixture', root_dir: dir)
|
|
119
|
+
expect(JSON.parse(File.read(File.join(dir, 'burp_target_config_file-fixture.json')))).to eq('target' => { 'scope' => {} })
|
|
120
|
+
expect(options).to eq(proxy: 'http://fixture.invalid:8080')
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
it 'closes the export transport when a download fails' do
|
|
125
|
+
Dir.mktmpdir('pwn-h1-export-') do |dir|
|
|
126
|
+
programs = [{ name: 'fixture', burp_target_config: 'https://example.invalid/scope.json' }]
|
|
127
|
+
allow(RestClient::Request).to receive(:execute).and_raise(IOError, 'fixture failure')
|
|
128
|
+
expect(PWN::Plugins::TransparentBrowser).to receive(:close).with(browser_obj: handle)
|
|
129
|
+
expect do
|
|
130
|
+
described_class.save_burp_target_config_file(programs_arr: programs, name: 'fixture', root_dir: dir)
|
|
131
|
+
end.to raise_error(IOError, 'fixture failure')
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
it 'rejects a repeated bounty cursor instead of looping indefinitely' do
|
|
136
|
+
requests = 0
|
|
137
|
+
allow(RestClient::Request).to receive(:execute) do
|
|
138
|
+
requests += 1
|
|
139
|
+
raise 'unexpected third request' if requests > 2
|
|
140
|
+
|
|
141
|
+
instance_double(RestClient::Response, body: { data: { teams: { edges: [], pageInfo: { hasNextPage: true, endCursor: 'same' } } } }.to_json)
|
|
142
|
+
end
|
|
143
|
+
expect { described_class.get_bounty_programs(suppress_progress: true) }.to raise_error(RuntimeError, /pagination.*cursor/)
|
|
144
|
+
expect(requests).to eq(2)
|
|
145
|
+
end
|
|
146
|
+
end
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'rest-client'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::WWW::HackerOne, 'pagination review consistency' do
|
|
7
|
+
before do
|
|
8
|
+
stub_const('PWN::Env', { ai: { module_reflection: false } })
|
|
9
|
+
@requests = []
|
|
10
|
+
@pages = []
|
|
11
|
+
# Exercise the real TransparentBrowser, Request serialization and Response
|
|
12
|
+
# decoding. Only transmission is synthetic: no provider is contacted.
|
|
13
|
+
allow_any_instance_of(RestClient::Request).to receive(:transmit) do |request, _uri, _http, payload|
|
|
14
|
+
@requests << { tls: request.verify_ssl, body: JSON.parse(payload.to_s) }
|
|
15
|
+
page = @pages.shift || raise('unexpected request beyond supplied pages')
|
|
16
|
+
RestClient::Response.create(JSON.generate(page), Net::HTTPOK.new('1.1', '200', 'OK'), request)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def page_for(method, ids, total, has_next)
|
|
21
|
+
search = { nodes: ids.map { |id| { id: id.to_s } }, total_count: total }
|
|
22
|
+
if method == :get_scope_details
|
|
23
|
+
search[:pageInfo] = { hasNextPage: has_next }
|
|
24
|
+
{ data: { team: { structured_scopes_search: search } } }
|
|
25
|
+
else
|
|
26
|
+
{ data: { search: search } }
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
%i[get_scope_details get_hacktivity].each do |method|
|
|
31
|
+
it "SERVICES-REVIEW-008 returns all 201 unique records across three real serialized #{method} requests" do
|
|
32
|
+
@pages = (0...201).each_slice(100).with_index.map { |ids, i| page_for(method, ids, 201, i < 2) }
|
|
33
|
+
options = { program_name: 'fixture' }.freeze
|
|
34
|
+
result = described_class.public_send(method, options)
|
|
35
|
+
search = if method == :get_scope_details
|
|
36
|
+
result[:scope_details][:data][:team][:structured_scopes_search]
|
|
37
|
+
else
|
|
38
|
+
result[:hacktivity][:data][:search]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
expect(search[:nodes].map { |node| node[:id] }).to eq((0...201).map(&:to_s))
|
|
42
|
+
expect(search[:nodes].map { |node| node[:id] }.uniq.length).to eq(search[:total_count])
|
|
43
|
+
expect(@requests.map { |req| req[:body]['variables']['from'] }).to eq([0, 100, 200])
|
|
44
|
+
expect(@requests.map { |req| req[:tls] }).to eq([OpenSSL::SSL::VERIFY_PEER] * 3)
|
|
45
|
+
expect(@pages).to eq([])
|
|
46
|
+
expect(options).to eq(program_name: 'fixture')
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "SERVICES-REVIEW-008 rejects #{method} records exceeding the declared total" do
|
|
50
|
+
@pages = [page_for(method, %w[one two], 1, false)]
|
|
51
|
+
|
|
52
|
+
expect { described_class.public_send(method, program_name: 'fixture') }.to raise_error(RuntimeError, /pagination.*count/)
|
|
53
|
+
expect(@requests.length).to eq(1)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "SERVICES-REVIEW-008 signals changing #{method} totals rather than claiming a complete stable result" do
|
|
57
|
+
@pages = [page_for(method, ['one'], 2, true), page_for(method, %w[two three], 3, false)]
|
|
58
|
+
|
|
59
|
+
expect { described_class.public_send(method, program_name: 'fixture') }.to raise_error(RuntimeError, /pagination.*total_count/)
|
|
60
|
+
expect(@requests.length).to eq(2)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "SERVICES-REVIEW-008 accepts a consistent empty #{method} result" do
|
|
64
|
+
@pages = [page_for(method, [], 0, false)]
|
|
65
|
+
|
|
66
|
+
expect { described_class.public_send(method, program_name: 'fixture') }.not_to raise_error
|
|
67
|
+
expect(@requests.length).to eq(1)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'SERVICES-REVIEW-008 rejects a short final scope page inconsistent with total_count' do
|
|
72
|
+
@pages = [page_for(:get_scope_details, ['one'], 2, false)]
|
|
73
|
+
|
|
74
|
+
expect { described_class.get_scope_details(program_name: 'fixture') }.to raise_error(RuntimeError, /pagination.*count/)
|
|
75
|
+
expect(@requests.length).to eq(1)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it 'SERVICES-REVIEW-008 rejects hasNextPage when the declared scope total has already been reached' do
|
|
79
|
+
@pages = [page_for(:get_scope_details, ['one'], 1, true), page_for(:get_scope_details, [], 1, false)]
|
|
80
|
+
|
|
81
|
+
expect { described_class.get_scope_details(program_name: 'fixture') }.to raise_error(RuntimeError, /pagination.*count/)
|
|
82
|
+
expect(@requests.length).to eq(1)
|
|
83
|
+
end
|
|
84
|
+
end
|