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
@@ -15,15 +15,16 @@ describe Arachni::Data::Framework::RPC do
|
|
15
15
|
|
16
16
|
describe '#distributed_page_queue' do
|
17
17
|
it "returns an instance of #{Arachni::Support::Database::Queue}" do
|
18
|
-
subject.distributed_page_queue.
|
18
|
+
expect(subject.distributed_page_queue).to be_kind_of Arachni::Support::Database::Queue
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe '#statistics' do
|
23
23
|
it 'includes #distributed_page_queue size' do
|
24
24
|
subject.distributed_page_queue << page
|
25
|
-
subject.statistics[:distributed_page_queue].
|
25
|
+
expect(subject.statistics[:distributed_page_queue]).to eq(
|
26
26
|
subject.distributed_page_queue.size
|
27
|
+
)
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
@@ -33,8 +34,8 @@ describe Arachni::Data::Framework::RPC do
|
|
33
34
|
subject.distributed_page_queue << page
|
34
35
|
subject.distributed_page_queue << page
|
35
36
|
|
36
|
-
subject.distributed_page_queue.buffer.
|
37
|
-
subject.distributed_page_queue.disk.size.
|
37
|
+
expect(subject.distributed_page_queue.buffer).to include page
|
38
|
+
expect(subject.distributed_page_queue.disk.size).to eq(1)
|
38
39
|
|
39
40
|
subject.dump( dump_directory )
|
40
41
|
|
@@ -42,7 +43,7 @@ describe Arachni::Data::Framework::RPC do
|
|
42
43
|
Dir["#{dump_directory}/distributed_page_queue/*"].each do |page_file|
|
43
44
|
pages << Marshal.load( IO.read( page_file ) )
|
44
45
|
end
|
45
|
-
pages.
|
46
|
+
expect(pages).to eq([page, page])
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
@@ -55,16 +56,16 @@ describe Arachni::Data::Framework::RPC do
|
|
55
56
|
subject.dump( dump_directory )
|
56
57
|
|
57
58
|
page_queue = described_class.load( dump_directory ).distributed_page_queue
|
58
|
-
page_queue.size.
|
59
|
-
page_queue.pop.
|
60
|
-
page_queue.pop.
|
59
|
+
expect(page_queue.size).to eq(2)
|
60
|
+
expect(page_queue.pop).to eq(page)
|
61
|
+
expect(page_queue.pop).to eq(page)
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
64
65
|
describe '#clear' do
|
65
66
|
%w(distributed_page_queue).each do |method|
|
66
67
|
it "clears ##{method}" do
|
67
|
-
subject.send(method).
|
68
|
+
expect(subject.send(method)).to receive(:clear)
|
68
69
|
subject.clear
|
69
70
|
end
|
70
71
|
end
|
@@ -18,58 +18,77 @@ describe Arachni::Data::Framework do
|
|
18
18
|
let(:statistics) { subject.statistics }
|
19
19
|
|
20
20
|
it "includes #{described_class::RPC}#statistics" do
|
21
|
-
statistics[:rpc].
|
21
|
+
expect(statistics[:rpc]).to eq(subject.rpc.statistics)
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'includes the #sitemap size' do
|
25
25
|
subject.add_page_to_sitemap page
|
26
26
|
|
27
|
-
statistics[:sitemap].
|
27
|
+
expect(statistics[:sitemap]).to eq(subject.sitemap.size)
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'includes the #page_queue size' do
|
31
31
|
subject.push_to_page_queue page
|
32
|
-
statistics[:page_queue].
|
32
|
+
expect(statistics[:page_queue]).to eq(subject.page_queue.size)
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'includes the #page_queue_total_size' do
|
36
36
|
subject.push_to_page_queue page
|
37
|
-
statistics[:page_queue_total_size].
|
37
|
+
expect(statistics[:page_queue_total_size]).to eq(subject.page_queue_total_size)
|
38
38
|
end
|
39
39
|
|
40
40
|
it 'includes the #url_queue size' do
|
41
41
|
subject.push_to_url_queue url
|
42
|
-
statistics[:url_queue_total_size].
|
42
|
+
expect(statistics[:url_queue_total_size]).to eq(subject.url_queue_total_size)
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'includes the #url_queue_total_size' do
|
46
46
|
subject.push_to_url_queue page
|
47
|
-
statistics[:url_queue_total_size].
|
47
|
+
expect(statistics[:url_queue_total_size]).to eq(subject.url_queue_total_size)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
describe '#rpc' do
|
52
52
|
it "returns an instance of #{described_class::RPC}" do
|
53
|
-
subject.rpc.
|
53
|
+
expect(subject.rpc).to be_kind_of described_class::RPC
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
describe '#sitemap' do
|
58
58
|
it 'returns a Hash' do
|
59
|
-
subject.sitemap.
|
59
|
+
expect(subject.sitemap).to be_kind_of Hash
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe '#page_queue' do
|
64
64
|
it "returns an instance of #{Arachni::Support::Database::Queue}" do
|
65
|
-
subject.page_queue.
|
65
|
+
expect(subject.page_queue).to be_kind_of Arachni::Support::Database::Queue
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
describe '#add_page_to_sitemap' do
|
70
70
|
it 'updates the sitemap with the given page' do
|
71
|
+
expect(subject).to receive(:update_sitemap).with( page.dom.url => page.code )
|
71
72
|
subject.add_page_to_sitemap page
|
72
|
-
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
describe '#update_sitemap' do
|
77
|
+
let(:url) { 'http://stuff/' }
|
78
|
+
let(:code) { 201 }
|
79
|
+
|
80
|
+
it 'updates the sitemap with the given data' do
|
81
|
+
subject.update_sitemap( url => code )
|
82
|
+
expect(subject.sitemap[url]).to eq(code)
|
83
|
+
end
|
84
|
+
|
85
|
+
context "when the URL includes #{Arachni::Utilities}.random_seed" do
|
86
|
+
let(:url) { super() + Arachni::Utilities.random_seed }
|
87
|
+
|
88
|
+
it 'is ignored' do
|
89
|
+
subject.update_sitemap( url => code )
|
90
|
+
expect(subject.sitemap).not_to include url
|
91
|
+
end
|
73
92
|
end
|
74
93
|
end
|
75
94
|
|
@@ -79,32 +98,32 @@ describe Arachni::Data::Framework do
|
|
79
98
|
end
|
80
99
|
|
81
100
|
it 'increments #page_queue_total_size' do
|
82
|
-
subject.page_queue_total_size.
|
101
|
+
expect(subject.page_queue_total_size).to eq(0)
|
83
102
|
subject.push_to_page_queue page
|
84
|
-
subject.page_queue_total_size.
|
103
|
+
expect(subject.page_queue_total_size).to eq(1)
|
85
104
|
end
|
86
105
|
|
87
106
|
it 'updates the sitemap' do
|
88
|
-
subject.
|
107
|
+
expect(subject).to receive(:add_page_to_sitemap).with(page)
|
89
108
|
subject.push_to_page_queue page
|
90
109
|
end
|
91
110
|
end
|
92
111
|
|
93
112
|
describe '#page_queue_total_size' do
|
94
113
|
it 'defaults to 0' do
|
95
|
-
subject.page_queue_total_size.
|
114
|
+
expect(subject.page_queue_total_size).to eq(0)
|
96
115
|
end
|
97
116
|
end
|
98
117
|
|
99
118
|
describe '#url_queue' do
|
100
119
|
it "returns an instance of #{Arachni::Support::Database::Queue}" do
|
101
|
-
subject.url_queue.
|
120
|
+
expect(subject.url_queue).to be_kind_of Arachni::Support::Database::Queue
|
102
121
|
end
|
103
122
|
end
|
104
123
|
|
105
124
|
describe '#url_queue_total_size' do
|
106
125
|
it 'defaults to 0' do
|
107
|
-
subject.url_queue_total_size.
|
126
|
+
expect(subject.url_queue_total_size).to eq(0)
|
108
127
|
end
|
109
128
|
end
|
110
129
|
|
@@ -114,25 +133,25 @@ describe Arachni::Data::Framework do
|
|
114
133
|
end
|
115
134
|
|
116
135
|
it 'increments #url_queue_total_size' do
|
117
|
-
subject.url_queue_total_size.
|
136
|
+
expect(subject.url_queue_total_size).to eq(0)
|
118
137
|
subject.push_to_url_queue url
|
119
|
-
subject.url_queue_total_size.
|
138
|
+
expect(subject.url_queue_total_size).to eq(1)
|
120
139
|
end
|
121
140
|
end
|
122
141
|
|
123
142
|
describe '#dump' do
|
124
143
|
it 'stores #rpc to disk' do
|
125
144
|
subject.dump( dump_directory )
|
126
|
-
described_class::RPC.load( "#{dump_directory}/rpc" ).
|
145
|
+
expect(described_class::RPC.load( "#{dump_directory}/rpc" )).to be_kind_of described_class::RPC
|
127
146
|
end
|
128
147
|
|
129
148
|
it 'stores #sitemap to disk' do
|
130
149
|
subject.sitemap[page.url] = page.code
|
131
150
|
subject.dump( dump_directory )
|
132
151
|
|
133
|
-
Marshal.load( IO.read( "#{dump_directory}/sitemap" ) ).
|
152
|
+
expect(Marshal.load( IO.read( "#{dump_directory}/sitemap" ) )).to eq({
|
134
153
|
page.url => page.code
|
135
|
-
}
|
154
|
+
})
|
136
155
|
end
|
137
156
|
|
138
157
|
it 'stores #page_queue to disk' do
|
@@ -140,8 +159,8 @@ describe Arachni::Data::Framework do
|
|
140
159
|
subject.push_to_page_queue page
|
141
160
|
subject.push_to_page_queue page
|
142
161
|
|
143
|
-
subject.page_queue.buffer.
|
144
|
-
subject.page_queue.disk.size.
|
162
|
+
expect(subject.page_queue.buffer).to include page
|
163
|
+
expect(subject.page_queue.disk.size).to eq(1)
|
145
164
|
|
146
165
|
subject.dump( dump_directory )
|
147
166
|
|
@@ -149,17 +168,17 @@ describe Arachni::Data::Framework do
|
|
149
168
|
Dir["#{dump_directory}/page_queue/*"].each do |page_file|
|
150
169
|
pages << Marshal.load( IO.read( page_file ) )
|
151
170
|
end
|
152
|
-
pages.
|
171
|
+
expect(pages).to eq([page, page])
|
153
172
|
end
|
154
173
|
|
155
174
|
it 'stores #page_queue_total_size to disk' do
|
156
175
|
subject.push_to_page_queue page
|
157
176
|
subject.push_to_page_queue page
|
158
|
-
subject.page_queue_total_size.
|
177
|
+
expect(subject.page_queue_total_size).to eq(2)
|
159
178
|
|
160
179
|
subject.dump( dump_directory )
|
161
180
|
|
162
|
-
Marshal.load( IO.read( "#{dump_directory}/page_queue_total_size" ) ).
|
181
|
+
expect(Marshal.load( IO.read( "#{dump_directory}/page_queue_total_size" ) )).to eq(2)
|
163
182
|
end
|
164
183
|
|
165
184
|
it 'stores #url_queue to disk' do
|
@@ -168,31 +187,31 @@ describe Arachni::Data::Framework do
|
|
168
187
|
|
169
188
|
subject.dump( dump_directory )
|
170
189
|
|
171
|
-
Marshal.load( IO.read( "#{dump_directory}/url_queue" ) ).
|
190
|
+
expect(Marshal.load( IO.read( "#{dump_directory}/url_queue" ) )).to eq([url, url])
|
172
191
|
end
|
173
192
|
|
174
193
|
it 'stores #url_queue_total_size to disk' do
|
175
194
|
subject.push_to_url_queue url
|
176
195
|
subject.push_to_url_queue url
|
177
|
-
subject.url_queue_total_size.
|
196
|
+
expect(subject.url_queue_total_size).to eq(2)
|
178
197
|
|
179
198
|
subject.dump( dump_directory )
|
180
199
|
|
181
|
-
Marshal.load( IO.read( "#{dump_directory}/url_queue_total_size" ) ).
|
200
|
+
expect(Marshal.load( IO.read( "#{dump_directory}/url_queue_total_size" ) )).to eq(2)
|
182
201
|
end
|
183
202
|
end
|
184
203
|
|
185
204
|
describe '.load' do
|
186
205
|
it 'loads #rpc from disk' do
|
187
206
|
subject.dump( dump_directory )
|
188
|
-
described_class.load( dump_directory ).rpc.
|
207
|
+
expect(described_class.load( dump_directory ).rpc).to be_kind_of described_class::RPC
|
189
208
|
end
|
190
209
|
|
191
210
|
it 'loads #sitemap from disk' do
|
192
211
|
subject.sitemap[page.url] = page.code
|
193
212
|
subject.dump( dump_directory )
|
194
213
|
|
195
|
-
described_class.load( dump_directory ).sitemap.
|
214
|
+
expect(described_class.load( dump_directory ).sitemap).to eq(subject.sitemap)
|
196
215
|
end
|
197
216
|
|
198
217
|
it 'loads #page_queue from disk' do
|
@@ -203,19 +222,19 @@ describe Arachni::Data::Framework do
|
|
203
222
|
subject.dump( dump_directory )
|
204
223
|
|
205
224
|
page_queue = described_class.load( dump_directory ).page_queue
|
206
|
-
page_queue.size.
|
207
|
-
page_queue.pop.
|
208
|
-
page_queue.pop.
|
225
|
+
expect(page_queue.size).to eq(2)
|
226
|
+
expect(page_queue.pop).to eq(page)
|
227
|
+
expect(page_queue.pop).to eq(page)
|
209
228
|
end
|
210
229
|
|
211
230
|
it 'loads #page_queue_total_size from disk' do
|
212
231
|
subject.push_to_page_queue page
|
213
232
|
subject.push_to_page_queue page
|
214
|
-
subject.page_queue_total_size.
|
233
|
+
expect(subject.page_queue_total_size).to eq(2)
|
215
234
|
|
216
235
|
subject.dump( dump_directory )
|
217
236
|
|
218
|
-
described_class.load( dump_directory ).page_queue_total_size.
|
237
|
+
expect(described_class.load( dump_directory ).page_queue_total_size).to eq(2)
|
219
238
|
end
|
220
239
|
|
221
240
|
it 'loads #url_queue from disk' do
|
@@ -225,42 +244,42 @@ describe Arachni::Data::Framework do
|
|
225
244
|
subject.dump( dump_directory )
|
226
245
|
|
227
246
|
url_queue = described_class.load( dump_directory ).url_queue
|
228
|
-
url_queue.size.
|
229
|
-
url_queue.pop.
|
230
|
-
url_queue.pop.
|
247
|
+
expect(url_queue.size).to eq(2)
|
248
|
+
expect(url_queue.pop).to eq(url)
|
249
|
+
expect(url_queue.pop).to eq(url)
|
231
250
|
end
|
232
251
|
|
233
252
|
it 'loads #url_queue_total_size from disk' do
|
234
253
|
subject.push_to_url_queue url
|
235
254
|
subject.push_to_url_queue url
|
236
|
-
subject.url_queue_total_size.
|
255
|
+
expect(subject.url_queue_total_size).to eq(2)
|
237
256
|
|
238
257
|
subject.dump( dump_directory )
|
239
258
|
|
240
|
-
described_class.load( dump_directory ).url_queue_total_size.
|
259
|
+
expect(described_class.load( dump_directory ).url_queue_total_size).to eq(2)
|
241
260
|
end
|
242
261
|
end
|
243
262
|
|
244
263
|
describe '#clear' do
|
245
264
|
%w(rpc sitemap page_queue url_queue).each do |method|
|
246
265
|
it "clears ##{method}" do
|
247
|
-
subject.send(method).
|
266
|
+
expect(subject.send(method)).to receive(:clear)
|
248
267
|
subject.clear
|
249
268
|
end
|
250
269
|
end
|
251
270
|
|
252
271
|
it 'sets #page_queue_total_size to 0' do
|
253
272
|
subject.push_to_page_queue page
|
254
|
-
subject.page_queue_total_size.
|
273
|
+
expect(subject.page_queue_total_size).to eq(1)
|
255
274
|
subject.clear
|
256
|
-
subject.page_queue_total_size.
|
275
|
+
expect(subject.page_queue_total_size).to eq(0)
|
257
276
|
end
|
258
277
|
|
259
278
|
it 'sets #url_queue_total_size to 0' do
|
260
279
|
subject.push_to_url_queue page.url
|
261
|
-
subject.url_queue_total_size.
|
280
|
+
expect(subject.url_queue_total_size).to eq(1)
|
262
281
|
subject.clear
|
263
|
-
subject.url_queue_total_size.
|
282
|
+
expect(subject.url_queue_total_size).to eq(0)
|
264
283
|
end
|
265
284
|
end
|
266
285
|
end
|
@@ -59,52 +59,43 @@ describe Arachni::Data::Issues do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'includes the amount of total issues' do
|
62
|
-
statistics[:total].
|
62
|
+
expect(statistics[:total]).to eq(subject.size)
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'includes the amount of issues by severity' do
|
66
|
-
statistics[:by_severity].
|
66
|
+
expect(statistics[:by_severity]).to eq({
|
67
67
|
low: 1,
|
68
68
|
informational: 1,
|
69
69
|
high: 1,
|
70
70
|
medium: 1
|
71
|
-
}
|
71
|
+
})
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'includes the amount of issues by type' do
|
75
|
-
statistics[:by_type].
|
75
|
+
expect(statistics[:by_type]).to eq({
|
76
76
|
issue.name => 4
|
77
|
-
}
|
77
|
+
})
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'includes the amount of issues by check' do
|
81
|
-
statistics[:by_check].
|
81
|
+
expect(statistics[:by_check]).to eq({
|
82
82
|
issue.check[:shortname] => 4
|
83
|
-
}
|
83
|
+
})
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
87
|
describe '#<<' do
|
88
88
|
it 'registers an array of issues' do
|
89
89
|
subject << issue
|
90
|
-
subject.any
|
90
|
+
expect(subject.any?).to be_truthy
|
91
91
|
end
|
92
92
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
20.times { subject << i }
|
93
|
+
it 'does not register duplicate issues' do
|
94
|
+
i = issue.deep_clone
|
95
|
+
i.vector.affected_input_name = 'some input'
|
96
|
+
20.times { subject << i }
|
98
97
|
|
99
|
-
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'when an issue was not discovered by manipulating an input' do
|
104
|
-
it 'registers it multiple times' do
|
105
|
-
20.times { subject << issue }
|
106
|
-
subject.flatten.size.should == 20
|
107
|
-
end
|
98
|
+
expect(subject.size).to eq(1)
|
108
99
|
end
|
109
100
|
end
|
110
101
|
|
@@ -113,7 +104,7 @@ describe Arachni::Data::Issues do
|
|
113
104
|
callback_called = 0
|
114
105
|
subject.on_new { callback_called += 1 }
|
115
106
|
10.times { subject << active_issue }
|
116
|
-
callback_called.
|
107
|
+
expect(callback_called).to eq(1)
|
117
108
|
end
|
118
109
|
end
|
119
110
|
|
@@ -122,7 +113,7 @@ describe Arachni::Data::Issues do
|
|
122
113
|
callback_called = 0
|
123
114
|
subject.on_new_pre_deduplication { callback_called += 1 }
|
124
115
|
10.times { subject << issue }
|
125
|
-
callback_called.
|
116
|
+
expect(callback_called).to eq(10)
|
126
117
|
end
|
127
118
|
end
|
128
119
|
|
@@ -130,56 +121,28 @@ describe Arachni::Data::Issues do
|
|
130
121
|
it 'does not store results' do
|
131
122
|
subject.do_not_store
|
132
123
|
subject << issue
|
133
|
-
subject.empty
|
124
|
+
expect(subject.empty?).to be_truthy
|
134
125
|
end
|
135
126
|
end
|
136
127
|
|
137
128
|
describe '#all' do
|
138
129
|
it 'returns all issues' do
|
139
130
|
subject << issue
|
140
|
-
subject.all.
|
141
|
-
end
|
142
|
-
|
143
|
-
it 'groups issues as variations' do
|
144
|
-
20.times { subject << issue }
|
145
|
-
|
146
|
-
all = subject.all
|
147
|
-
first = all.first
|
148
|
-
|
149
|
-
all.should == [issue]
|
150
|
-
first.variations.size.should == 20
|
151
|
-
first.variations.first.should == issue
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
describe '#summary' do
|
156
|
-
it 'returns first variation of all issues as solo versions' do
|
157
|
-
unsorted_issues.each { |i| subject << i }
|
158
|
-
subject.summary.should == sorted_issues
|
159
|
-
subject.summary.map(&:solo?).uniq.should == [true]
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
describe '#flatten' do
|
164
|
-
it 'returns all issues as solo versions' do
|
165
|
-
20.times { subject << issue }
|
166
|
-
subject.flatten.size.should == 20
|
167
|
-
subject.flatten.first.should == issue
|
168
|
-
subject.flatten.map(&:solo?).uniq.should == [true]
|
131
|
+
expect(subject.all).to eq([issue])
|
169
132
|
end
|
170
133
|
end
|
171
134
|
|
172
135
|
describe '#[]' do
|
173
136
|
it 'provides access to issues by their #digest' do
|
174
137
|
subject << issue
|
175
|
-
subject[issue.digest].
|
138
|
+
expect(subject[issue.digest]).to eq(issue)
|
176
139
|
end
|
177
140
|
end
|
178
141
|
|
179
142
|
describe '#sort'do
|
180
143
|
it 'returns a sorted array of Issues' do
|
181
144
|
unsorted_issues.each { |i| subject << i }
|
182
|
-
subject.sort.
|
145
|
+
expect(subject.sort).to eq(sorted_issues)
|
183
146
|
end
|
184
147
|
end
|
185
148
|
|
@@ -188,14 +151,14 @@ describe Arachni::Data::Issues do
|
|
188
151
|
subject << issue
|
189
152
|
issues = []
|
190
153
|
subject.each { |i| issues << i }
|
191
|
-
issues.
|
154
|
+
expect(issues).to eq([issue])
|
192
155
|
end
|
193
156
|
end
|
194
157
|
|
195
158
|
describe '#map' do
|
196
159
|
it 'passes each issue to the given block' do
|
197
160
|
subject << issue
|
198
|
-
subject.map { |i| i.severity }.
|
161
|
+
expect(subject.map { |i| i.severity }).to eq([issue.severity])
|
199
162
|
end
|
200
163
|
end
|
201
164
|
|
@@ -203,7 +166,7 @@ describe Arachni::Data::Issues do
|
|
203
166
|
it 'returns the first issue' do
|
204
167
|
subject << issue_low_severity
|
205
168
|
subject << issue_high_severity
|
206
|
-
subject.first.
|
169
|
+
expect(subject.first).to eq(issue_low_severity)
|
207
170
|
end
|
208
171
|
end
|
209
172
|
|
@@ -211,7 +174,7 @@ describe Arachni::Data::Issues do
|
|
211
174
|
it 'returns the last issue' do
|
212
175
|
subject << issue_low_severity
|
213
176
|
subject << issue_high_severity
|
214
|
-
subject.last.
|
177
|
+
expect(subject.last).to eq(issue_high_severity)
|
215
178
|
end
|
216
179
|
end
|
217
180
|
|
@@ -222,7 +185,7 @@ describe Arachni::Data::Issues do
|
|
222
185
|
context 'and it includes the given issue' do
|
223
186
|
it 'returns true' do
|
224
187
|
subject << issue
|
225
|
-
subject.
|
188
|
+
expect(subject).to include issue
|
226
189
|
end
|
227
190
|
end
|
228
191
|
end
|
@@ -230,14 +193,14 @@ describe Arachni::Data::Issues do
|
|
230
193
|
context 'when it includes the given issue' do
|
231
194
|
it 'returns true' do
|
232
195
|
subject << issue
|
233
|
-
subject.
|
196
|
+
expect(subject).to include issue
|
234
197
|
end
|
235
198
|
end
|
236
199
|
|
237
200
|
context 'when it does not includes the given issue' do
|
238
201
|
it 'returns true' do
|
239
202
|
subject << active_issue
|
240
|
-
subject.
|
203
|
+
expect(subject).not_to include issue
|
241
204
|
end
|
242
205
|
end
|
243
206
|
end
|
@@ -246,13 +209,13 @@ describe Arachni::Data::Issues do
|
|
246
209
|
context 'when there are issues' do
|
247
210
|
it 'returns true' do
|
248
211
|
subject << issue
|
249
|
-
subject.
|
212
|
+
expect(subject).to be_any
|
250
213
|
end
|
251
214
|
end
|
252
215
|
|
253
216
|
context 'when there are no issues' do
|
254
217
|
it 'returns false' do
|
255
|
-
subject.
|
218
|
+
expect(subject).not_to be_any
|
256
219
|
end
|
257
220
|
end
|
258
221
|
end
|
@@ -260,14 +223,14 @@ describe Arachni::Data::Issues do
|
|
260
223
|
describe '#empty?' do
|
261
224
|
context 'when there are no issues' do
|
262
225
|
it 'returns true' do
|
263
|
-
subject.
|
226
|
+
expect(subject).to be_empty
|
264
227
|
end
|
265
228
|
end
|
266
229
|
|
267
230
|
context 'when there are issues' do
|
268
231
|
it 'returns false' do
|
269
232
|
subject << issue
|
270
|
-
subject.
|
233
|
+
expect(subject).not_to be_empty
|
271
234
|
end
|
272
235
|
end
|
273
236
|
end
|
@@ -276,7 +239,7 @@ describe Arachni::Data::Issues do
|
|
276
239
|
it 'returns the amount of issues' do
|
277
240
|
subject << issue
|
278
241
|
subject << active_issue
|
279
|
-
subject.size.
|
242
|
+
expect(subject.size).to eq(2)
|
280
243
|
end
|
281
244
|
end
|
282
245
|
|
@@ -287,11 +250,10 @@ describe Arachni::Data::Issues do
|
|
287
250
|
|
288
251
|
subject.each do |issue|
|
289
252
|
issue_path = "#{dump_directory}/issue_#{issue.digest}"
|
290
|
-
File.exists?( issue_path ).
|
253
|
+
expect(File.exists?( issue_path )).to be_truthy
|
291
254
|
|
292
255
|
loaded_issue = Marshal.load( IO.read( issue_path ) )
|
293
|
-
issue.
|
294
|
-
issue.variations.should == loaded_issue.variations
|
256
|
+
expect(issue).to eq(loaded_issue)
|
295
257
|
end
|
296
258
|
end
|
297
259
|
|
@@ -299,7 +261,7 @@ describe Arachni::Data::Issues do
|
|
299
261
|
unsorted_issues.each { |i| subject << i }
|
300
262
|
subject.dump( dump_directory )
|
301
263
|
|
302
|
-
subject.digests.
|
264
|
+
expect(subject.digests).to eq(Marshal.load( IO.read( "#{dump_directory}/digests" ) ))
|
303
265
|
end
|
304
266
|
end
|
305
267
|
|
@@ -308,14 +270,14 @@ describe Arachni::Data::Issues do
|
|
308
270
|
unsorted_issues.each { |i| subject << i }
|
309
271
|
subject.dump( dump_directory )
|
310
272
|
|
311
|
-
subject.
|
273
|
+
expect(subject).to eq(described_class.load( dump_directory ))
|
312
274
|
end
|
313
275
|
|
314
276
|
it 'restores digests from disk' do
|
315
277
|
unsorted_issues.each { |i| subject << i }
|
316
278
|
subject.dump( dump_directory )
|
317
279
|
|
318
|
-
subject.digests.
|
280
|
+
expect(subject.digests).to eq(described_class.load( dump_directory ).digests)
|
319
281
|
end
|
320
282
|
end
|
321
283
|
|
@@ -323,7 +285,7 @@ describe Arachni::Data::Issues do
|
|
323
285
|
it 'clears the collection' do
|
324
286
|
subject << issue
|
325
287
|
subject.clear
|
326
|
-
subject.
|
288
|
+
expect(subject).to be_empty
|
327
289
|
end
|
328
290
|
|
329
291
|
it 'clears #on_new callbacks' do
|
@@ -332,7 +294,7 @@ describe Arachni::Data::Issues do
|
|
332
294
|
subject.clear
|
333
295
|
|
334
296
|
10.times { subject << active_issue }
|
335
|
-
callback_called.
|
297
|
+
expect(callback_called).to eq(0)
|
336
298
|
end
|
337
299
|
|
338
300
|
it 'clears #on_new_pre_deduplication callbacks' do
|
@@ -341,7 +303,7 @@ describe Arachni::Data::Issues do
|
|
341
303
|
subject.clear
|
342
304
|
|
343
305
|
10.times { subject << active_issue }
|
344
|
-
callback_called.
|
306
|
+
expect(callback_called).to eq(0)
|
345
307
|
end
|
346
308
|
end
|
347
309
|
end
|