arachni 1.2.1 → 1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +66 -0
- data/Gemfile +1 -1
- data/README.md +16 -5
- data/components/checks/active/ldap_injection/errors.txt +1 -0
- data/components/checks/active/source_code_disclosure.rb +1 -1
- data/components/checks/active/unvalidated_redirect.rb +6 -6
- data/components/checks/active/unvalidated_redirect_dom.rb +10 -7
- data/components/checks/passive/grep/captcha.rb +14 -5
- data/components/checks/passive/grep/form_upload.rb +7 -3
- data/components/checks/passive/grep/hsts.rb +3 -3
- data/components/checks/passive/grep/html_objects.rb +2 -3
- data/components/checks/passive/grep/http_only_cookies.rb +2 -3
- data/components/checks/passive/grep/insecure_cookies.rb +1 -1
- data/components/checks/passive/grep/password_autocomplete.rb +2 -2
- data/components/checks/passive/grep/unencrypted_password_forms.rb +7 -7
- data/components/checks/passive/grep/x_frame_options.rb +2 -2
- data/components/checks/passive/http_put.rb +2 -3
- data/components/path_extractors/comments.rb +3 -3
- data/components/path_extractors/scripts.rb +10 -1
- data/components/plugins/defaults/autothrottle.rb +27 -18
- data/components/plugins/defaults/meta/remedies/discovery.rb +30 -33
- data/components/plugins/defaults/meta/remedies/timing_attacks.rb +7 -11
- data/components/plugins/login_script.rb +9 -3
- data/components/plugins/proxy.rb +4 -3
- data/components/reporters/html.rb +11 -14
- data/components/reporters/html/default/issue.erb +13 -38
- data/components/reporters/html/default/issue/info.erb +1 -1
- data/components/reporters/html/default/summary/issues/by_name.erb +3 -3
- data/components/reporters/stdout.rb +62 -71
- data/components/reporters/xml.rb +26 -40
- data/components/reporters/xml/schema.xsd +43 -89
- data/lib/arachni/browser.rb +52 -3
- data/lib/arachni/browser/javascript.rb +3 -3
- data/lib/arachni/browser/javascript/scripts/taint_tracer.js +46 -25
- data/lib/arachni/browser_cluster.rb +61 -0
- data/lib/arachni/browser_cluster/job.rb +21 -1
- data/lib/arachni/browser_cluster/jobs/browser_provider.rb +3 -1
- data/lib/arachni/browser_cluster/jobs/resource_exploration.rb +2 -1
- data/lib/arachni/browser_cluster/jobs/resource_exploration/event_trigger.rb +2 -1
- data/lib/arachni/browser_cluster/jobs/taint_trace.rb +3 -2
- data/lib/arachni/browser_cluster/jobs/taint_trace/event_trigger.rb +1 -1
- data/lib/arachni/browser_cluster/worker.rb +5 -0
- data/lib/arachni/check/auditor.rb +22 -12
- data/lib/arachni/data/framework.rb +13 -1
- data/lib/arachni/data/issues.rb +9 -25
- data/lib/arachni/element/base.rb +9 -3
- data/lib/arachni/element/capabilities/analyzable.rb +2 -6
- data/lib/arachni/element/capabilities/analyzable/differential.rb +24 -7
- data/lib/arachni/element/capabilities/analyzable/{taint.rb → signature.rb} +23 -23
- data/lib/arachni/element/capabilities/auditable.rb +0 -6
- data/lib/arachni/element/capabilities/dom_only.rb +61 -0
- data/lib/arachni/element/capabilities/with_dom.rb +3 -1
- data/lib/arachni/element/cookie.rb +35 -5
- data/lib/arachni/element/cookie/dom.rb +13 -4
- data/lib/arachni/element/{capabilities/auditable/dom.rb → dom.rb} +20 -68
- data/lib/arachni/element/dom/capabilities/auditable.rb +29 -0
- data/lib/arachni/element/dom/capabilities/inputtable.rb +27 -0
- data/lib/arachni/element/dom/capabilities/mutable.rb +21 -0
- data/lib/arachni/element/dom/capabilities/submittable.rb +52 -0
- data/lib/arachni/element/form.rb +12 -1
- data/lib/arachni/element/form/capabilities/mutable.rb +2 -1
- data/lib/arachni/element/form/capabilities/with_dom.rb +0 -1
- data/lib/arachni/element/form/dom.rb +9 -3
- data/lib/arachni/element/header.rb +14 -33
- data/lib/arachni/element/header/capabilities/inputtable.rb +29 -0
- data/lib/arachni/element/header/capabilities/mutable.rb +51 -0
- data/lib/arachni/element/input/dom.rb +71 -0
- data/lib/arachni/element/json.rb +2 -0
- data/lib/arachni/element/link.rb +3 -0
- data/lib/arachni/element/link/capabilities/with_dom.rb +0 -1
- data/lib/arachni/element/link/dom.rb +16 -3
- data/lib/arachni/element/link/dom/capabilities/submittable.rb +29 -0
- data/lib/arachni/element/link_template.rb +3 -5
- data/lib/arachni/element/link_template/capabilities/inputtable.rb +5 -0
- data/lib/arachni/element/link_template/capabilities/with_dom.rb +0 -1
- data/lib/arachni/element/link_template/dom.rb +16 -3
- data/lib/arachni/element/link_template/dom/capabilities/submittable.rb +29 -0
- data/lib/arachni/element/server.rb +3 -5
- data/lib/arachni/element/ui_form.rb +106 -0
- data/lib/arachni/element/ui_form/dom.rb +107 -0
- data/lib/arachni/element/ui_input.rb +62 -0
- data/lib/arachni/element/xml.rb +2 -1
- data/lib/arachni/framework.rb +7 -5
- data/lib/arachni/framework/parts/audit.rb +0 -1
- data/lib/arachni/framework/parts/check.rb +1 -0
- data/lib/arachni/framework/parts/data.rb +4 -0
- data/lib/arachni/framework/parts/state.rb +0 -2
- data/lib/arachni/http/client.rb +17 -6
- data/lib/arachni/http/proxy_server.rb +52 -5
- data/lib/arachni/http/request.rb +1 -1
- data/lib/arachni/issue.rb +34 -179
- data/lib/arachni/issue/severity.rb +2 -0
- data/lib/arachni/option_groups/audit.rb +22 -2
- data/lib/arachni/option_groups/browser_cluster.rb +15 -0
- data/lib/arachni/page.rb +3 -2
- data/lib/arachni/parser.rb +24 -5
- data/lib/arachni/platform/manager.rb +1 -2
- data/lib/arachni/rpc/server/framework.rb +3 -4
- data/lib/arachni/rpc/server/framework/multi_instance.rb +2 -1
- data/lib/arachni/session.rb +1 -1
- data/lib/arachni/trainer.rb +4 -7
- data/lib/arachni/watir/element.rb +12 -1
- data/lib/version +1 -1
- data/spec/arachni/browser/element_locator_spec.rb +43 -43
- data/spec/arachni/browser/javascript/dom_monitor_spec.rb +44 -44
- data/spec/arachni/browser/javascript/proxy/stub_spec.rb +17 -14
- data/spec/arachni/browser/javascript/proxy_spec.rb +24 -24
- data/spec/arachni/browser/javascript/taint_tracer/frame/called_function_spec.rb +11 -11
- data/spec/arachni/browser/javascript/taint_tracer/frame_spec.rb +7 -7
- data/spec/arachni/browser/javascript/taint_tracer/sink/data_flow_spec.rb +13 -13
- data/spec/arachni/browser/javascript/taint_tracer/sink/execution_flow_spec.rb +7 -7
- data/spec/arachni/browser/javascript/taint_tracer_spec.rb +568 -558
- data/spec/arachni/browser/javascript_spec.rb +73 -63
- data/spec/arachni/browser_cluster/job/result_spec.rb +3 -3
- data/spec/arachni/browser_cluster/job_spec.rb +68 -48
- data/spec/arachni/browser_cluster/jobs/resource_exploration/event_trigger/result_spec.rb +2 -2
- data/spec/arachni/browser_cluster/jobs/resource_exploration/event_trigger_spec.rb +5 -4
- data/spec/arachni/browser_cluster/jobs/resource_exploration/result_spec.rb +2 -2
- data/spec/arachni/browser_cluster/jobs/resource_exploration_spec.rb +5 -5
- data/spec/arachni/browser_cluster/worker_spec.rb +87 -70
- data/spec/arachni/browser_cluster_spec.rb +64 -39
- data/spec/arachni/browser_spec.rb +692 -527
- data/spec/arachni/check/auditor_spec.rb +177 -147
- data/spec/arachni/check/base_spec.rb +33 -33
- data/spec/arachni/check/manager_spec.rb +15 -15
- data/spec/arachni/component/base_spec.rb +8 -8
- data/spec/arachni/component/manager_spec.rb +100 -99
- data/spec/arachni/component/options/address_spec.rb +3 -3
- data/spec/arachni/component/options/base_spec.rb +7 -7
- data/spec/arachni/component/options/bool_spec.rb +9 -9
- data/spec/arachni/component/options/float_spec.rb +6 -6
- data/spec/arachni/component/options/int_spec.rb +5 -5
- data/spec/arachni/component/options/multiple_choice_spec.rb +12 -12
- data/spec/arachni/component/options/object_spec.rb +2 -2
- data/spec/arachni/component/options/path_spec.rb +3 -3
- data/spec/arachni/component/options/port_spec.rb +5 -5
- data/spec/arachni/component/options/string_spec.rb +3 -3
- data/spec/arachni/component/options/url_spec.rb +4 -4
- data/spec/arachni/component/utilities_spec.rb +2 -2
- data/spec/arachni/data/framework/rpc_spec.rb +10 -9
- data/spec/arachni/data/framework_spec.rb +65 -46
- data/spec/arachni/data/issues_spec.rb +39 -77
- data/spec/arachni/data/plugins_spec.rb +11 -11
- data/spec/arachni/data/session_spec.rb +6 -6
- data/spec/arachni/data_spec.rb +8 -8
- data/spec/arachni/element/body_spec.rb +10 -10
- data/spec/arachni/element/capabilities/analyzable/differential_spec.rb +39 -21
- data/spec/arachni/element/capabilities/analyzable/{taint_spec.rb → signature_spec.rb} +63 -63
- data/spec/arachni/element/capabilities/analyzable/timeout_spec.rb +51 -51
- data/spec/arachni/element/capabilities/with_scope/scope_spec.rb +5 -5
- data/spec/arachni/element/cookie/dom_spec.rb +37 -18
- data/spec/arachni/element/cookie_spec.rb +206 -139
- data/spec/arachni/element/form/dom_spec.rb +36 -19
- data/spec/arachni/element/form_spec.rb +210 -187
- data/spec/arachni/element/generic_dom_spec.rb +14 -14
- data/spec/arachni/element/header_spec.rb +35 -17
- data/spec/arachni/element/json_spec.rb +53 -31
- data/spec/arachni/element/link/dom_spec.rb +46 -28
- data/spec/arachni/element/link_spec.rb +58 -40
- data/spec/arachni/element/link_template/dom_spec.rb +47 -29
- data/spec/arachni/element/link_template_spec.rb +79 -61
- data/spec/arachni/element/path_spec.rb +1 -1
- data/spec/arachni/element/server_spec.rb +33 -32
- data/spec/arachni/element/ui_form/ui_form_dom_spec.rb +164 -0
- data/spec/arachni/element/ui_form_spec.rb +242 -0
- data/spec/arachni/element/ui_input/dom_spec.rb +157 -0
- data/spec/arachni/element/ui_input_spec.rb +136 -0
- data/spec/arachni/element/xml_spec.rb +42 -24
- data/spec/arachni/element_filter_spec.rb +49 -48
- data/spec/arachni/error_spec.rb +3 -3
- data/spec/arachni/framework/parts/audit_spec.rb +64 -63
- data/spec/arachni/framework/parts/browser_spec.rb +16 -16
- data/spec/arachni/framework/parts/check_spec.rb +3 -3
- data/spec/arachni/framework/parts/data_spec.rb +48 -48
- data/spec/arachni/framework/parts/platform_spec.rb +3 -3
- data/spec/arachni/framework/parts/plugin_spec.rb +7 -6
- data/spec/arachni/framework/parts/report_spec.rb +7 -7
- data/spec/arachni/framework/parts/scope_spec.rb +16 -16
- data/spec/arachni/framework/parts/state_spec.rb +68 -69
- data/spec/arachni/framework_spec.rb +39 -31
- data/spec/arachni/http/client/dynamic_404_handlers_spec.rb +32 -32
- data/spec/arachni/http/client_spec.rb +219 -208
- data/spec/arachni/http/cookie_jar_spec.rb +72 -72
- data/spec/arachni/http/headers_spec.rb +14 -14
- data/spec/arachni/http/proxy_server_spec.rb +43 -42
- data/spec/arachni/http/request_spec.rb +105 -103
- data/spec/arachni/http/response/scope_spec.rb +24 -24
- data/spec/arachni/http/response_spec.rb +50 -49
- data/spec/arachni/issue/severity_spec.rb +10 -9
- data/spec/arachni/issue_spec.rb +71 -369
- data/spec/arachni/option_groups/audit_spec.rb +114 -114
- data/spec/arachni/option_groups/browser_cluster_spec.rb +20 -3
- data/spec/arachni/option_groups/datastore_spec.rb +6 -6
- data/spec/arachni/option_groups/dispatcher_spec.rb +19 -19
- data/spec/arachni/option_groups/http_spec.rb +11 -11
- data/spec/arachni/option_groups/input_spec.rb +31 -27
- data/spec/arachni/option_groups/output_spec.rb +2 -2
- data/spec/arachni/option_groups/paths_spec.rb +17 -17
- data/spec/arachni/option_groups/rpc_spec.rb +2 -2
- data/spec/arachni/option_groups/scope_spec.rb +40 -40
- data/spec/arachni/option_groups/session_spec.rb +6 -5
- data/spec/arachni/option_groups/snapshot_spec.rb +4 -4
- data/spec/arachni/options_spec.rb +46 -45
- data/spec/arachni/page/dom/transition_spec.rb +74 -72
- data/spec/arachni/page/dom_spec.rb +35 -35
- data/spec/arachni/page/scope_spec.rb +15 -15
- data/spec/arachni/page_spec.rb +217 -217
- data/spec/arachni/parser_spec.rb +106 -104
- data/spec/arachni/platform/fingerprinter_spec.rb +17 -14
- data/spec/arachni/platform/list_spec.rb +33 -33
- data/spec/arachni/platform/manager_spec.rb +67 -64
- data/spec/arachni/plugin/base_spec.rb +10 -10
- data/spec/arachni/plugin/manager_spec.rb +38 -37
- data/spec/arachni/report_spec.rb +43 -40
- data/spec/arachni/reporter/base_spec.rb +15 -15
- data/spec/arachni/reporter/manager_spec.rb +4 -4
- data/spec/arachni/reporter/options_spec.rb +6 -6
- data/spec/arachni/rpc/client/base_spec.rb +6 -6
- data/spec/arachni/rpc/client/dispatcher_spec.rb +2 -2
- data/spec/arachni/rpc/client/instance_spec.rb +6 -6
- data/spec/arachni/rpc/server/active_options_spec.rb +11 -8
- data/spec/arachni/rpc/server/base_spec.rb +5 -5
- data/spec/arachni/rpc/server/checks/manager_spec.rb +8 -8
- data/spec/arachni/rpc/server/dispatcher/node_spec.rb +37 -37
- data/spec/arachni/rpc/server/dispatcher/service_spec.rb +15 -14
- data/spec/arachni/rpc/server/dispatcher_spec.rb +36 -35
- data/spec/arachni/rpc/server/framework/distributor_spec.rb +36 -36
- data/spec/arachni/rpc/server/framework_multi_spec.rb +340 -336
- data/spec/arachni/rpc/server/framework_spec.rb +90 -85
- data/spec/arachni/rpc/server/instance_spec.rb +126 -107
- data/spec/arachni/rpc/server/output_spec.rb +1 -1
- data/spec/arachni/rpc/server/plugin/manager_spec.rb +6 -6
- data/spec/arachni/ruby/array_spec.rb +42 -42
- data/spec/arachni/ruby/hash_spec.rb +20 -18
- data/spec/arachni/ruby/io_spec.rb +2 -2
- data/spec/arachni/ruby/object_spec.rb +1 -1
- data/spec/arachni/ruby/set_spec.rb +3 -3
- data/spec/arachni/ruby/string_spec.rb +30 -30
- data/spec/arachni/ruby/webrick_spec.rb +2 -2
- data/spec/arachni/scope_spec.rb +1 -1
- data/spec/arachni/session_spec.rb +67 -64
- data/spec/arachni/snapshot_spec.rb +15 -15
- data/spec/arachni/state/audit_spec.rb +11 -11
- data/spec/arachni/state/element_filter_spec.rb +6 -6
- data/spec/arachni/state/framework/rpc_spec.rb +12 -12
- data/spec/arachni/state/framework_spec.rb +125 -121
- data/spec/arachni/state/http_spec.rb +7 -7
- data/spec/arachni/state/options_spec.rb +7 -7
- data/spec/arachni/state/plugins_spec.rb +8 -8
- data/spec/arachni/state_spec.rb +10 -10
- data/spec/arachni/support/buffer/autoflush_spec.rb +16 -16
- data/spec/arachni/support/buffer/base_spec.rb +39 -39
- data/spec/arachni/support/cache/least_cost_replacement_spec.rb +18 -18
- data/spec/arachni/support/cache/least_recently_pushed_spec.rb +24 -24
- data/spec/arachni/support/cache/least_recently_used_spec.rb +20 -20
- data/spec/arachni/support/cache/preference_spec.rb +4 -4
- data/spec/arachni/support/cache/random_replacement_spec.rb +8 -8
- data/spec/arachni/support/crypto/rsa_aes_cbc_spec.rb +1 -1
- data/spec/arachni/support/database/hash_spec.rb +44 -43
- data/spec/arachni/support/database/queue_spec.rb +27 -27
- data/spec/arachni/support/lookup/hash_set_spec.rb +8 -8
- data/spec/arachni/support/lookup/moolb_spec.rb +3 -3
- data/spec/arachni/support/mixins/observable_spec.rb +6 -6
- data/spec/arachni/support/signature_spec.rb +19 -19
- data/spec/arachni/trainer_spec.rb +39 -39
- data/spec/arachni/typhoeus/hydra_spec.rb +2 -2
- data/spec/arachni/uri/scope_spec.rb +66 -66
- data/spec/arachni/uri_spec.rb +107 -105
- data/spec/arachni/utilities_spec.rb +40 -40
- data/spec/components/checks/active/csrf_spec.rb +8 -8
- data/spec/components/checks/active/no_sql_injection_spec.rb +1 -1
- data/spec/components/checks/active/sql_injection_spec.rb +16 -16
- data/spec/components/checks/active/trainer_spec.rb +4 -4
- data/spec/components/checks/active/unvalidated_redirect_dom_spec.rb +4 -2
- data/spec/components/checks/active/xpath_injection_spec.rb +1 -1
- data/spec/components/checks/active/xss_dom_script_context_spec.rb +51 -21
- data/spec/components/checks/active/xss_dom_spec.rb +46 -24
- data/spec/components/checks/passive/allowed_methods_spec.rb +1 -1
- data/spec/components/checks/passive/grep/cookie_set_for_parent_domain_spec.rb +1 -1
- data/spec/components/checks/passive/grep/hsts_spec.rb +2 -2
- data/spec/components/checks/passive/grep/http_only_cookies_spec.rb +1 -1
- data/spec/components/checks/passive/grep/insecure_cookies_spec.rb +1 -1
- data/spec/components/checks/passive/grep/insecure_cors_policy_spec.rb +2 -2
- data/spec/components/checks/passive/grep/password_autocomplete_spec.rb +1 -1
- data/spec/components/checks/passive/grep/private_ip_spec.rb +3 -3
- data/spec/components/checks/passive/grep/unencrypted_password_forms_spec.rb +1 -1
- data/spec/components/checks/passive/grep/x_frame_options_spec.rb +2 -2
- data/spec/components/checks/passive/interesting_responses_spec.rb +2 -2
- data/spec/components/checks/passive/webdav_spec.rb +1 -1
- data/spec/components/checks/passive/xst_spec.rb +1 -1
- data/spec/components/fingerprinters/servers/apache_spec.rb +2 -2
- data/spec/components/path_extractors/comments_spec.rb +5 -1
- data/spec/components/path_extractors/scripts_spec.rb +5 -2
- data/spec/components/plugins/autologin_spec.rb +22 -22
- data/spec/components/plugins/autothrottle_spec.rb +6 -5
- data/spec/components/plugins/content_types_spec.rb +4 -4
- data/spec/components/plugins/cookie_collector_spec.rb +5 -5
- data/spec/components/plugins/exec_spec.rb +12 -12
- data/spec/components/plugins/form_dicattack_spec.rb +3 -3
- data/spec/components/plugins/headers_collector_spec.rb +8 -8
- data/spec/components/plugins/healthmap_spec.rb +3 -3
- data/spec/components/plugins/http_dicattack_spec.rb +3 -3
- data/spec/components/plugins/login_script_spec.rb +79 -22
- data/spec/components/plugins/meta/remedies/discovery_spec.rb +3 -2
- data/spec/components/plugins/meta/remedies/timing_attacks_spec.rb +3 -3
- data/spec/components/plugins/meta/uniformity_spec.rb +2 -2
- data/spec/components/plugins/restrict_to_dom_state_spec.rb +1 -1
- data/spec/components/plugins/script_spec.rb +1 -1
- data/spec/components/plugins/uncommon_headers_spec.rb +2 -2
- data/spec/components/plugins/vector_collector_spec.rb +2 -2
- data/spec/components/plugins/vector_feed_spec.rb +40 -40
- data/spec/components/plugins/waf_detector_spec.rb +6 -6
- data/spec/components/reporters/json_spec.rb +4 -4
- data/spec/components/reporters/marshal_spec.rb +2 -2
- data/spec/components/reporters/yaml_spec.rb +3 -2
- data/spec/external/wavsep/active/sqli_spec.rb +1 -3
- data/spec/spec_helper.rb +4 -0
- data/spec/support/factories/element/ui_form.rb +14 -0
- data/spec/support/factories/element/ui_input.rb +13 -0
- data/spec/support/factories/issue.rb +0 -13
- data/spec/support/fixtures/report.afr +0 -0
- data/spec/support/fixtures/{taint_check/taint.rb → signature_check/signature.rb} +2 -2
- data/spec/support/helpers/browser_cluster/jobs/taint_tracer.rb +11 -11
- data/spec/support/helpers/framework.rb +1 -1
- data/spec/support/helpers/pages.rb +2 -2
- data/spec/support/servers/arachni/browser.rb +139 -0
- data/spec/support/servers/arachni/browser/javascript/taint_tracer.rb +40 -0
- data/spec/support/servers/arachni/element/capabilities/analyzable/{taint.rb → signature.rb} +0 -0
- data/spec/support/servers/arachni/element/input/input_dom.rb +102 -0
- data/spec/support/servers/arachni/element/ui_form/ui_form_dom.rb +238 -0
- data/spec/support/servers/checks/active/trainer_check.rb +7 -7
- data/spec/support/servers/checks/active/unvalidated_redirect_dom.rb +22 -6
- data/spec/support/servers/checks/active/xss_dom.rb +50 -0
- data/spec/support/servers/checks/active/xss_dom_script_context.rb +53 -0
- data/spec/support/shared/browser/javascript/taint_tracer/sink/base.rb +6 -6
- data/spec/support/shared/check.rb +10 -12
- data/spec/support/shared/component/options/base.rb +24 -24
- data/spec/support/shared/element/base.rb +25 -25
- data/spec/support/shared/element/capabilities/auditable.rb +116 -140
- data/spec/support/shared/element/capabilities/dom_only.rb +65 -0
- data/spec/support/shared/element/capabilities/inputtable.rb +71 -86
- data/spec/support/shared/element/capabilities/mutable.rb +122 -111
- data/spec/support/shared/element/capabilities/refreshable.rb +10 -10
- data/spec/support/shared/element/capabilities/{submitable.rb → submittable.rb} +26 -26
- data/spec/support/shared/element/capabilities/with_auditor.rb +10 -10
- data/spec/support/shared/element/capabilities/with_dom.rb +8 -8
- data/spec/support/shared/element/capabilities/with_node.rb +4 -6
- data/spec/support/shared/element/capabilities/with_scope.rb +2 -2
- data/spec/support/shared/element/capabilities/with_source.rb +6 -8
- data/spec/support/shared/element/dom.rb +144 -0
- data/spec/support/shared/element/dom/auditable.rb +42 -0
- data/spec/support/shared/element/dom/inputtable.rb +5 -0
- data/spec/support/shared/element/dom/mutable.rb +3 -0
- data/spec/support/shared/element/dom/submittable.rb +119 -0
- data/spec/support/shared/external/wavsep.rb +3 -3
- data/spec/support/shared/fingerprinter.rb +2 -2
- data/spec/support/shared/framework.rb +1 -1
- data/spec/support/shared/http/message.rb +9 -9
- data/spec/support/shared/option_group.rb +17 -17
- data/spec/support/shared/path_extractor.rb +1 -1
- data/spec/support/shared/plugin.rb +2 -2
- data/spec/support/shared/support/cache.rb +57 -57
- data/spec/support/shared/support/lookup.rb +25 -25
- data/ui/cli/framework.rb +22 -11
- data/ui/cli/framework/option_parser.rb +15 -0
- data/ui/cli/option_parser.rb +8 -1
- data/ui/cli/output.rb +2 -1
- metadata +54 -20
- data/components/checks/active/xss_dom_inputs.rb +0 -236
- data/spec/components/checks/active/xss_dom_inputs_spec.rb +0 -30
- data/spec/support/servers/checks/active/xss_dom_inputs.rb +0 -59
- data/spec/support/shared/element/capabilities/auditable/dom.rb +0 -322
@@ -12,7 +12,7 @@ describe Arachni::Page::DOM::Transition do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "supports #{Arachni::RPC::Serializer}" do
|
15
|
-
subject.
|
15
|
+
expect(subject).to eq(Arachni::RPC::Serializer.deep_clone( subject ))
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '#to_rpc_data' do
|
@@ -20,7 +20,7 @@ describe Arachni::Page::DOM::Transition do
|
|
20
20
|
|
21
21
|
%w(element event options time).each do |attribute|
|
22
22
|
it "includes '#{attribute}'" do
|
23
|
-
data[attribute].
|
23
|
+
expect(data[attribute]).to eq(subject.send( attribute ))
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -31,7 +31,7 @@ describe Arachni::Page::DOM::Transition do
|
|
31
31
|
|
32
32
|
%w(element event options time).each do |attribute|
|
33
33
|
it "restores '#{attribute}'" do
|
34
|
-
restored.send( attribute ).
|
34
|
+
expect(restored.send( attribute )).to eq(subject.send( attribute ))
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -42,7 +42,7 @@ describe Arachni::Page::DOM::Transition do
|
|
42
42
|
data = Arachni::RPC::Serializer.rpc_data( original )
|
43
43
|
restored = described_class.from_rpc_data( data )
|
44
44
|
|
45
|
-
restored.element.
|
45
|
+
expect(restored.element).to eq(original.element)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -56,7 +56,7 @@ describe Arachni::Page::DOM::Transition do
|
|
56
56
|
data = Arachni::RPC::Serializer.rpc_data( original )
|
57
57
|
restored = described_class.from_rpc_data( data )
|
58
58
|
|
59
|
-
restored.element.
|
59
|
+
expect(restored.element).to eq(original.element)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -66,12 +66,12 @@ describe Arachni::Page::DOM::Transition do
|
|
66
66
|
context 'when given options' do
|
67
67
|
it 'uses them to configure the attributes' do
|
68
68
|
t = described_class.new( :page, :load )
|
69
|
-
t.element.
|
70
|
-
t.event.
|
69
|
+
expect(t.element).to eq(:page)
|
70
|
+
expect(t.event).to eq(:load)
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'marks it as running' do
|
74
|
-
described_class.new( :page, :load ).
|
74
|
+
expect(described_class.new( :page, :load )).to be_running
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -80,7 +80,7 @@ describe Arachni::Page::DOM::Transition do
|
|
80
80
|
options = { more: :stuff }
|
81
81
|
|
82
82
|
t = described_class.new( :page, :load, options )
|
83
|
-
t.options.
|
83
|
+
expect(t.options).to eq(options)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
@@ -90,7 +90,7 @@ describe Arachni::Page::DOM::Transition do
|
|
90
90
|
described_class.new :page, :load do
|
91
91
|
called = true
|
92
92
|
end
|
93
|
-
called.
|
93
|
+
expect(called).to be_truthy
|
94
94
|
end
|
95
95
|
|
96
96
|
it 'marks the transition as finished' do
|
@@ -100,10 +100,10 @@ describe Arachni::Page::DOM::Transition do
|
|
100
100
|
sleep 1
|
101
101
|
end
|
102
102
|
|
103
|
-
called.
|
104
|
-
t.time.
|
105
|
-
t.
|
106
|
-
t.
|
103
|
+
expect(called).to be_truthy
|
104
|
+
expect(t.time).to be > 1
|
105
|
+
expect(t).to be_completed
|
106
|
+
expect(t).not_to be_running
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
@@ -111,20 +111,20 @@ describe Arachni::Page::DOM::Transition do
|
|
111
111
|
describe '#start' do
|
112
112
|
it 'configures the attributes' do
|
113
113
|
t = empty_transition.start( :page, :load )
|
114
|
-
t.element.
|
115
|
-
t.event.
|
114
|
+
expect(t.element).to eq(:page)
|
115
|
+
expect(t.event).to eq(:load)
|
116
116
|
end
|
117
117
|
|
118
118
|
it 'converts the event to a symbol' do
|
119
|
-
empty_transition.start( :page, 'load' ).event.
|
119
|
+
expect(empty_transition.start( :page, 'load' ).event).to eq(:load)
|
120
120
|
end
|
121
121
|
|
122
122
|
it 'marks it as running' do
|
123
|
-
empty_transition.start( :page, :load ).
|
123
|
+
expect(empty_transition.start( :page, :load )).to be_running
|
124
124
|
end
|
125
125
|
|
126
126
|
it 'returns self' do
|
127
|
-
empty_transition.start( :page, :load ).
|
127
|
+
expect(empty_transition.start( :page, :load )).to be empty_transition
|
128
128
|
end
|
129
129
|
|
130
130
|
context 'when given extra options' do
|
@@ -132,7 +132,7 @@ describe Arachni::Page::DOM::Transition do
|
|
132
132
|
options = { more: :stuff }
|
133
133
|
|
134
134
|
t = empty_transition.start( :page, :load, options )
|
135
|
-
t.options.
|
135
|
+
expect(t.options).to eq(options)
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
@@ -142,7 +142,7 @@ describe Arachni::Page::DOM::Transition do
|
|
142
142
|
empty_transition.start :page, :load do
|
143
143
|
called = true
|
144
144
|
end
|
145
|
-
called.
|
145
|
+
expect(called).to be_truthy
|
146
146
|
end
|
147
147
|
|
148
148
|
it 'marks the transition as finished' do
|
@@ -152,14 +152,14 @@ describe Arachni::Page::DOM::Transition do
|
|
152
152
|
sleep 1
|
153
153
|
end
|
154
154
|
|
155
|
-
called.
|
156
|
-
t.time.
|
157
|
-
t.
|
158
|
-
t.
|
155
|
+
expect(called).to be_truthy
|
156
|
+
expect(t.time).to be > 1
|
157
|
+
expect(t).to be_completed
|
158
|
+
expect(t).not_to be_running
|
159
159
|
end
|
160
160
|
|
161
161
|
it 'returns self' do
|
162
|
-
empty_transition.start( :page, :load ){}.
|
162
|
+
expect(empty_transition.start( :page, :load ){}).to be empty_transition
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
@@ -167,14 +167,14 @@ describe Arachni::Page::DOM::Transition do
|
|
167
167
|
context String do
|
168
168
|
it 'assigns it to #element' do
|
169
169
|
empty_transition.start 'http://test.com/stuff', :request
|
170
|
-
empty_transition.element.
|
170
|
+
expect(empty_transition.element).to eq('http://test.com/stuff')
|
171
171
|
|
172
172
|
end
|
173
173
|
end
|
174
174
|
context Symbol do
|
175
175
|
it 'assigns it to #element' do
|
176
176
|
empty_transition.start :page, :load
|
177
|
-
empty_transition.element.
|
177
|
+
expect(empty_transition.element).to eq(:page)
|
178
178
|
end
|
179
179
|
end
|
180
180
|
context 'other' do
|
@@ -207,15 +207,15 @@ describe Arachni::Page::DOM::Transition do
|
|
207
207
|
it 'sets the #time' do
|
208
208
|
running = Factory[:running_transition]
|
209
209
|
sleep 1
|
210
|
-
running.complete.time.
|
210
|
+
expect(running.complete.time).to be > 1
|
211
211
|
end
|
212
212
|
|
213
213
|
it 'marks it as completed' do
|
214
|
-
running_transition.complete.
|
214
|
+
expect(running_transition.complete).to be_completed
|
215
215
|
end
|
216
216
|
|
217
217
|
it 'returns self' do
|
218
|
-
running_transition.complete.
|
218
|
+
expect(running_transition.complete).to be running_transition
|
219
219
|
end
|
220
220
|
|
221
221
|
context 'when the job is not running' do
|
@@ -239,13 +239,13 @@ describe Arachni::Page::DOM::Transition do
|
|
239
239
|
context 'when the event is' do
|
240
240
|
context :request do
|
241
241
|
it 'returns 0' do
|
242
|
-
empty_transition.start( 'http://test/', :request ).depth.
|
242
|
+
expect(empty_transition.start( 'http://test/', :request ).depth).to eq(0)
|
243
243
|
end
|
244
244
|
end
|
245
245
|
|
246
246
|
context 'other' do
|
247
247
|
it 'returns 1' do
|
248
|
-
empty_transition.start( :stuff, :blah ).depth.
|
248
|
+
expect(empty_transition.start( :stuff, :blah ).depth).to eq(1)
|
249
249
|
end
|
250
250
|
end
|
251
251
|
end
|
@@ -253,36 +253,36 @@ describe Arachni::Page::DOM::Transition do
|
|
253
253
|
|
254
254
|
describe '#element' do
|
255
255
|
it 'returns the element associated with the transition' do
|
256
|
-
subject.element.
|
256
|
+
expect(subject.element).to eq(:page)
|
257
257
|
end
|
258
258
|
|
259
259
|
context 'when the transition has not been initialized with any arguments' do
|
260
260
|
it 'returns nil' do
|
261
|
-
empty_transition.element.
|
261
|
+
expect(empty_transition.element).to be_nil
|
262
262
|
end
|
263
263
|
end
|
264
264
|
end
|
265
265
|
|
266
266
|
describe '#event' do
|
267
267
|
it 'returns the event associated with the transition' do
|
268
|
-
subject.event.
|
268
|
+
expect(subject.event).to eq(:load)
|
269
269
|
end
|
270
270
|
|
271
271
|
context 'when the transition has not been initialized with any arguments' do
|
272
272
|
it 'returns nil' do
|
273
|
-
empty_transition.event.
|
273
|
+
expect(empty_transition.event).to be_nil
|
274
274
|
end
|
275
275
|
end
|
276
276
|
end
|
277
277
|
|
278
278
|
describe '#options' do
|
279
279
|
it 'returns any extra options' do
|
280
|
-
subject.options.
|
280
|
+
expect(subject.options).to be_any
|
281
281
|
end
|
282
282
|
|
283
283
|
context 'when the transition has not been initialized with any arguments' do
|
284
284
|
it 'returns an empty hash' do
|
285
|
-
empty_transition.options.
|
285
|
+
expect(empty_transition.options).to eq({})
|
286
286
|
end
|
287
287
|
end
|
288
288
|
end
|
@@ -290,21 +290,21 @@ describe Arachni::Page::DOM::Transition do
|
|
290
290
|
describe '#time' do
|
291
291
|
context 'when the transition has not been initialized with any arguments' do
|
292
292
|
it 'returns nil' do
|
293
|
-
empty_transition.time.
|
293
|
+
expect(empty_transition.time).to be_nil
|
294
294
|
end
|
295
295
|
end
|
296
296
|
|
297
297
|
context 'when the transition is running' do
|
298
298
|
it 'returns nil' do
|
299
|
-
running_transition.
|
300
|
-
running_transition.time.
|
299
|
+
expect(running_transition).to be_running
|
300
|
+
expect(running_transition.time).to be_nil
|
301
301
|
end
|
302
302
|
end
|
303
303
|
|
304
304
|
context 'when the transition has completed' do
|
305
305
|
it 'returns the time it took for the transition' do
|
306
|
-
completed_transition.
|
307
|
-
completed_transition.time.
|
306
|
+
expect(completed_transition).not_to be_running
|
307
|
+
expect(completed_transition.time).to be > 0
|
308
308
|
end
|
309
309
|
end
|
310
310
|
end
|
@@ -312,7 +312,7 @@ describe Arachni::Page::DOM::Transition do
|
|
312
312
|
describe '#time=' do
|
313
313
|
it 'sets #time' do
|
314
314
|
completed_transition.time = 1.2
|
315
|
-
completed_transition.time.
|
315
|
+
expect(completed_transition.time).to eq(1.2)
|
316
316
|
end
|
317
317
|
end
|
318
318
|
|
@@ -334,7 +334,7 @@ describe Arachni::Page::DOM::Transition do
|
|
334
334
|
'<div id="my-div" onclick="addForm();">'
|
335
335
|
)
|
336
336
|
transition = described_class.new( element, :click )
|
337
|
-
transition.complete.play( @browser ).
|
337
|
+
expect(transition.complete.play( @browser )).to eq(transition)
|
338
338
|
|
339
339
|
pages_should_have_form_with_input [@browser.to_page], 'by-ajax'
|
340
340
|
end
|
@@ -350,8 +350,9 @@ describe Arachni::Page::DOM::Transition do
|
|
350
350
|
'<div id="my-div">'
|
351
351
|
)
|
352
352
|
transition = described_class.new( element, :onclick )
|
353
|
-
transition.complete.play( @browser ).
|
353
|
+
expect(transition.complete.play( @browser )).to eq(
|
354
354
|
described_class.new( element, :click )
|
355
|
+
)
|
355
356
|
|
356
357
|
pages_should_have_form_with_input [@browser.to_page], 'by-ajax'
|
357
358
|
end
|
@@ -362,8 +363,8 @@ describe Arachni::Page::DOM::Transition do
|
|
362
363
|
element = Arachni::Browser::ElementLocator.from_html(
|
363
364
|
'<div id="my-diva">'
|
364
365
|
)
|
365
|
-
described_class.new( element, :click ).
|
366
|
-
complete.play( @browser ).
|
366
|
+
expect(described_class.new( element, :click ).
|
367
|
+
complete.play( @browser )).to be_nil
|
367
368
|
end
|
368
369
|
end
|
369
370
|
|
@@ -382,19 +383,19 @@ describe Arachni::Page::DOM::Transition do
|
|
382
383
|
context 'when the transition' do
|
383
384
|
context 'is in progress' do
|
384
385
|
it 'returns true' do
|
385
|
-
running_transition.running
|
386
|
+
expect(running_transition.running?).to be_truthy
|
386
387
|
end
|
387
388
|
end
|
388
389
|
|
389
390
|
context 'has completed' do
|
390
391
|
it 'returns false' do
|
391
|
-
completed_transition.running
|
392
|
+
expect(completed_transition.running?).to be_falsey
|
392
393
|
end
|
393
394
|
end
|
394
395
|
|
395
396
|
context 'is not progress' do
|
396
397
|
it 'returns false' do
|
397
|
-
empty_transition.running
|
398
|
+
expect(empty_transition.running?).to be_falsey
|
398
399
|
end
|
399
400
|
end
|
400
401
|
end
|
@@ -404,19 +405,19 @@ describe Arachni::Page::DOM::Transition do
|
|
404
405
|
context 'when the transition' do
|
405
406
|
context 'has completed' do
|
406
407
|
it 'returns true' do
|
407
|
-
completed_transition.completed
|
408
|
+
expect(completed_transition.completed?).to be_truthy
|
408
409
|
end
|
409
410
|
end
|
410
411
|
|
411
412
|
context 'is in progress' do
|
412
413
|
it 'returns false' do
|
413
|
-
running_transition.completed
|
414
|
+
expect(running_transition.completed?).to be_falsey
|
414
415
|
end
|
415
416
|
end
|
416
417
|
|
417
418
|
context 'is not progress' do
|
418
419
|
it 'returns false' do
|
419
|
-
empty_transition.completed
|
420
|
+
expect(empty_transition.completed?).to be_falsey
|
420
421
|
end
|
421
422
|
end
|
422
423
|
end
|
@@ -425,12 +426,12 @@ describe Arachni::Page::DOM::Transition do
|
|
425
426
|
describe '#to_hash' do
|
426
427
|
it 'returns a hash representation of the transition' do
|
427
428
|
hash = completed_transition.to_hash
|
428
|
-
hash.delete(:time).
|
429
|
-
hash.
|
429
|
+
expect(hash.delete(:time)).to be_kind_of Float
|
430
|
+
expect(hash).to eq({
|
430
431
|
element: :page,
|
431
432
|
event: :load,
|
432
433
|
options: completed_transition.options
|
433
|
-
}
|
434
|
+
})
|
434
435
|
end
|
435
436
|
|
436
437
|
context "when #element is an #{Arachni::Browser::ElementLocator}" do
|
@@ -439,28 +440,29 @@ describe Arachni::Page::DOM::Transition do
|
|
439
440
|
'<div id="my-div" onclick="addForm();">'
|
440
441
|
)
|
441
442
|
|
442
|
-
described_class.new( element, :load ).to_hash.
|
443
|
+
expect(described_class.new( element, :load ).to_hash).to eq({
|
443
444
|
element: element.to_h,
|
444
445
|
event: :load,
|
445
446
|
options: {},
|
446
447
|
time: nil
|
447
|
-
}
|
448
|
+
})
|
448
449
|
end
|
449
450
|
end
|
450
451
|
end
|
451
452
|
|
452
453
|
describe '#to_s' do
|
453
454
|
it 'returns a string representation of the transition' do
|
454
|
-
completed_transition.to_s.
|
455
|
+
expect(completed_transition.to_s).to eq(
|
455
456
|
"[#{completed_transition.time.to_f}s] " <<
|
456
457
|
"'#{completed_transition.event}' on:" <<
|
457
458
|
" #{completed_transition.element}"
|
459
|
+
)
|
458
460
|
end
|
459
461
|
end
|
460
462
|
|
461
463
|
describe '#dup' do
|
462
464
|
it 'returns a copy of the transition' do
|
463
|
-
subject.dup.
|
465
|
+
expect(subject.dup).to eq(subject)
|
464
466
|
end
|
465
467
|
end
|
466
468
|
|
@@ -468,7 +470,7 @@ describe Arachni::Page::DOM::Transition do
|
|
468
470
|
context 'when 2 transitions are identical' do
|
469
471
|
it 'returns true' do
|
470
472
|
args = [:page, :load, { extra: :options }]
|
471
|
-
described_class.new( *args ).
|
473
|
+
expect(described_class.new( *args )).to eq(described_class.new( *args ))
|
472
474
|
end
|
473
475
|
end
|
474
476
|
|
@@ -480,10 +482,10 @@ describe Arachni::Page::DOM::Transition do
|
|
480
482
|
args3 = [:page1, :load, { extra: :options }]
|
481
483
|
args4 = [:page, :load, { extra1: :options }]
|
482
484
|
|
483
|
-
described_class.new( *args ).
|
484
|
-
described_class.new( *args ).
|
485
|
-
described_class.new( *args ).
|
486
|
-
described_class.new( *args ).
|
485
|
+
expect(described_class.new( *args )).not_to eq(described_class.new( *args1 ))
|
486
|
+
expect(described_class.new( *args )).not_to eq(described_class.new( *args2 ))
|
487
|
+
expect(described_class.new( *args )).not_to eq(described_class.new( *args3 ))
|
488
|
+
expect(described_class.new( *args )).not_to eq(described_class.new( *args4 ))
|
487
489
|
end
|
488
490
|
end
|
489
491
|
end
|
@@ -492,7 +494,7 @@ describe Arachni::Page::DOM::Transition do
|
|
492
494
|
context 'when 2 transitions are identical' do
|
493
495
|
it 'returns the same value' do
|
494
496
|
args = [:page, :load, { extra: :options }]
|
495
|
-
described_class.new( *args ).hash.
|
497
|
+
expect(described_class.new( *args ).hash).to eq(described_class.new( *args ).hash)
|
496
498
|
end
|
497
499
|
end
|
498
500
|
|
@@ -504,10 +506,10 @@ describe Arachni::Page::DOM::Transition do
|
|
504
506
|
args3 = [:page1, :load, { extra: :options }]
|
505
507
|
args4 = [:page, :load, { extra1: :options }]
|
506
508
|
|
507
|
-
described_class.new( *args ).hash.
|
508
|
-
described_class.new( *args ).hash.
|
509
|
-
described_class.new( *args ).hash.
|
510
|
-
described_class.new( *args ).hash.
|
509
|
+
expect(described_class.new( *args ).hash).not_to eq(described_class.new( *args1 ).hash)
|
510
|
+
expect(described_class.new( *args ).hash).not_to eq(described_class.new( *args2 ).hash)
|
511
|
+
expect(described_class.new( *args ).hash).not_to eq(described_class.new( *args3 ).hash)
|
512
|
+
expect(described_class.new( *args ).hash).not_to eq(described_class.new( *args4 ).hash)
|
511
513
|
end
|
512
514
|
end
|
513
515
|
end
|
@@ -36,7 +36,7 @@ describe Arachni::Page::DOM do
|
|
36
36
|
subject { dom }
|
37
37
|
|
38
38
|
it "supports #{Arachni::RPC::Serializer}" do
|
39
|
-
subject.
|
39
|
+
expect(subject).to eq(Arachni::RPC::Serializer.deep_clone( subject ))
|
40
40
|
end
|
41
41
|
|
42
42
|
describe '#to_rpc_data' do
|
@@ -44,18 +44,18 @@ describe Arachni::Page::DOM do
|
|
44
44
|
|
45
45
|
%w(url digest).each do |attribute|
|
46
46
|
it "includes '#{attribute}'" do
|
47
|
-
data[attribute].
|
47
|
+
expect(data[attribute]).to eq(subject.send( attribute ))
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
%w(data_flow_sinks execution_flow_sinks).each do |attribute|
|
52
52
|
it "includes '#{attribute}'" do
|
53
|
-
data[attribute].
|
53
|
+
expect(data[attribute]).to eq(subject.send(attribute).map(&:to_rpc_data))
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
it "includes 'skip_states'" do
|
58
|
-
data['skip_states'].
|
58
|
+
expect(data['skip_states']).to eq(subject.skip_states.collection.to_a)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -66,20 +66,20 @@ describe Arachni::Page::DOM do
|
|
66
66
|
%w(url transitions digest skip_states data_flow_sinks
|
67
67
|
execution_flow_sinks).each do |attribute|
|
68
68
|
it "restores '#{attribute}'" do
|
69
|
-
restored.send( attribute ).
|
69
|
+
expect(restored.send( attribute )).to eq(subject.send( attribute ))
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
describe '#url' do
|
75
75
|
it 'defaults to the page URL' do
|
76
|
-
dom.url.
|
76
|
+
expect(dom.url).to eq(create_page.url)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
describe '#transitions' do
|
81
81
|
it 'defaults to an empty Array' do
|
82
|
-
empty_dom.transitions.
|
82
|
+
expect(empty_dom.transitions).to eq([])
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -93,17 +93,17 @@ describe Arachni::Page::DOM do
|
|
93
93
|
{ "<a href='javascript:clickMe();'>" => :click },
|
94
94
|
].map { |t| described_class::Transition.new *t.first }
|
95
95
|
|
96
|
-
dom.playable_transitions.
|
96
|
+
expect(dom.playable_transitions).to eq([
|
97
97
|
{ :page => :load },
|
98
98
|
{ "<body onload='loadStuff();'>" => :onload },
|
99
99
|
{ "<a href='javascript:clickMe();'>" => :click },
|
100
|
-
].map { |t| described_class::Transition.new *t.first }
|
100
|
+
].map { |t| described_class::Transition.new *t.first })
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
104
|
describe '#data_flow_sinks' do
|
105
105
|
it 'defaults to an empty Array' do
|
106
|
-
empty_dom.data_flow_sinks.
|
106
|
+
expect(empty_dom.data_flow_sinks).to eq([])
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -124,13 +124,13 @@ describe Arachni::Page::DOM do
|
|
124
124
|
]
|
125
125
|
|
126
126
|
dom.data_flow_sinks = sink
|
127
|
-
dom.data_flow_sinks.
|
127
|
+
expect(dom.data_flow_sinks).to eq(sink)
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
131
|
describe '#execution_flow_sinks' do
|
132
132
|
it 'defaults to an empty Array' do
|
133
|
-
empty_dom.execution_flow_sinks.
|
133
|
+
expect(empty_dom.execution_flow_sinks).to eq([])
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -151,7 +151,7 @@ describe Arachni::Page::DOM do
|
|
151
151
|
]
|
152
152
|
|
153
153
|
dom.execution_flow_sinks = sink
|
154
|
-
dom.execution_flow_sinks.
|
154
|
+
expect(dom.execution_flow_sinks).to eq(sink)
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
@@ -160,7 +160,7 @@ describe Arachni::Page::DOM do
|
|
160
160
|
transitions = [ { element: :stuffed } ]
|
161
161
|
|
162
162
|
dom.transitions = transitions
|
163
|
-
dom.transitions.
|
163
|
+
expect(dom.transitions).to eq(transitions)
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
@@ -169,7 +169,7 @@ describe Arachni::Page::DOM do
|
|
169
169
|
skip_states = Arachni::Support::LookUp::HashSet.new.tap { |h| h << 0 }
|
170
170
|
|
171
171
|
dom.skip_states = skip_states
|
172
|
-
dom.skip_states.
|
172
|
+
expect(dom.skip_states).to eq(skip_states)
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
@@ -183,7 +183,7 @@ describe Arachni::Page::DOM do
|
|
183
183
|
{ "<a href='javascript:clickMe();'>" => :click },
|
184
184
|
].map { |t| described_class::Transition.new *t.first }
|
185
185
|
|
186
|
-
dom.depth.
|
186
|
+
expect(dom.depth).to eq(3)
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
@@ -196,7 +196,7 @@ describe Arachni::Page::DOM do
|
|
196
196
|
empty_dom.push_transition described_class::Transition.new( *t.first )
|
197
197
|
end
|
198
198
|
|
199
|
-
empty_dom.transitions.
|
199
|
+
expect(empty_dom.transitions).to eq(transitions.map { |t| described_class::Transition.new *t.first })
|
200
200
|
end
|
201
201
|
end
|
202
202
|
|
@@ -221,17 +221,17 @@ describe Arachni::Page::DOM do
|
|
221
221
|
empty_dom.data_flow_sinks = data[:data_flow_sinks]
|
222
222
|
empty_dom.execution_flow_sinks = data[:execution_flow_sinks]
|
223
223
|
|
224
|
-
empty_dom.to_h.
|
224
|
+
expect(empty_dom.to_h).to eq({
|
225
225
|
url: data[:url],
|
226
226
|
transitions: data[:transitions].map(&:to_hash),
|
227
227
|
digest: empty_dom.digest,
|
228
228
|
skip_states: data[:skip_states],
|
229
229
|
data_flow_sinks: data[:data_flow_sinks].map(&:to_hash),
|
230
230
|
execution_flow_sinks: data[:execution_flow_sinks].map(&:to_hash)
|
231
|
-
}
|
231
|
+
})
|
232
232
|
end
|
233
233
|
it 'is aliased to #to_h' do
|
234
|
-
empty_dom.to_h.
|
234
|
+
expect(empty_dom.to_h).to eq(empty_dom.to_h)
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
@@ -243,10 +243,10 @@ describe Arachni::Page::DOM do
|
|
243
243
|
dom2 = empty_dom.dup
|
244
244
|
dom2.digest = 'stuff'
|
245
245
|
|
246
|
-
dom.hash.
|
246
|
+
expect(dom.hash).to eq(dom2.hash)
|
247
247
|
|
248
248
|
dom2.digest = 'other stuff'
|
249
|
-
dom.hash.
|
249
|
+
expect(dom.hash).not_to eq(dom2.hash)
|
250
250
|
end
|
251
251
|
end
|
252
252
|
|
@@ -259,15 +259,15 @@ describe Arachni::Page::DOM do
|
|
259
259
|
pages = browser.explore_and_flush
|
260
260
|
page = pages.last
|
261
261
|
|
262
|
-
page.url.
|
263
|
-
page.dom.url.
|
264
|
-
page.body.
|
262
|
+
expect(page.url).to eq(url)
|
263
|
+
expect(page.dom.url).to eq("#{url}#destination")
|
264
|
+
expect(page.body).to include 'final-vector'
|
265
265
|
|
266
266
|
page.dom.transitions.clear
|
267
|
-
page.dom.transitions.
|
267
|
+
expect(page.dom.transitions).to be_empty
|
268
268
|
|
269
269
|
browser.load page
|
270
|
-
browser.source.
|
270
|
+
expect(browser.source).to include 'final-vector'
|
271
271
|
end
|
272
272
|
end
|
273
273
|
|
@@ -278,29 +278,29 @@ describe Arachni::Page::DOM do
|
|
278
278
|
browser.load url
|
279
279
|
page = browser.explore_and_flush.last
|
280
280
|
|
281
|
-
page.url.
|
282
|
-
page.dom.url.
|
283
|
-
page.body.
|
281
|
+
expect(page.url).to eq(url)
|
282
|
+
expect(page.dom.url).to eq("#{url}#destination")
|
283
|
+
expect(page.body).to include 'final-vector'
|
284
284
|
|
285
285
|
browser.load page
|
286
|
-
browser.source.
|
286
|
+
expect(browser.source).to include 'final-vector'
|
287
287
|
|
288
288
|
page.dom.transitions.clear
|
289
|
-
page.dom.transitions.
|
289
|
+
expect(page.dom.transitions).to be_empty
|
290
290
|
|
291
291
|
browser.load page
|
292
|
-
browser.source.
|
292
|
+
expect(browser.source).not_to include 'final-vector'
|
293
293
|
end
|
294
294
|
end
|
295
295
|
|
296
296
|
context 'when a transition could not be replayed' do
|
297
297
|
it 'returns nil' do
|
298
|
-
Arachni::Page::DOM::Transition.
|
298
|
+
allow_any_instance_of(Arachni::Page::DOM::Transition).to receive(:play){ false }
|
299
299
|
|
300
300
|
browser.load "#{@url}restore/by-transitions"
|
301
301
|
page = browser.explore_and_flush.last
|
302
302
|
|
303
|
-
page.dom.restore( browser ).
|
303
|
+
expect(page.dom.restore( browser )).to be_nil
|
304
304
|
end
|
305
305
|
end
|
306
306
|
end
|