Merge tests/location-checkaccess (#580) into the integration for the candidates

This commit is contained in:
feder-cr committed 2026-11-23 21:06:48 +01:00
commit 87f26ec99d
11 files changed
+1003 -152

No files matched your search

+11
View File
@@ -796,6 +796,14 @@ jobs:
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
# Windows' own answer for the user of the job: the question stock Firefox asks before it starts the Windows provider (AppCapability "location"
# CheckAccess, dom/geolocation/GeolocationSystemWin.cpp). Read, not presumed: printed before and after, and red unless it is Allowed after
# (run 45206303882: on windows-2025 the keys said Allow and stock Firefox did not start the provider). WinRT is read through Windows PowerShell.
$access = {
$answer = & powershell.exe -NoProfile -Command "`$null = [Windows.Security.Authorization.AppCapabilityAccess.AppCapability,Windows.Security.Authorization.AppCapabilityAccess,ContentType=WindowsRuntime]; [string][Windows.Security.Authorization.AppCapabilityAccess.AppCapability]::Create('location').CheckAccess()" 2>&1
($answer | Out-String).Trim()
}
"CheckAccess(location) before: $(& $access)"
$machine = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location'
$user = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\location'
foreach ($key in @($machine, $user, "$user\NonPackaged")) {
@@ -814,6 +822,9 @@ jobs:
"$key = $value"
}
"lfsvc: $($service.Status), $($service.StartType)"
$after = & $access
"CheckAccess(location) after: $after"
if ($after -ne 'Allowed') { $bad += "Windows answers CheckAccess(location) = $after, not Allowed" }
if ($bad) { throw ("the location service of the runner is not on: " + ($bad -join '; ')) }
- name: The security state (a fixed directory of the repository)
shell: bash
+2 -2
View File
@@ -14,8 +14,8 @@
{"id": "wrapper.e2e.fakeweb", "giro": "G2", "os": ["linux", "windows"], "min_tests": 7, "exact": true, "tests": ["tests/test_fakeweb_p2_e2e.py", "tests/test_fakeweb_p4_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The fake web, offline: our browser on the hard pages (profile P2: a reused routed page reaches networkidle every time, also under a load of three other browsers; the other site is another process) and on the 17-step journey of a person (profile P4: every step as stock, and every page left only once its noise is done), each judged against what stock Firefox does, as tests/fakeweb/pages.json declares it. 7 = 3 + 4 (the last two: a `load` that takes 20 s is a step that succeeds, and a `load` that never comes ends in an error that names the wait and the page). Stock itself is held to that declaration, and compared with ours step by step, by scripts/run_fakeweb.py in .github/workflows/fakeweb.yml. Needs the candidate binary (STEALTHFOX_E2E_BINARY)."},
{"id": "wrapper.e2e.fontconfig", "giro": "G2", "os": ["linux"], "min_tests": 2, "exact": true, "tests": ["tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py"], "marker": "e2e", "needs_root": false, "linux_only": "Fontconfig exists only on Linux: the parent of the engine shows <GRE>/fonts to it (FcConfigAppFontAddDir) to rebuild a font from a path and a face index. On Windows DirectWrite opens the file from its path, with no folder to scan and no cache to read, so this test has no Windows counterpart.", "note": "2 = (1) the stand-in that runs the engine under strace stays in the engine's place, as the core launches it (the leader of a process group of its own): a fake engine with a child, no browser; the process the launcher holds lives as long as the fake engine, and the group killed holds strace and the child (the stand-in that exec'd setsid forked and exited 0 at once: candidate 44161687675); (2) the warm launch of the parent reads the bundle from fontconfig's cache and does not scan it again (from firefox-66, engine_at_least). Two launches under strace with the same XDG_CACHE_HOME of the test, the first cold and the second warm: the cold parent opens every font file of <GRE>/fonts (the folder as the disk lists it) before any page and fontconfig writes its cache; the warm parent does not open every one of them, and it opens a *.cache-* file of fontconfig (a few files are opened to be used, so the verdict asks about the whole folder, as a scan does). Scan and drawing are told apart by position: only what the parent opens before the first page counts (the opens that draw are written as after_startup). Evidence in RUNNER_TEMP/invpw-evidence/fontconfig-cache: the interval and the number of opens of the bundle, the names of the files of the bundle each launch opened before the first page, the size of the cache file, the VmRSS of the parent after about:blank and after a page with every family, and a third launch with gfx.bundled-fonts.activate=0 (the behaviour before), which is evidence only. Needs strace on the runner: without it both are red, not skipped. No threshold."},
{"id": "wrapper.unit.compositing", "giro": "G1", "os": ["linux", "windows"], "min_tests": 30, "exact": true, "tests": ["tests/test_the_page_bytes_reference_compares_decoded_pixels.py"], "marker": "unit", "needs_root": false, "note": "The helpers of wrapper.e2e.compositing on known inputs, no browser: the PNG compared on decoded pixels (another deBG chunk and compression are the same, one pixel is not, every scanline filter), the comparison with a reference (changed, missing and extra keys named, the entry to record), the type of an engine process, an engine process known by its executable and not by the name it gives itself (Linux), and the CPU of a window, and the shape of the committed Windows reference, and the box cut out of a screenshot (its pixels, a box outside the picture refused, written as a PNG and read back, two boxes told apart by a pixel that is named, the pixels that are not grey)."},
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 3443, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_wire_method_is_served_or_refused.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_glean_ready.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_posix_pipe.pyLine truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 3444, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_wire_method_is_served_or_refused.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_glean_ready.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_transportLine truncated
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 3464, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_wire_method_is_served_or_refused.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_glean_ready.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_posix_pipe.pyLine truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 3465, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_wire_method_is_served_or_refused.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_glean_ready.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_transportLine truncated
{"id": "wrapper.e2e.securitystate", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "exact": true, "tests": ["tests/test_security_state_engine_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The security state the core declares, against the engine: the engine launched directly in its generate mode makes what it is given (the contract's result, security_state/ with the bytes of the full filter and of the delta, the core's own validation of it); a normal launch declares no pref of the mode and re-imports nothing; a certificate that Mozilla's CRLite test data say is revoked in a delta is refused at the first navigation (SEC_ERROR_REVOKED_CERTIFICATE) while a valid one loads, and the revoked one loads when the ready directory has no data; a ready directory with no or an empty security_state/ starts. Certificates made on the run (a fresh root trusted in cert9.db by the engine's own xpcshell, Mozilla's default test key as the key of CN=int), servers on loopback, no network. Red on firefox-67 (no generate mode)."},
{"id": "wrapper.e2e.suite.linux.1", "giro": "G2", "os": ["linux"], "min_tests": 415, "exact": true, "tests": ["tests/test_a_closed_browser_leaves_the_others_alone_e2e.py", "tests/test_a_context_that_ends_leaves_no_process_e2e.py", "tests/test_a_cors_preflight_is_not_a_request_of_the_page_e2e.py", "tests/test_a_declared_webgl_extension_survives_its_use_e2e.py", "tests/test_a_granted_permission_is_the_one_the_page_asks_for_e2e.py", "tests/test_a_held_ice_port_blinds_the_loopback_checks_e2e.py", "tests/test_a_launch_without_a_session_gets_one_e2e.py", "tests/test_a_left_documents_body_is_evicted_e2e.py", "tests/test_a_mouse_click_makes_one_mousemove_on_its_point_e2e.py", "tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py", "tests/test_a_screenshot_honours_its_scale_e2e.py", "tests/test_a_served_browser_answers_a_plain_client_e2e.py", "tests/test_a_tiny_download_on_a_served_browser_is_saved_e2e.py", "tests/test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py", "tests/test_accept_language_on_the_wire_e2e.py", "tests/test_browser_output_is_drained.py", "tests/test_click_rhythm.py", "tests/test_closing_one_of_four_browsers_does_not_hold_the_loop_e2e.py", "tests/test_control_a_selects_all_in_a_field_e2e.py", "tests/test_cross_origin_iframe.py", "tests/test_declared_host_network_e2e.py", "tests/test_detectors_e2e.py", "tests/test_e2e.py", "tests/test_element_handle_actions.py", "tests/test_element_screenshot_e2e.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_file_chooser.py", "tests/test_fingerprint_surface.py", "tests/test_fission_frames_history_and_processes_e2e.py", "tests/test_fission_frames_workers_storage_and_special_frames_e2e.py", "tests/test_frames_outlive_the_back_forward_cache_e2e.py", "tests/test_goto_networkidle_after_spa_e2e.py", "tests/test_goto_script_redirect_e2e.py", "tests/test_hidden_display_linux.py", "tests/test_ice_names_by_the_context_proxy_e2e.py::test_the_ice_name_of_a_context_goes_by_the_proxy_of_that_context", "tests/test_ignore_https_errors_e2e.py", "tests/test_injected_node_surface.py", "tests/test_juggler_connection.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_navigation_across_processes_e2e.py", "tests/test_navigation_response.py", "tests/test_networkidle_reaches_the_client_e2e.py", "tests/test_oop_frame_element.py", "tests/test_oop_frame_geometry.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pointer_position.py", "tests/test_popups_reach_the_client_e2e.py", "tests/test_preload_newtab_turns_the_privileged_about_process_off_e2e.py", "tests/test_realness_behind_a_declared_exit_e2e.py", "tests/test_resolver_race_e2e.py", "tests/test_route_header_order_e2e.py", "tests/test_same_document_goto_e2e.py", "tests/test_screencast.py", "tests/test_screencast_stop_e2e.py", "tests/test_screenshot_looks_where_you_are.py", "tests/test_security_state_engine_e2e.py", "tests/test_service_worker.py", "tests/test_service_worker_controller_e2e.py", "tests/test_set_offline_e2e.py", "tests/test_shadow_trusted_input.py", "tests/test_strict_and_force.py", "tests/test_the_callers_code_is_not_counted_e2e.py", "tests/test_the_device_enumeration_takes_the_declared_time_e2e.py", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_a_launch_scans_no_process_of_the_machine", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_after_close_no_process_of_the_session_is_left", "tests/test_the_hosts_file_of_the_host_is_never_read_e2e.py", "tests/test_trial_does_not_act.py", "tests/test_turn_over_tcp_is_tried_for_real_e2e.py", "tests/test_ua_widget_not_selectable.py", "tests/test_voices_e2e.py", "tests/test_wait_for_function.py", "tests/test_webgl_draws_on_the_engine_s_own_gl_e2e.py", "tests/test_webgl_noise_active.py", "tests/test_webrtc_realness.py::test_a_gateway_that_is_far_away_still_gives_the_page_a_srflx_born_through_its_relay", "tests/test_webrtc_realness.py::test_a_gather_after_the_page_loaded_through_the_gateway_costs_only_the_road_to_the_server", "tests/test_webrtc_realness.py::test_a_host_with_ipv6_addresses_gathers_through_an_ipv4_relay", "tests/test_webrtc_realness.py::test_a_proxy_that_does_not_relay_udp_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_relay_never_answers_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_udp_leaves_from_another_address_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_not_blocked_behind_tcp_only_socks", "tests/test_webrtc_realness.py::test_the_first_candidate_of_a_gather_does_not_wait_for_a_gateway_that_is_far_away", "tests/test_webrtc_realness.py::test_the_turn_over_tcp_of_a_context_goes_through_the_proxy_of_that_context", "tests/test_webrtc_realness.py::test_Line truncated
{"id": "wrapper.e2e.suite.linux.2", "giro": "G2", "os": ["linux"], "min_tests": 414, "exact": true, "tests": ["tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py", "tests/test_a_context_init_script_runs_once_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_goto_to_a_response_with_no_document_ends_e2e.py", "tests/test_a_keepalive_request_reaches_the_client_e2e.py", "tests/test_a_latin_letter_on_a_cyrillic_persona_e2e.py", "tests/test_a_page_cannot_probe_the_juggler_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_worker_comes_back_with_its_page_from_the_cache_e2e.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_isolated_page_and_the_next_e2e.py", "tests/test_bypass_csp_e2e.py", "tests/test_caller_world_handles_e2e.py", "tests/test_canvas_reads_as_drawn.py", "tests/test_canvas_render_stealth.py", "tests/test_context_locale_e2e.py", "tests/test_context_proxy_only_resolves_by_doh_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_download_is_intercepted_e2e.py", "tests/test_drag_motion.py", "tests/test_expose_binding_e2e.py", "tests/test_fakeweb_p4_e2e.py", "tests/test_fingerprint_consistency.py", "tests/test_fission_frames_dialogs_downloads_popups_e2e.py", "tests/test_fission_frames_route_and_bindings_e2e.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fission_iframe_crash_e2e.py", "tests/test_fission_strategy1_bench.py", "tests/test_goto_to_the_same_url_e2e.py", "tests/test_http3_through_the_proxy_e2e.py", "tests/test_input_is_born_before_the_page_sees_it_e2e.py", "tests/test_juggler_actions.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py::test_a_javascript_that_THROWS_arrives_as_an_error_not_as_None", "tests/test_juggler_injected.py::test_actionability_DISTINGUISHES_instead_of_always_saying_yes", "tests/test_juggler_injected.py::test_reads_that_make_no_sense_are_REJECTED", "tests/test_juggler_injected.py::test_states_DISCRIMINATE_instead_of_always_saying_true", "tests/test_juggler_injected.py::test_the_DOM_READING_group", "tests/test_juggler_injected.py::test_the_selector_engines_respond", "tests/test_juggler_injected.py::test_the_text_reads", "tests/test_juggler_lifecycle_e2e.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_long_session_e2e.py", "tests/test_mouse.py", "tests/test_mouse_events_keep_their_values_e2e.py", "tests/test_new_page_defaults.py", "tests/test_popup_destinations_e2e.py", "tests/test_popup_pages.py", "tests/test_proxy_http_auth_e2e.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_proxy_socks_auth_e2e.py", "tests/test_requestless_navigation.py", "tests/test_route_abort_code.py", "tests/test_route_e2e.py", "tests/test_route_post_data_e2e.py", "tests/test_route_sends_a_navigation_elsewhere_e2e.py", "tests/test_route_superseded_e2e.py", "tests/test_same_document_navigation.py", "tests/test_screenshot_of_text_returns_linux_e2e.py", "tests/test_scroll_into_view.py", "tests/test_scroll_only_if_needed_e2e.py", "tests/test_service_workers_blocked.py", "tests/test_set_input_files_payloads.py", "tests/test_software_compositing_is_declared_e2e.py", "tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py", "tests/test_the_callers_code_runs_once_e2e.py", "tests/test_the_close_returns_when_the_browser_has_exited_e2e.py", "tests/test_the_favicon_stays_out_of_sight_e2e.py", "tests/test_the_font_list_is_the_bundle_e2e.py", "tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py", "tests/test_the_scheme_is_the_personas_e2e.py", "tests/test_the_whole_udp_chain_by_name_e2e.py::test_a_turn_srflx_by_name_arrives_through_the_relay_when_the_exit_of_the_lab_is_loopback", "tests/test_typing_a_character_without_a_key_e2e.py", "tests/test_wait_for_timeout.py", "tests/test_web_fonts_of_closed_contexts_e2e.py"], "marker": "e2e", "needs_root": false, "windows_twin": "wrapper.e2e.suite.windows.2", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 2 rows of linux are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 564 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapLine truncated
+250 -112
View File
@@ -15,15 +15,15 @@ On Linux the same step runs and its footprint is compared like the rest.
Three things are compared, over the whole trace:
* the processes, by KIND, from the command lines of the launch: the parent, `-contentproc` with its type, `-sandboxingKind N` and
`-isForBrowser` / `-notForBrowser`, and the helpers (glxtest, pingsender, ...) by what they ran. Every kind and its COUNT must be identical,
with one exception: for the content processes of type `tab` only the presence of the kind counts, because how many are alive follows the idle
time (a spare process is prelaunched after a delay and closed after a grace period);
* the files: every path the tree touched (opened, stat'ed, accessed, read as a link, executed), classified `ours` or `host`. ONE rule judges the host paths, in the A/A and in the
A/B, on Linux and on Windows, the system modules and the shortcut inventory included (`file_rule`): a path is red if and only if it is in ALL the measured launches (the warm-up and
the seeds) of one engine and in NO launch of the other (its idle launch included). Every other path that is not in the same share of the launches of both engines is LISTED, not judged: the log and the file
`not-judged-a-a.json` / `not-judged.json` of the artifact give, per path, in how many launches of how many each engine has it (measured and long) and the processes that touched it,
and mark `watch` the paths in at least half of the launches of one engine and in none of the other's. `ours` leaves the comparison as a class (OURS below: reading its own package is
not touching the host);
`-isForBrowser` / `-notForBrowser`, and the helpers (glxtest, pingsender, ...) by what they ran;
* the files: every path the tree touched (opened, stat'ed, accessed, read as a link, executed), classified `ours` or `host`. ONE rule judges the host paths AND the kinds of process
(`proc.<kind>`), in the A/A and in the A/B, on Linux and on Windows, the system modules and the shortcut inventory included (`file_rule`): a path, or a kind, is red if and only if it
is in ALL the measured launches (the warm-up and the seeds) of one engine and in NO launch of the other (its idle launch included). A kind counts by its presence, never by how many
processes of it a launch has (the content processes of type `tab` followed the idle time, and so does the start of Mozilla's pingsender). Every other path or kind that is not in the same
share of the launches of both engines is LISTED, not judged: the log and the file `not-judged-a-a.json` / `not-judged.json` of the artifact give, per path and per kind, in how many launches
of how many each engine has it (measured and long) and the processes that touched the path or spawned the kind, and mark `watch` the ones in at least half of the launches of one engine and
in none of the other's. `ours` leaves the comparison as a class (OURS
below: reading its own package is not touching the host);
* the network, per kind (Linux): every NETLINK socket the tree opens, by protocol (NETLINK_ROUTE, NETLINK_KOBJECT_UEVENT, ...), with the requests
it sends on it (RTM_GETLINK, RTM_GETADDR, ...) and the multicast groups it binds to, and every connect or send towards a PUBLIC address, with
the transport, the family, the address and the port. The SET per kind must be identical, no exception, like the host paths. A destination that
@@ -36,12 +36,12 @@ to blame (`by A: ... | B: ...`: who touched the path, who spawned the kind).
Each engine run starts with a discarded WARM-UP launch (the first seed), an experiment control and not an excuse: its trace is kept in the footprint and the
report lists what only the warm-up did (`WARMUP-ONLY`, per kind, per path and per net entry, with the process that did it), so that a first-launch-only behaviour (a
helper spawned at the first shutdown of a cold machine) stays visible from run to run. The measured launches are compared as they are: a kind or a count that differs
after the warm-up is red.
helper spawned at the first shutdown of a cold machine) stays visible from run to run. The measured launches are compared as they are: a path or a kind that one engine has in all of them
and the other in none is red.
The exit pings (`firefox --backgroundtask pingsender`, through the session's route, never the separate `pingsender[.exe]`) leave only when Mozilla's `canUpload()` is
true (TelemetrySend.sys.mjs:1083), which the core's declared terms of use make true from the start: in a measured launch their
number is 0 or 3 (the three pings of a first run, spawned by the parent), anything else is red. The paths only they touch are paths like any other (`file_rule`); the destinations only they reach are compared when they are
true (TelemetrySend.sys.mjs:1083), which the core's declared terms of use make true from the start; whether a launch starts them, and how many, varies from a launch to the next (run
45228081536: 3 in every launch of one run of the 68 and 3, 0, 2, 0, 3 in the other, the sockets they start in 3 launches and in none): their number, their types and what spawned them are listed, not judged (a pingsender kind is red by the rule of every kind). The paths only they touch are paths like any other (`file_rule`); the destinations only they reach are compared when they are
there on both sides of a launch, and left out when they are there on one side only (a destination is `public, telemetry`: the telemetry host is the third party's, and
whether the connection succeeded is not in the verdict). The IDLE launch of each engine run (a page, no pref changed, up to 120 s) is evidence: which pings leave in a long launch is not a rule until it is proven (the core declares
the terms of use accepted, so `canUpload()` is true from the start and the notification of the data policy is never recorded; Linux started 1 pingsender in it, Windows 0).
@@ -51,7 +51,9 @@ ACCEPTED LOSSES (the rule of the host paths trades them for a verdict that does
* a path that one engine has in every measured launch and the other in only some of them is not red: always against sometimes is listed, never judged;
* a reading tied to one seed is not judged: no path is compared seed by seed;
* what happens only in the long launch (idle) is only listed: judging it would take two idle launches per engine;
* the cause of the pingsender that starts in one launch of eight is not known: its paths are listed like the others, there is no rule and no preference for it;
* the cause of the variable start of the pingsender is not known: how many of it a launch has, and what it spawns, are listed, and red only by the rule of every kind (in all the measured launches of one engine and in none of the other's); no type of the pings is held, no preference for it;
* how many processes of a kind a launch has is not compared (a candidate that spawns two gpu processes where the 68 spawns one is not seen): only that a kind is there in every launch of one
engine and in none of the other's;
* a pid that Windows reuses may attribute to the engine the tools of the oracle itself, among the processes that touched a path.
How the trace is taken:
@@ -90,6 +92,10 @@ there and removed after the run): the browser's processes read the link of every
Declared differences (ci/ab-host-expected.json) are applied to the A/B only, never to the A/A, by kind, and one that does not show is red as stale. A declared `proc` difference covers the
process kind and the file leaves whose only toucher on the published side is that kind (a leaf another process touched too is still a difference).
Evidence of the tree (Windows): every launch (the warm-up, each seed, the idle launch and the stock control) saves the raw events of the audit that its tree was read from, the 4688 births
and the 4689 ends, the excluded ones as well, in `<footprint>.audit/<launch>-<seed>.json` (`audit_listing`: record id, event, pid, creator's pid, image, `ParentProcessName`, time, command
line, whether it is in the tree and why). It changes no verdict and is not a leaf of the footprint.
"""
from __future__ import annotations
@@ -186,13 +192,11 @@ TAB_REASON = ("the number of content processes of type tab follows the idle time
#: through the session's route, never as the separate `pingsender[.exe]`, which took its road from the host. Whether they leave at all is Mozilla's
#: `canUpload()` (TelemetrySend.sys.mjs:1083: `options.usePingSender && !this._isOSShutdown && TelemetryReportingPolicy.canUpload()`), true once the data-policy
#: notification was recorded (TelemetryReportingPolicy.sys.mjs:988 `_userNotified`, from `ensureUserIsNotified` at `sessionstore-windows-restored`, :1140-1175):
#: a launch that stays short may or may not have got there, so it has 0 of them or all 3 (the first run sends new-profile, first-shutdown and event; the shutdown
#: ping waits for the second session, TelemetrySession.sys.mjs:1011).
#: a launch that stays short may or may not have got there (the first run sends new-profile, first-shutdown and event; the shutdown ping waits for the second session,
#: TelemetrySession.sys.mjs:1011). Run 45228081536 (A/A of the 68, Windows): the pingsenders of the 68 were 3, 3, 3, 3, 3 in the seeds of one run and 3, 0, 2, 0, 3 in the other, and the
#: sockets they start (`socket<-pingsender`) 0 to 3: the start of Mozilla's pingsender is not the engine's to hold, so HOW MANY of them a launch has is listed, not judged.
PINGSENDER_KIND = "backgroundtask/pingsender"
PINGSENDER_EXES = ("pingsender", "pingsender.exe")
PING_TYPES = ("event", "first-shutdown", "new-profile")
PINGSENDER_COUNTS = (0, 3)
CAN_UPLOAD = "TelemetrySend.sys.mjs:1083"
#: The pref the policy writes when the notification is recorded (TelemetryUtils.sys.mjs:80, TelemetryReportingPolicy.sys.mjs:1025): the profile's prefs.js says
#: it, a file of the launch's own, so the precondition of the pings is observed without any channel into the engine.
NOTIFIED_PREF = "datareporting.policy.dataSubmissionPolicyNotifiedTime"
@@ -492,22 +496,10 @@ def ping_records(procs: dict, labels: dict, parents: dict, windows: bool) -> lis
def pingsender_problems(fp: dict) -> list:
"""What is wrong with the exit pings of one launch (a short measured launch, or the idle one asking `strict`): the separate executable ran, a number of
pingsenders that is not 0 or 3, three that are not the three pings of a first run or not spawned by the parent."""
kinds, out = fp.get("kinds", {}), []
for exe in PINGSENDER_EXES:
if kinds.get(exe):
out.append("the separate %s ran (B266: the pings leave as `firefox --backgroundtask pingsender`, through the session's route)" % exe)
n = kinds.get(PINGSENDER_KIND, 0)
if n not in PINGSENDER_COUNTS:
out.append("%d pingsender processes, not 0 or 3 (they leave only when canUpload is true, %s)" % (n, CAN_UPLOAD))
if n == 3:
records = [r for r in fp.get("pingsenders", []) if r["form"] == "backgroundtask"]
if sorted(str(r["type"]) for r in records) != list(PING_TYPES):
out.append("the three pingsenders are not the pings of a first run %s: %s" % (list(PING_TYPES), sorted(str(r["type"]) for r in records)))
if sorted({r["parent"] for r in records}) != ["parent"]:
out.append("the pingsenders were not all spawned by the parent: %s" % sorted({r["parent"] for r in records}))
return out
"""What is wrong with the exit pings of one launch: the separate executable ran. HOW MANY pingsenders a launch starts, of which type and spawned by whom, is not judged (it varies from
a launch to the next): it is listed with the other kinds (`file_rule`)."""
kinds = fp.get("kinds", {})
return ["the separate %s ran (B266: the pings leave as `firefox --backgroundtask pingsender`, through the session's route)" % exe for exe in PINGSENDER_EXES if kinds.get(exe)]
def privileged_problems(fp: dict) -> list:
@@ -530,8 +522,8 @@ def pingsender_destinations(fp: dict) -> list:
#: how many launches of how many each engine has them and the processes that touched them; the ones in at least half of the launches of one engine and in none of the other's are
#: marked `watch`.
NOT_JUDGED_FORMAT = "ab-host-not-judged/1"
NOT_JUDGED_REASON = ("a path in all the measured launches of one engine and in no launch of the other is red; the other paths that differ are listed, not judged; `watch` is a path "
"in at least half of the launches of one engine and in none of the other's")
NOT_JUDGED_REASON = ("a path, or a kind of process, in all the measured launches of one engine and in no launch of the other is red; the other paths and kinds that differ are listed, "
"not judged; `watch` is one in at least half of the launches of one engine and in none of the other's")
LISTED_IN_LOG = 50
@@ -542,25 +534,26 @@ def launches_of(fp: dict) -> list:
return out + [(name, False, fp[name]) for name in ("idle",) if fp.get(name)]
def path_table(fps: list) -> dict:
"""What the launches of ONE engine (the footprints of its runs) did to the host paths: `{"launches": {"measured": n, "long": n}, "paths": {path: {"measured": k,
"long": k}}, "by": {path: [kinds that touched it]}}`."""
launches, paths, by = {"measured": 0, "long": 0}, {}, {}
def presence_table(fps: list, items_of, by_of) -> dict:
"""What the launches of ONE engine (the footprints of its runs) have of a set of things: `{"launches": {"measured": n, "long": n}, "seen": {thing: {"measured": k, "long": k}},
"by": {thing: [who]}}`. `items_of(launch)` is the set of the things a launch has (host paths, kinds of process), `by_of(launch, thing)` who is to blame for it there."""
launches, seen, by = {"measured": 0, "long": 0}, {}, {}
for fp in fps:
for _name, measured, launch in launches_of(fp):
layer = "measured" if measured else "long"
launches[layer] += 1
for path in set(launch.get("files", [])):
paths.setdefault(path, {"measured": 0, "long": 0})[layer] += 1
by.setdefault(path, set()).update((launch.get("touched_by") or {}).get(path, []))
return {"launches": launches, "paths": paths, "by": {path: sorted(kinds) for path, kinds in by.items()}}
for thing in items_of(launch):
seen.setdefault(thing, {"measured": 0, "long": 0})[layer] += 1
by.setdefault(thing, set()).update(by_of(launch, thing))
return {"launches": launches, "seen": seen, "by": {thing: sorted(who) for thing, who in by.items()}}
def file_rule(a: dict, b: dict, a_a: bool, also_68=()) -> tuple:
"""`(red, not_judged)` of the host paths of two footprints, by the rule above. `red` is `{"A": [paths only A has, in all its measured launches], "B": [...]}`. `also_68`
are the other footprints of the engine of A in an A/B (the published engine measured twice): its launches are all of them the engine's."""
ta, tb = path_table([a, *also_68]), path_table([b])
red = {side: sorted(p for p, c in mine["paths"].items() if mine["launches"]["measured"] and c["measured"] == mine["launches"]["measured"] and p not in other["paths"])
def presence_rule(ta: dict, tb: dict, key: str, by_key: str) -> tuple:
"""`(red, entries)` of two `presence_table`s by the rule above, whatever the things are. `red` is `{"A": [things only A has, in all its measured launches], "B": [...]}`; the
entries are the other things that are not in the same share of the launches of both engines, `{key: thing, "watch", "A": {layer: [in n launches, of m]}, "B": ..., by_key: {"A": [who],
"B": [who]}}`, the ones to watch first."""
red = {side: sorted(p for p, c in mine["seen"].items()
if mine["launches"]["measured"] and c["measured"] == mine["launches"]["measured"] and p not in other["seen"])
for side, mine, other in (("A", ta, tb), ("B", tb, ta))}
judged = set(red["A"]) | set(red["B"])
every = {side: sum(t["launches"].values()) for side, t in (("A", ta), ("B", tb))}
@@ -569,18 +562,51 @@ def file_rule(a: dict, b: dict, a_a: bool, also_68=()) -> tuple:
return all(seen["A"][layer] * tb["launches"][layer] == seen["B"][layer] * ta["launches"][layer] for layer in ("measured", "long"))
entries = []
for path in sorted(set(ta["paths"]) | set(tb["paths"])):
if path in judged:
for thing in sorted(set(ta["seen"]) | set(tb["seen"])):
if thing in judged:
continue
seen = {side: t["paths"].get(path, {"measured": 0, "long": 0}) for side, t in (("A", ta), ("B", tb))}
seen = {side: t["seen"].get(thing, {"measured": 0, "long": 0}) for side, t in (("A", ta), ("B", tb))}
if same(seen):
continue # in the same share of the launches of both engines (every one of them, for a path that is there always): nothing to list
continue # in the same share of the launches of both engines (every one of them, for a thing that is there always): nothing to list
watch = any(sum(seen[mine].values()) * 2 >= every[mine] and not sum(seen[other].values()) for mine, other in (("A", "B"), ("B", "A")))
entries.append({"path": path, "watch": watch,
entries.append({key: thing, "watch": watch,
**{side: {layer: [seen[side][layer], t["launches"][layer]] for layer in ("measured", "long")} for side, t in (("A", ta), ("B", tb))},
"touched_by": {"A": ta["by"].get(path, []), "B": tb["by"].get(path, [])}})
entries.sort(key=lambda e: (not e["watch"], e["path"]))
return red, {"format": NOT_JUDGED_FORMAT, "mode": "a-a" if a_a else "a-b", "reason": NOT_JUDGED_REASON, "launches": {"A": ta["launches"], "B": tb["launches"]}, "paths": entries}
by_key: {"A": ta["by"].get(thing, []), "B": tb["by"].get(thing, [])}})
entries.sort(key=lambda e: (not e["watch"], e[key]))
return red, entries
def judged_kinds(launch: dict) -> set:
"""The kinds of process of a launch that the rule looks at: every kind that ran, as a kind and not by how many of it there are (a kind of type tab is by its presence like
the rest). Not here: the separate `pingsender[.exe]`, which is red where it is (`pingsender_problems`, `idle_problems`), and the preloaded about:newtab (PRIVILEGED_REASON:
absent or present per launch, never more than one, never compared between the sides)."""
return {kind for kind, n in launch.get("kinds", {}).items() if n and kind not in PINGSENDER_EXES and kind != PRIVILEGED}
def path_table(fps: list) -> dict:
"""The `presence_table` of the host paths of the launches of ONE engine, `"paths"` being what is `"seen"`."""
table = presence_table(fps, lambda launch: set(launch.get("files", [])), lambda launch, path: (launch.get("touched_by") or {}).get(path, []))
return dict(table, paths=table["seen"])
def kind_table(fps: list) -> dict:
"""The `presence_table` of the kinds of process of the launches of ONE engine (who is to blame for a kind: the kinds that spawned it)."""
return presence_table(fps, judged_kinds, lambda launch, kind: (launch.get("spawned_by") or {}).get(kind, []))
def file_rule(a: dict, b: dict, a_a: bool, also_68=()) -> tuple:
"""`(red, not_judged)` of two footprints, by the rule above, over the host paths and over the KINDS of process (`proc.<kind>`, presence only: not how many of a kind a launch has).
`red` is `{"files": {"A": [paths only A has, in all its measured launches], "B": [...]}, "kinds": {"A": [...], "B": [...]}}`. `also_68` are the other footprints of the engine of A in
an A/B (the published engine measured twice): its launches are all of them the engine's. `not_judged` is the document of the file `not-judged[-a-a].json`: the paths and the kinds that
differ and are not red."""
fa, fb = [a, *also_68], [b]
ta, tb = path_table(fa), path_table(fb)
ka, kb = kind_table(fa), kind_table(fb)
red_files, paths = presence_rule(ta, tb, "path", "touched_by")
red_kinds, kinds = presence_rule(ka, kb, "kind", "spawned_by")
return ({"files": red_files, "kinds": red_kinds},
{"format": NOT_JUDGED_FORMAT, "mode": "a-a" if a_a else "a-b", "reason": NOT_JUDGED_REASON, "launches": {"A": ta["launches"], "B": tb["launches"]},
"paths": paths, "kinds": kinds})
PRIVILEGED = "Privileged Cont"
@@ -1011,6 +1037,7 @@ def _read_lines(log: Path):
# Windows: the processes with their command lines (the audit, event 4688) and the files (an ETW session on Kernel-File).
AUDIT_GUID = "{0CCE922B-69AE-11D9-BED3-505054503030}" # the subcategory "Process Creation"
AUDIT_END_GUID = "{0CCE922C-69AE-11D9-BED3-505054503030}" # the subcategory "Process Termination" (event 4689): when each process ended
AUDIT_KEY = r"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit"
AUDIT_VALUE = "ProcessCreationIncludeCmdLine_Enabled"
FILE_PROVIDER, FILE_CREATE_KEYWORD = "Microsoft-Windows-Kernel-File", "0x80" # KERNEL_FILE_KEYWORD_CREATE
@@ -1065,7 +1092,8 @@ def _number(text: str) -> int:
def parse_audit_events(xml_text: str) -> list:
"""The process creations of what `wevtutil qe Security /f:xml` printed (event 4688, one `<Event>` after the other):
`[{"rid", "pid", "ppid", "image", "cmd"}]`, `ppid` being the creator's pid."""
`[{"rid", "pid", "ppid", "image", "parent_image", "cmd", "time"}]`, `ppid` being the creator's pid and `parent_image` the image the audit says that creator runs
('' when the event does not carry it)."""
body = re.sub(r"<\?xml[^>]*\?>", "", xml_text)
root = ET.fromstring("<Events>%s</Events>" % body)
out = []
@@ -1076,23 +1104,93 @@ def parse_audit_events(xml_text: str) -> list:
continue
when = next((e.get("SystemTime", "") for e in ev.iter() if e.tag.rsplit("}", 1)[-1] == "TimeCreated"), "")
out.append({"rid": rid, "pid": _number(data["NewProcessId"]), "ppid": _number(data.get("ProcessId", "")),
"image": data.get("NewProcessName", ""), "cmd": data.get("CommandLine", ""), "time": when})
"image": data.get("NewProcessName", ""), "parent_image": data.get("ParentProcessName", ""), "cmd": data.get("CommandLine", ""), "time": when})
return out
def process_tree(events, roots) -> list:
"""The events of `parse_audit_events` that are a root or come from a process of the tree, by the creator's pid each says, in their order."""
wanted, chosen, changed = set(roots), set(), True
floor = min((e.get("rid", 0) for e in events if e["pid"] in wanted), default=0) # a creator's pid that Windows reused: what came before the root is not its tree
events = [e for e in events if e.get("rid", 0) >= floor]
while changed:
changed = False
for i, e in enumerate(events):
if i not in chosen and (e["pid"] in wanted or e["ppid"] in wanted):
chosen.add(i)
wanted.add(e["pid"])
changed = True
return [events[i] for i in sorted(chosen)]
def parse_audit_ends(xml_text: str) -> list:
"""The process terminations of the same output (event 4689): `[{"rid", "pid", "image", "time"}]`, in the order of the log. A 4688 has no end in it: this is where the
end of a process is read (the listing of the audit of a launch says when each process of the tree ended)."""
body = re.sub(r"<\?xml[^>]*\?>", "", xml_text)
root = ET.fromstring("<Events>%s</Events>" % body)
out = []
for ev in root:
if next((e.text for e in ev.iter() if e.tag.rsplit("}", 1)[-1] == "EventID"), "") != "4689":
continue
data = {d.get("Name"): (d.text or "") for d in ev.iter() if d.tag.rsplit("}", 1)[-1] == "Data"}
rid = next((int(e.text) for e in ev.iter() if e.tag.rsplit("}", 1)[-1] == "EventRecordID" and e.text), 0)
when = next((e.get("SystemTime", "") for e in ev.iter() if e.tag.rsplit("}", 1)[-1] == "TimeCreated"), "")
if "ProcessId" in data:
out.append({"rid": rid, "pid": _number(data["ProcessId"]), "image": data.get("ProcessName", ""), "time": when})
return out
def walk_tree(events, roots, ends=()) -> list:
"""Every event of the audit (the 4688 births of `parse_audit_events` and the 4689 ends of `parse_audit_ends`), in the order of the log (`rid`, monotone), each with what the
tree made of it: `[{"event": 4688 or 4689, "record": the event, "in_tree": bool, "why": text}]`. `process_tree` is its births that are in the tree, and the audit file of a launch
(`audit_listing`) is the whole of it, the excluded events included.
Windows hands the pid of a process that ended to the next process it creates, so a pid is not a process: run 45221868374 (the idle launch of the 68) took into the tree
`svchost -s wlidsvc` (a service the service manager started, never ended: the tree "did not exit within 120 s", the A/A was broken), 7 `wevtutil` and 2 `wsl` (the oracle's own
tools), each born with a pid that an earlier process of the tree had had. The rule is the least that tells them apart (run 45228081536: the pingsender, born by the parent when
the parent was already at its end, was left out of the tree by a rule on the end of the creator, and the A/A of the 68 was red on a process that is the engine's):
- a process joins when its creator's pid is one of the tree (the creator was born in it) and, when both events say it, the image the audit gives for the creator is the image
the creator was born with; the END of the creator (4689) does not exclude it: a child that is registered after the end of its creator is the creator's;
- a pid of the tree stops being the tree's only when the same pid is BORN again as a process that does not join: the next birth of a pid is the process that has it;
- the root joins by its own pid (its creator is the oracle); what came before it is not its tree (a creator's pid that Windows reused).
The 4689 are read all the same: they say, in the listing, when each process of the tree ended."""
roots = set(roots)
floor = min((e.get("rid", 0) for e in events if e["pid"] in roots), default=0)
born = {e["pid"] for e in events if e["pid"] in roots and e.get("rid", 0) >= floor}
known = {pid: "" for pid in roots - born} # a root with no birth in the log was born before the audit: of the tree from the start, its image unknown
waiting = set(born)
moments = sorted([(e.get("rid", 0), 0, i, e) for i, e in enumerate(events)] + [(x.get("rid", 0), 1, i, x) for i, x in enumerate(ends)], key=lambda m: m[:3])
out = []
for rid, is_end, _i, e in moments:
if rid < floor:
out.append({"event": 4689 if is_end else 4688, "record": e, "in_tree": False, "why": "before the birth of the root: not its tree"})
continue
if is_end:
out.append({"event": 4689, "record": e, "in_tree": e["pid"] in known,
"why": "the end of a process of the tree" if e["pid"] in known else "the end of a process that is not in the tree"})
continue
creator = known.get(e["ppid"])
if e["pid"] in waiting:
waiting.discard(e["pid"])
joined, why = True, "the root of the launch (its creator is the oracle)"
elif e["ppid"] not in known:
joined, why = False, "its creator (pid %d) is not a process of the tree: it is a stranger that has this pid" % e["ppid"]
elif creator and e.get("parent_image") and _base(creator).lower() != _base(e["parent_image"]).lower():
joined, why = False, "the creator the audit names (%s) is not the image pid %d was born with (%s)" % (_base(e["parent_image"]), e["ppid"], _base(creator))
else:
joined, why = True, "created by pid %d, a process of the tree" % e["ppid"]
if joined:
known[e["pid"]] = e["image"]
else:
known.pop(e["pid"], None) # the pid is born again as a process that is not the tree's
out.append({"event": 4688, "record": e, "in_tree": joined, "why": why})
return out
def process_tree(events, roots, ends=()) -> list:
"""The events of `parse_audit_events` that are a root or were born from a process of the tree, in their order (the rule is in `walk_tree`)."""
return [m["record"] for m in walk_tree(events, roots, ends) if m["event"] == 4688 and m["in_tree"]]
AUDIT_FORMAT = "ab-host-audit/1"
def audit_listing(events, roots, ends, launch: str, seed: int) -> dict:
"""The audit of one Windows launch as a document: every event the tree was read from, the excluded ones as well (`walk_tree`), each with its record id, event (4688 or 4689), pid,
creator's pid, image, the image the audit names for the creator (`ParentProcessName`), time, and whether it is in the tree and why. Evidence for the next time a process is or
is not in a tree: it changes no verdict and is never a leaf of the footprint."""
rows = []
for m in walk_tree(events, roots, ends):
r = m["record"]
rows.append({"rid": r.get("rid", 0), "event": m["event"], "pid": r["pid"], "ppid": r.get("ppid") if m["event"] == 4688 else None,
"image": r.get("image", ""), "parent_image": r.get("parent_image", ""), "time": r.get("time", ""), "cmd": (r.get("cmd") or "")[:300],
"in_tree": m["in_tree"], "why": m["why"]})
return {"format": AUDIT_FORMAT, "launch": launch, "seed": seed, "roots": sorted(roots), "in_tree": sum(1 for r in rows if r["in_tree"]), "events": rows}
def windows_processes(tree, real: str) -> dict:
@@ -1194,6 +1292,9 @@ class WindowsTrace:
self.session = False
self.images: dict = {}
self.exits_ok = False
self.ends_ok = False
self.before_end = None
self.audit_raw: tuple = ([], []) # the births and the ends of the last read of the log (`audit_listing`)
def _canary(self, which: str) -> str:
"""A file of the oracle's own, written and read now: the session must have a Create event of it."""
@@ -1206,6 +1307,12 @@ class WindowsTrace:
self.before = {"setting": parse_audit_setting(_tool(["auditpol", "/get", "/subcategory:" + AUDIT_GUID, "/r"])),
"value": self._registry_value()}
_tool(["auditpol", "/set", "/subcategory:" + AUDIT_GUID, "/success:enable"])
try: # the end of each process (4689): without it the tree still tells a pid taken by a stranger by its birth, and the run says so, it is not red
end_setting = parse_audit_setting(_tool(["auditpol", "/get", "/subcategory:" + AUDIT_END_GUID, "/r"]))
_tool(["auditpol", "/set", "/subcategory:" + AUDIT_END_GUID, "/success:enable"])
self.before_end, self.ends_ok = end_setting, True
except TraceError:
self.ends_ok = False
_tool(["reg", "add", AUDIT_KEY, "/v", AUDIT_VALUE, "/t", "REG_DWORD", "/d", "1", "/f"])
newest = _tool(["wevtutil", "qe", "Security", "/c:1", "/rd:true", "/f:xml"])
m = re.search(r"<EventRecordID>(\d+)</EventRecordID>", newest)
@@ -1233,10 +1340,12 @@ class WindowsTrace:
return int(m.group(1), 16) if m else None
def tree(self, roots) -> list:
xml = _tool(["wevtutil", "qe", "Security", "/q:*[System[(EventID=4688) and (EventRecordID>%d)]]" % self.first_record, "/f:xml"])
xml = _tool(["wevtutil", "qe", "Security", "/q:*[System[(EventID=4688 or EventID=4689) and (EventRecordID>%d)]]" % self.first_record, "/f:xml"])
events = parse_audit_events(xml)
self.images = {e["pid"]: _base(e["image"]).lower() for e in events}
return process_tree(events, roots)
ends = parse_audit_ends(xml)
self.audit_raw = (events, ends)
return process_tree(events, roots, ends)
def finish(self, roots, alive=None, sleep=time.sleep, now=time.monotonic, namer=None) -> dict:
"""`{"tree": [4688 events], "files": {(pid, name)}, "outside": {process name: paths}, "exited": {...}, "events": n}`: what the TREE did from its
@@ -1255,6 +1364,8 @@ class WindowsTrace:
except Exception: # noqa: BLE001 - a process that is gone has no name
return "pid %d" % pid
tree, exited = wait_exited(lambda: self.tree(roots), alive, sleep=sleep, now=now)
events, ends = self.audit_raw
audit = (events, ends, sorted(roots))
end_canary = self._canary("end")
_tool(["logman", "stop", self.name, "-ets"])
self.session = False
@@ -1281,7 +1392,7 @@ class WindowsTrace:
missing = sorted(tree_pids - {pid for pid, _n in seen})
if missing:
problems.append("the file trace holds no open of the process(es) %s" % ", ".join(str(p) for p in missing[:10]))
return {"tree": tree, "files": {(p, n) for p, n in seen if p in tree_pids}, "outside": {k: len(v) for k, v in sorted(outside.items())},
return {"tree": tree, "audit": audit, "files": {(p, n) for p, n in seen if p in tree_pids}, "outside": {k: len(v) for k, v in sorted(outside.items())},
"exited": exited, "events": events, "problems": problems, "exits": [e for e in exits if e["pid"] in tree_pids], "exits_available": self.exits_ok,
"order": {k: v for k, v in order.items() if k[0] in tree_pids},
"dispositions": {k: sorted(v) for k, v in dispositions.items() if k[0] in tree_pids}}
@@ -1299,6 +1410,9 @@ class WindowsTrace:
flags = {"Success": ("enable", "disable"), "Failure": ("disable", "enable"), "Success and Failure": ("enable", "enable")}
success, failure = flags.get(self.before["setting"], ("disable", "disable"))
try:
if self.ends_ok:
end_success, end_failure = flags.get(self.before_end, ("disable", "disable"))
_tool(["auditpol", "/set", "/subcategory:" + AUDIT_END_GUID, "/success:" + end_success, "/failure:" + end_failure])
_tool(["auditpol", "/set", "/subcategory:" + AUDIT_GUID, "/success:" + success, "/failure:" + failure])
if self.before["value"] is None:
_tool(["reg", "delete", AUDIT_KEY, "/v", AUDIT_VALUE, "/f"])
@@ -1378,16 +1492,9 @@ def net_class(entry: str) -> str:
def leaves_of(seed_footprint: dict, with_pingsender: bool = False) -> dict:
"""{leaf: value} of one seed: proc.<kind> = how many processes of that kind the run made (1 for a kind of type tab: its presence) and
net.<kind>: <what> = 1 for every netlink socket, netlink request and public destination of a process of that kind (`network_events`). The host paths are not leaves
of a seed: they are judged over all the launches (`file_rule`)."""
"""{leaf: value} of one seed: net.<kind>: <what> = 1 for every netlink socket, netlink request and public destination of a process of that kind (`network_events`). Neither the
host paths nor the kinds of process are leaves of a seed: both are judged over all the launches (`file_rule`)."""
out = {}
for kind, n in seed_footprint.get("kinds", {}).items():
if kind == PRIVILEGED:
continue # absent or present per launch (PRIVILEGED_REASON): `privileged_problems`
if kind == PINGSENDER_KIND or (kind.endswith("<-pingsender") and not with_pingsender):
continue # 0 or 3 of them, with their form (`pingsender_problems`), and what they spawned: there when they are
out["proc." + kind] = 1 if is_tab(kind) and n else n
for entry in seed_footprint.get("net") or []:
if not entry.startswith(PINGSENDER_KIND + ": "):
out["net." + net_class(entry)] = 1
@@ -1397,6 +1504,11 @@ def leaves_of(seed_footprint: dict, with_pingsender: bool = False) -> dict:
return out
def _kind_value(kind: str, n: int):
"""What a red kind of process shows in a seed: how many of it the seed has (1 for a kind of type tab: its presence)."""
return 1 if is_tab(kind) and n else n
def category_of(leaf: str) -> str:
return leaf.split(".", 1)[0]
@@ -1541,17 +1653,19 @@ def judge(a: dict, b: dict, expected: list | None = None, a_a: bool = False, pla
for seed in sorted(set(seeds_a) & set(seeds_b)):
both = bool(seeds_a[seed].get("kinds", {}).get(PINGSENDER_KIND)) and bool(seeds_b[seed].get("kinds", {}).get(PINGSENDER_KIND))
la, lb = leaves_of(seeds_a[seed], both), leaves_of(seeds_b[seed], both)
ka, kb = judged_kinds(seeds_a[seed]), judged_kinds(seeds_b[seed])
for side, fp in (("A", seeds_a[seed]), ("B", seeds_b[seed])):
for message in fp.get("problems", []) + pingsender_problems(fp) + privileged_problems(fp):
problems.append("seed %s side %s: %s" % (seed, side, message))
per = {c: 0 for c in CATEGORIES}
for leaf in set(la) | set(lb):
per[category_of(leaf)] = per.get(category_of(leaf), 0) + 1
per["proc"] = len(ka | kb)
per["file"] = len(set(seeds_a[seed].get("files", [])) | set(seeds_b[seed].get("files", [])))
counts[str(seed)] = per
for side, leaves, files in (("A", la, seeds_a[seed].get("files", [])), ("B", lb, seeds_b[seed].get("files", []))):
for side, leaves, kinds, files in (("A", la, ka, seeds_a[seed].get("files", [])), ("B", lb, kb, seeds_b[seed].get("files", []))):
have = {c: sum(1 for k in leaves if category_of(k) == c) for c in floors}
have["file"] = len(files)
have["proc"], have["file"] = len(kinds), len(files)
for c, floor in floors.items():
if have[c] < floor:
problems.append("seed %s side %s has %d %s leaves, fewer than the floor of %d: the run was not seen"
@@ -1564,12 +1678,14 @@ def judge(a: dict, b: dict, expected: list | None = None, a_a: bool = False, pla
"calls": {"A": _calls(seeds_a[seed], leaf), "B": _calls(seeds_b[seed], leaf)}})
red, not_judged = file_rule(a, b, a_a, also_68 or ())
for side, seeds in (("A", seeds_a), ("B", seeds_b)):
for path in red[side]:
leaf = "file." + path
for seed in sorted(seeds):
other = {"A": "B", "B": "A"}[side]
differences.append({"seed": seed, "category": "file", "leaf": leaf, "a": 1 if side == "A" else MISSING, "b": 1 if side == "B" else MISSING,
"by": {side: _by(seeds[seed], leaf), other: []}, "calls": {side: _calls(seeds[seed], leaf), other: []}})
other = {"A": "B", "B": "A"}[side]
for category, names in (("file", red["files"][side]), ("proc", red["kinds"][side])):
for name in names:
leaf = "%s.%s" % (category, name)
for seed in sorted(seeds):
value = 1 if category == "file" else _kind_value(name, seeds[seed].get("kinds", {}).get(name, 0))
differences.append({"seed": seed, "category": category, "leaf": leaf, "a": value if side == "A" else MISSING, "b": value if side == "B" else MISSING,
"by": {side: _by(seeds[seed], leaf), other: []}, "calls": {side: _calls(seeds[seed], leaf), other: []}})
differences.sort(key=lambda d: (d["seed"], d["leaf"]))
if os_name == "windows" and not a_a:
for where, fp in [("seed %s" % seed, seeds_b[seed]) for seed in sorted(seeds_b)] + ([("warm-up", b["warmup"])] if b.get("warmup") else []):
@@ -1636,15 +1752,18 @@ def print_report(report: dict, a_name: str, b_name: str) -> None:
for d in report["differences"][:200]:
print("DIFF seed %s %s: %s %s | %s %s%s" % (d["seed"], d["leaf"], a_name, json.dumps(d["a"], sort_keys=True)[:160],
b_name, json.dumps(d["b"], sort_keys=True)[:160], _by_text(d)))
listed = (report.get("not_judged") or {}).get("paths", [])
if listed:
for key, label, prefix, name_key, by_key in (("paths", "paths", "", "path", "touched_by"), ("kinds", "kinds of process", "proc.", "kind", "spawned_by")):
listed = (report.get("not_judged") or {}).get(key, [])
if not listed:
continue
watch = [e for e in listed if e["watch"]]
print("NOT JUDGED (listed in the artifact, not red): %d paths, %d to watch" % (len(listed), len(watch)))
print("NOT JUDGED (listed in the artifact, not red): %d %s, %d to watch" % (len(listed), label, len(watch)))
for e in watch + [e for e in listed if not e["watch"]][:LISTED_IN_LOG]:
print("%s %s: %s %s | %s %s (by %s | %s)" % ("WATCH" if e["watch"] else "LISTED", e["path"], a_name, _launch_counts(e["A"]), b_name, _launch_counts(e["B"]),
", ".join(e["touched_by"]["A"]) or "-", ", ".join(e["touched_by"]["B"]) or "-"))
who = e[by_key]
print("%s %s%s: %s %s | %s %s (by %s | %s)" % ("WATCH" if e["watch"] else "LISTED", prefix, e[name_key], a_name, _launch_counts(e["A"]), b_name, _launch_counts(e["B"]),
", ".join(who["A"]) or "-", ", ".join(who["B"]) or "-"))
if len(listed) - len(watch) > LISTED_IN_LOG:
print("LISTED: %d more paths in the file of the not judged list" % (len(listed) - len(watch) - LISTED_IN_LOG))
print("LISTED: %d more %s in the file of the not judged list" % (len(listed) - len(watch) - LISTED_IN_LOG, label))
for side, name in (("A", a_name), ("B", b_name)):
warm = (report.get("warmup") or {}).get(side)
if warm:
@@ -1832,7 +1951,21 @@ def save_datareporting(profile, folder, launch: str, seed: int) -> None:
print("the list of datareporting could not be saved (seed %d, launch %s): %s" % (seed, launch, e))
def run_seed(binary: str, seed: int, work: Path, name: str | None = None, idle: bool = False, crash_with: int | None = None, datareporting_dir=None) -> dict:
def save_audit(folder, launch: str, seed: int, audit) -> None:
"""Saves the raw events the tree of a Windows launch was read from as `<folder>/<launch>-<seed>.json` (`audit_listing`: the 4688 and 4689 of the launch, the excluded ones as well,
each with the reason): evidence for the next time a process is or is not in a tree, it changes no verdict and is never a leaf of the footprint. No folder, no file; a write that
fails is said on the output."""
if not folder or not audit:
return
events, ends, roots = audit
try:
Path(folder).mkdir(parents=True, exist_ok=True)
write_json(Path(folder) / ("%s-%d.json" % (launch, seed)), audit_listing(events, roots, ends, launch, seed))
except (OSError, ValueError, TypeError) as e:
print("the audit of the tree could not be saved (seed %d, launch %s): %s" % (seed, launch, e))
def run_seed(binary: str, seed: int, work: Path, name: str | None = None, idle: bool = False, crash_with: int | None = None, datareporting_dir=None, audit_dir=None) -> dict:
"""One browser, one journey, one close, one trace. Returns the seed's footprint; `name` is the folder of its work (the warm-up has one of its own).
`idle` is the launch in which the exit pings MUST leave (see `run_engine`): no journey and no pref changed; the launch waits until the notification of the data
@@ -1845,7 +1978,8 @@ def run_seed(binary: str, seed: int, work: Path, name: str | None = None, idle:
A launch with a page waits for Glean to have initialised right after its first page is opened (`wait_for_glean_of_launch`: Glean is born once a window is open, and a session
that closes before it has initialised makes it start inside the shutdown, where the parent can end with -11), so that the work of the launch is always between the condition and the
close; a condition that is not met is a problem of the launch (the verdict is red) and the launch goes on. Just before the close the list of `<profile>/datareporting/` is saved in
`datareporting_dir` (`save_datareporting`: evidence for the next time, never part of the footprint).
`datareporting_dir` (`save_datareporting`: evidence for the next time, never part of the footprint). On Windows the raw events of the audit the tree was read from, the
excluded ones included, are saved in `audit_dir` (`save_audit`), also evidence.
`crash_with` is the recorder's own test (`crash-probe`): the signal sent to the parent of the browser once it is up, to show that a launch that dies is red and keeps its evidence."""
from playwright.sync_api import sync_playwright
@@ -1955,7 +2089,7 @@ def run_seed(binary: str, seed: int, work: Path, name: str | None = None, idle:
exited = _wait_for_tree_exit(pgid)
if exited is not None and not exited:
problems.append("the tree did not exit within %d s of the close: the trace is cut short" % EXIT_LIMIT_S)
result = _seed_result(binary, seed, seed_work, steps, log, trace, root_pid, windows, close)
result = _seed_result(binary, seed, seed_work, steps, log, trace, root_pid, windows, close, lambda audit: save_audit(audit_dir, launch_name, seed, audit))
if idle:
result["idle"] = {"notified": notified, "shortcut_changes": diff_snapshots(shortcuts_before, snapshot_places(places)) if places else None}
watched, watcher = watcher.stop(), None
@@ -2136,11 +2270,14 @@ def _wait_for_tree_exit(pgid):
return not _wait_for_exit(pgid, EXIT_LIMIT_S)
def _seed_result(binary: str, seed: int, seed_work: Path, steps: list, log: Path, trace, root_pid, windows: bool, close: dict | None = None) -> dict:
def _seed_result(binary: str, seed: int, seed_work: Path, steps: list, log: Path, trace, root_pid, windows: bool, close: dict | None = None, keep_audit=None) -> dict:
"""The footprint of one launch. On Windows `keep_audit(audit)` is given the raw events of the audit the tree was read from (`save_audit`), before they are read into the footprint."""
real = os.path.realpath(binary)
ctx = _context(binary, windows, seed_work)
if windows:
got = trace.finish({root_pid})
if keep_audit is not None:
keep_audit(got.get("audit"))
procs = windows_processes(got["tree"], real)
pairs = list(got["files"])
labels = {pid: p["label"] for pid, p in procs.items()}
@@ -2207,11 +2344,11 @@ def keep_crash(fp: dict, launch: str, crash_dir) -> None:
sys.stdout.flush()
def run_engine(binary: str, leg: str, seeds: list, label: str, crash_dir=None, datareporting_dir=None) -> dict:
def run_engine(binary: str, leg: str, seeds: list, label: str, crash_dir=None, datareporting_dir=None, audit_dir=None) -> dict:
"""The footprint document of one engine. A discarded WARM-UP launch first, of the first seed, then every seed's journey, one browser at a time.
Every launch (the warm-up, each seed and the idle one) that does not end with 0 is a problem of the run, and what it left is kept in `crash_dir` (`keep_crash`). The list of the
`datareporting` folder of each launch with a page is saved in `datareporting_dir` (`save_datareporting`).
`datareporting` folder of each launch with a page is saved in `datareporting_dir` (`save_datareporting`), and on Windows the raw events of the audit of each launch in `audit_dir` (`save_audit`).
The warm-up is a control of the experiment and not an excuse: what a machine does the first time it runs an engine (its files scanned, its caches
cold, a first-run behaviour of the engine) is in a launch that is not compared, whose trace is kept in the document (`warmup`) so that what it
@@ -2220,14 +2357,14 @@ def run_engine(binary: str, leg: str, seeds: list, label: str, crash_dir=None, d
work = Path(tempfile.mkdtemp(prefix="ab-host-"))
problems, out_seeds = [], []
try:
warm = run_seed(binary, seeds[0], work, name="warmup", datareporting_dir=datareporting_dir)
warm = run_seed(binary, seeds[0], work, name="warmup", datareporting_dir=datareporting_dir, audit_dir=audit_dir)
keep_crash(warm, "warmup", crash_dir)
problems += ["warm-up: %s" % p for p in warm.get("problems", [])]
problems += ["warm-up: seed %d: step %d (%s) failed: %s" % (seeds[0], st["n"], st["name"], st.get("error")) for st in warm["steps"] if not st["ok"]]
print("warm-up (seed %d, discarded): %s; %d host paths" % (seeds[0], json.dumps(warm["kinds"], sort_keys=True), len(warm["files"])))
sys.stdout.flush()
for seed in seeds:
fp = run_seed(binary, seed, work, datareporting_dir=datareporting_dir)
fp = run_seed(binary, seed, work, datareporting_dir=datareporting_dir, audit_dir=audit_dir)
keep_crash(fp, "seed%d" % seed, crash_dir)
out_seeds.append(fp)
for step in fp["steps"]:
@@ -2236,7 +2373,7 @@ def run_engine(binary: str, leg: str, seeds: list, label: str, crash_dir=None, d
print("seed %d: %s; %d host paths, %d net entries, %s" % (seed, json.dumps(fp["kinds"], sort_keys=True), len(fp["files"]),
len(fp.get("net") or []), json.dumps(fp.get("ours", {}), sort_keys=True)))
sys.stdout.flush()
idle = run_seed(binary, seeds[0], work, name="idle", idle=True, datareporting_dir=datareporting_dir)
idle = run_seed(binary, seeds[0], work, name="idle", idle=True, datareporting_dir=datareporting_dir, audit_dir=audit_dir)
keep_crash(idle, "idle", crash_dir)
problems += ["idle: %s" % p for p in idle.get("problems", [])]
print("idle (seed %d): %s; notification %s" % (seeds[0], json.dumps(idle["kinds"], sort_keys=True), json.dumps((idle.get("idle") or {}).get("notified"))))
@@ -2283,7 +2420,7 @@ def stock_browser_parent(root_pid: int | None = None) -> int | None:
return min(found)[1] if found else None
def run_stock(leg: str) -> dict:
def run_stock(leg: str, audit_dir=None) -> dict:
"""The negative control of the geolocation step, Windows only: Playwright's own Firefox (`p.firefox.launch()`, as the fake web's stock control), with
no declared position, the same step, the same trace. It must start the Windows location utility process (`stock_control_problems`). The tree is the
one of this process (the driver and the browser it launches): only the kinds and the modules of the run are read."""
@@ -2334,7 +2471,7 @@ def run_stock(leg: str) -> dict:
return document({"seed": 0, "steps": steps, "kinds": {}, "files": [], "ours": {}, "trace": {"source": "etw+audit", "exited": False}, "started": False,
"problems": [STOCK_NO_PARENT % exe]})
stock_phase("seed result")
result = _seed_result(exe, 0, work, steps, work / "none.log", trace, parent, True)
result = _seed_result(exe, 0, work, steps, work / "none.log", trace, parent, True, None, lambda audit: save_audit(audit_dir, "stock", 0, audit))
result["started"] = True
return document(result)
except TraceError as e:
@@ -2624,7 +2761,7 @@ def main(argv=None) -> int:
if not _windows():
print("the stock control is for Windows: Linux has no Windows location provider to reach")
return 3
write_json(args.out, run_stock(args.leg))
write_json(args.out, run_stock(args.leg, args.out.parent / (args.out.stem + ".audit")))
return 0
if args.cmd == "crash-probe":
if not sys.platform.startswith("linux"):
@@ -2640,7 +2777,8 @@ def main(argv=None) -> int:
if args.crash_with:
document = run_crash_probe(args.binary, args.leg, seeds[0], args.label, crash_dir, args.crash_with)
else:
document = run_engine(args.binary, args.leg, seeds, args.label, crash_dir, args.out.parent / (args.out.stem + ".datareporting"))
document = run_engine(args.binary, args.leg, seeds, args.label, crash_dir, args.out.parent / (args.out.stem + ".datareporting"),
args.out.parent / (args.out.stem + ".audit")) # footprint-68.json -> footprint-68.audit/<launch>-<seed>.json
write_json(args.out, document)
return 0
if args.candidate and not args.candidate_seal:
@@ -0,0 +1,40 @@
# Source of the fixtures of run 45228081536
- what: Windows, A/A of the 68 (the published engine twice), the run whose A/A was red on the pingsenders
- repository: oss-invisible/playwright
- run: 45228081536
- job: 137879971705 (`e2e (host, windows)`)
- origin: the artifact of the job, `art/invpw-evidence/ab-host/` (kept outside the repository, with the rest of the artifact of the job)
| fixture | origin file | sha256 of the origin file | sha256 of the fixture | bytes |
|---|---|---|---|---|
| footprint-68.json | ab-host/footprint-68.json | 0f45112a954a29913136ea39fe941f5948c4e05ae73bc2c67982ab0e7b249512 | 1e3dd3ef409ebd80e98cdb55bddcb42e1d060e3e7f5c3dd6999edd3907c42b21 | 90783 |
| footprint-68-again.json | ab-host/footprint-68-again.json | 487933bc13edb6f1194833a05598e8bf89549fa71211abf628cb9cb2d6e1ff91 | e2d92338c4282f4acd8e8fcca699d0da23809404466365360472a96165fa66a8 | 71783 |
## What the run said
The verdict of the A/A (`diff-a-a.json`) was red on two lines:
- seed 4, side B: `2 pingsender processes, not 0 or 3`;
- seed 63: `proc.socket<-pingsender: A 3 | B <missing>`.
The pingsenders of the 68 (`backgroundtask/pingsender`) per launch, warm-up and seeds 0, 2, 4, 6, 63: first run 3, 3, 3, 3, 3, 3; second run 1, 3, 0, 2, 0, 3. The sockets they start
(`socket<-pingsender`): first run warm-up, seed 6 and seed 63; second run none.
## Reduction
The reduction is the one of tests/data/ab_host_aa/45088980743/SOURCES.md (`kinds`, `pingsenders`, `net`, `inventory` of every launch as they are, and the host paths as a table `paths` with a
mask per launch and the union of the processes that touched each), with one field more per launch, `spawned_by` (the kinds that spawned each kind: the process to blame for a kind the rule
lists). The launches are the warm-up, `s0`, `s2`, `s4`, `s6`, `s63` and `idle`. Nothing else of the footprint is kept (the processes, the lifecycle, the close, the trace, the creates, the
paths of ours); the test rebuilds a footprint of the oracle's format from it (`rebuild` in tests/test_ab_host_aa_stable.py).
## Neutralisation
The same as in the other fixtures: every public IPv4 address becomes an address of the documentation ranges one to one (the footprints of this run hold none: the net of a Windows run is not
covered) and the folder `users` of the C drive becomes `profiles` in every path (the folder itself included), the same string for every path (the number of distinct paths, every mask and every set of touching
processes are unchanged).
## The old judgement on these data (scripts/ci_ab_host.py at e3572f28)
A/A red: the two problems above. After the change (the kinds of process judged by the rule of the paths, the pingsender kinds only listed) the A/A is green and the pingsender kinds are in
`not_judged["kinds"]`: `backgroundtask/pingsender` in 6 of 6 measured launches of the first run and 4 of 6 of the second, `socket<-pingsender` in 3 of 6 and 0 of 6.
@@ -0,0 +1 @@
{"engine": "firefox-68 again", "launch": {"idle": {"inventory": ["c:", "c:\\program files", "c:\\program files (x86)\\microsoft\\edge\\application\\msedge.exe", "c:\\program files\\desktop.ini", "c:\\program files\\desktop.ini:zone.identifier", "c:\\program files\\google\\chrome\\application\\chrome.exe", "c:\\programdata\\microsoft\\windows\\start menu\\programs", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\active-update.xml", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\parent.lock", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\update.test", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\updates.xml", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\updates\\0", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\updates\\0\\update-elevated.log", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\updates\\0\\update.log", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\updates\\downloading", "c:\\profiles\\runneradmin\\appdata\\local\\microsoft\\windows\\caches", "c:\\profiles\\runneradmin\\appdata\\local\\microsoft\\windows\\caches\\cversions.1.db", "c:\\profiles\\runneradmin\\appdata\\local\\microsoft\\windows\\caches\\{afbf9f1a-8ee8-4c77-af34-c647e37ca0d9}.1.ver0x0000000000000000.db", "c:\\profiles\\runneradmin\\appdata\\local\\microsoft\\windows\\inetcache", "c:\\profiles\\runneradmin\\appdata\\local\\microsoft\\windows\\inetcookies", "c:\\profiles\\runneradmin\\appdata\\roaming", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\internet explorer\\quick launch\\user pinned\\taskbar", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\internet explorer\\quick launch\\user pinned\\taskbar\\file explorer.lnk", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\internet explorer\\quick launch\\user pinned\\taskbar\\google chrome.lnk", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\internet explorer\\quick launch\\user pinned\\taskbar\\microsoft edge.lnk", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\internet explorer\\quick launch\\user pinned\\taskbar\\nightly.lnk", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\windows\\recent\\customdestinations", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\windows\\start menu\\programs", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\nightly private browsing.lnk", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\nightly.lnk", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\startup", "c:\\profiles\\runneradmin\\appdata\\roaming\\mozilla\\firefox\\profiles", "c:\\profiles\\runneradmin\\desktop", "c:\\profiles\\runneradmin\\documents", "c:\\profiles\\runneradmin\\documents\\restore firefox", "c:\\windows", "c:\\windows\\system32\\en-us\\kernelbase.dll.mui", "c:\\windows\\system32\\en-us\\propsys.dll.mui", "c:\\windows\\system32\\fltlib.dll", "c:\\windows\\system32\\iertutil.dll", "c:\\windows\\system32\\linkinfo.dll", "c:\\windows\\system32\\mpr.dll", "c:\\windows\\system32\\netutils.dll", "c:\\windows\\system32\\onecoreuapcommonproxystub.dll", "c:\\windows\\system32\\srvcli.dll", "c:\\windows\\system32\\sspicli.dll", "c:\\windows\\system32\\urlmon.dll", "c:\\windows\\system32\\virtdisk.dll", "c:\\windows\\system32\\windows.applicationmodel.dll", "c:\\windows\\system32\\wpnapps.dll", "c:\\windows\\syswow64\\propsys.dll"], "kinds": {"crashreporter.exe": 1, "parent": 2, "rdd": 1, "socket": 1, "tab/isForBrowser": 8, "utility/sandboxingKind=0": 1}, "net": null, "pingsenders": [], "spawned_by": {"crashreporter.exe": ["parent"], "parent": ["(oracle)", "parent"], "rdd": ["parent"], "socket": ["parent"], "tab/isForBrowser": ["parent"], "utility/sandboxingKind=0": ["parent"]}}, "s0": {"inventory": ["c:", "c:\\program files", "c:\\program files (x86)\\microsoft\\edge\\application\\msedge.exe", "c:\\program files\\desktop.ini", "c:\\program files\\desktop.ini:zone.identifier", "c:\\program files\\google\\chrome\\application\\chrome.exe", "c:\\programdata\\microsoft\\windows\\start menu\\programs", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\active-update.xml", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\parent.lock", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\update.test", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updaLine truncated
@@ -0,0 +1 @@
{"engine": "firefox-68", "launch": {"idle": {"inventory": ["c:", "c:\\program files", "c:\\program files (x86)\\microsoft\\edge\\application\\msedge.exe", "c:\\program files\\desktop.ini", "c:\\program files\\desktop.ini:zone.identifier", "c:\\program files\\google\\chrome\\application\\chrome.exe", "c:\\programdata\\microsoft\\windows\\start menu\\programs", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\active-update.xml", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\parent.lock", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\update.test", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\updates.xml", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\updates\\0", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\updates\\0\\update-elevated.log", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\updates\\0\\update.log", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\updates\\downloading", "c:\\profiles\\runneradmin\\appdata\\local\\microsoft\\windows\\caches", "c:\\profiles\\runneradmin\\appdata\\local\\microsoft\\windows\\caches\\cversions.1.db", "c:\\profiles\\runneradmin\\appdata\\local\\microsoft\\windows\\caches\\{afbf9f1a-8ee8-4c77-af34-c647e37ca0d9}.1.ver0x0000000000000000.db", "c:\\profiles\\runneradmin\\appdata\\local\\microsoft\\windows\\inetcache", "c:\\profiles\\runneradmin\\appdata\\local\\microsoft\\windows\\inetcookies", "c:\\profiles\\runneradmin\\appdata\\roaming", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\internet explorer\\quick launch\\user pinned\\taskbar", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\internet explorer\\quick launch\\user pinned\\taskbar\\file explorer.lnk", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\internet explorer\\quick launch\\user pinned\\taskbar\\google chrome.lnk", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\internet explorer\\quick launch\\user pinned\\taskbar\\microsoft edge.lnk", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\internet explorer\\quick launch\\user pinned\\taskbar\\nightly.lnk", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\windows\\recent\\customdestinations", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\windows\\start menu\\programs", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\nightly private browsing.lnk", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\nightly.lnk", "c:\\profiles\\runneradmin\\appdata\\roaming\\microsoft\\windows\\start menu\\programs\\startup", "c:\\profiles\\runneradmin\\appdata\\roaming\\mozilla\\firefox\\profiles", "c:\\profiles\\runneradmin\\desktop", "c:\\profiles\\runneradmin\\documents", "c:\\profiles\\runneradmin\\documents\\restore firefox", "c:\\windows", "c:\\windows\\system32\\en-us\\kernelbase.dll.mui", "c:\\windows\\system32\\en-us\\propsys.dll.mui", "c:\\windows\\system32\\fltlib.dll", "c:\\windows\\system32\\iertutil.dll", "c:\\windows\\system32\\linkinfo.dll", "c:\\windows\\system32\\mpr.dll", "c:\\windows\\system32\\netutils.dll", "c:\\windows\\system32\\onecoreuapcommonproxystub.dll", "c:\\windows\\system32\\srvcli.dll", "c:\\windows\\system32\\sspicli.dll", "c:\\windows\\system32\\urlmon.dll", "c:\\windows\\system32\\virtdisk.dll", "c:\\windows\\system32\\windows.applicationmodel.dll", "c:\\windows\\system32\\wpnapps.dll", "c:\\windows\\syswow64\\propsys.dll"], "kinds": {"crashreporter.exe": 1, "parent": 2, "rdd": 1, "socket": 1, "tab/isForBrowser": 8, "utility/sandboxingKind=0": 1}, "net": null, "pingsenders": [], "spawned_by": {"crashreporter.exe": ["parent"], "parent": ["(oracle)", "parent"], "rdd": ["parent"], "socket": ["parent"], "tab/isForBrowser": ["parent"], "utility/sandboxingKind=0": ["parent"]}}, "s0": {"inventory": ["c:", "c:\\program files", "c:\\program files (x86)\\microsoft\\edge\\application\\msedge.exe", "c:\\program files\\desktop.ini", "c:\\program files\\desktop.ini:zone.identifier", "c:\\program files\\google\\chrome\\application\\chrome.exe", "c:\\programdata\\microsoft\\windows\\start menu\\programs", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\active-update.xml", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\parent.lock", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bb481e43cafac064\\update.test", "c:\\programdata\\mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\\updates\\bLine truncated
@@ -0,0 +1,23 @@
# Source of the fixture of run 45221868374
- what: Windows host oracle, the idle launch of side A (`firefox-68`), the launch in which the tree "did not exit within 120 s of the close"
- repository: oss-invisible/playwright
- run: 45221868374
- job: 137858126009 (`e2e (host, windows)`)
- origin file: `art/invpw-evidence/ab-host/footprint-68.json`, key `idle`, key `lifecycle` (kept outside the repository with the rest of the artifact of the job)
- sha256 of the origin file: 53e383c8e808bbdcf1802007a36129c021c34cba324c12d966685cc157783aab (519890 bytes)
| fixture | sha256 of the fixture | bytes |
|---|---|---|
| idle-lifecycle.json | c4a661f8d421397e4e483bd0bae3a50ca06f71a1a6b0e15b871b07eb9a925375 | 6372 |
## Reduction
`{"launch": "idle", "lifecycle": [{"time", "event", "kind", "how"}]}`: the 53 rows of `idle.lifecycle` as they are (the start of each process of the tree, from its 4688 event, and
its end, from the Kernel-Process stop, in the order of the time each carries). Nothing is added, nothing is dropped. The rows hold no address, no account name, no path.
## What the footprint does not hold
The footprint has no pid, no creator pid, no record id and no `ParentProcessName`: the raw 4688 events of the job are not in its artifact (`wevtutil` output is read in memory and
not kept). The test (`test_the_idle_launch_of_run_45221868374_...` in tests/test_ab_host.py) therefore rebuilds the events from these rows, with the kinds and the order that
the run had and pids and creators that the test gives; what it gives is written in the test.
@@ -0,0 +1,323 @@
{
"launch": "idle",
"lifecycle": [
{
"event": "start",
"how": "",
"kind": "parent",
"time": "2026-11-23T16:58:12.9368975Z"
},
{
"event": "start",
"how": "",
"kind": "parent",
"time": "2026-11-23T16:58:12.9447038Z"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T16:58:13.3147954Z"
},
{
"event": "start",
"how": "",
"kind": "svchost.exe",
"time": "2026-11-23T16:58:13.7620819Z"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T16:58:13.7716028Z"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T16:58:13.8028781Z"
},
{
"event": "end",
"how": "exited 0",
"kind": "svchost.exe",
"time": "2026-11-23T16:58:13.970863500+00:00"
},
{
"event": "start",
"how": "",
"kind": "tab/isForBrowser",
"time": "2026-11-23T16:58:14.7079107Z"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T16:58:14.9940602Z"
},
{
"event": "start",
"how": "",
"kind": "utility/sandboxingKind=0",
"time": "2026-11-23T16:58:15.7778669Z"
},
{
"event": "start",
"how": "",
"kind": "tab/isForBrowser",
"time": "2026-11-23T16:58:15.9476388Z"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T16:58:16.2699895Z"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T16:58:16.2940466Z"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T16:58:18.7136711Z"
},
{
"event": "start",
"how": "",
"kind": "wsl.exe",
"time": "2026-11-23T16:59:10.2029323Z"
},
{
"event": "end",
"how": "exited 0",
"kind": "wsl.exe",
"time": "2026-11-23T16:59:12.221138500+00:00"
},
{
"event": "start",
"how": "",
"kind": "svchost.exe",
"time": "2026-11-23T16:59:19.3828758Z"
},
{
"event": "start",
"how": "",
"kind": "socket",
"time": "2026-11-23T16:59:20.0061534Z"
},
{
"event": "end",
"how": "exited 0",
"kind": "socket",
"time": "2026-11-23T16:59:20.870868700+00:00"
},
{
"event": "start",
"how": "",
"kind": "wsl.exe",
"time": "2026-11-23T16:59:50.5782295Z"
},
{
"event": "end",
"how": "exited 4294967295",
"kind": "wsl.exe",
"time": "2026-11-23T16:59:50.599354300+00:00"
},
{
"event": "end",
"how": "exited 0",
"kind": "tab/isForBrowser",
"time": "2026-11-23T17:00:16.785320700+00:00"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:00:16.788835200+00:00"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:00:16.833776900+00:00"
},
{
"event": "end",
"how": "exited 0",
"kind": "tab/isForBrowser",
"time": "2026-11-23T17:00:16.872780900+00:00"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:00:16.875828000+00:00"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:00:16.876346800+00:00"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:00:16.877080100+00:00"
},
{
"event": "end",
"how": "exited 0",
"kind": "utility/sandboxingKind=0",
"time": "2026-11-23T17:00:17.005358500+00:00"
},
{
"event": "start",
"how": "",
"kind": "backgroundtask/pingsender",
"time": "2026-11-23T17:00:17.0061094Z"
},
{
"event": "end",
"how": "exited 1",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:00:17.019510200+00:00"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:00:17.020111700+00:00"
},
{
"event": "end",
"how": "exited 0",
"kind": "parent",
"time": "2026-11-23T17:00:17.028312700+00:00"
},
{
"event": "end",
"how": "exited 0",
"kind": "parent",
"time": "2026-11-23T17:00:17.061100700+00:00"
},
{
"event": "start",
"how": "",
"kind": "socket",
"time": "2026-11-23T17:00:17.2400802Z"
},
{
"event": "end",
"how": "exited 0",
"kind": "socket",
"time": "2026-11-23T17:00:17.750897400+00:00"
},
{
"event": "end",
"how": "exited 0",
"kind": "backgroundtask/pingsender",
"time": "2026-11-23T17:00:17.760487100+00:00"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:00:31.4290003Z"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:00:31.524775100+00:00"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:00:36.4762838Z"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:00:36.572912700+00:00"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:01:07.2987869Z"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:01:07.398939500+00:00"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:01:11.3921796Z"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:01:11.490644500+00:00"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:01:30.9227343Z"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:01:31.023271300+00:00"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:01:41.2382275Z"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:01:41.340881700+00:00"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:02:03.6231004Z"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:02:03.728117900+00:00"
},
{
"event": "start",
"how": "",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:02:07.5330074Z"
},
{
"event": "end",
"how": "exited 0",
"kind": "wevtutil.exe",
"time": "2026-11-23T17:02:07.637980000+00:00"
}
]
}
+323 -37
View File
@@ -117,12 +117,19 @@ def test_a_path_of_ours_on_one_side_only_is_green_because_ours_is_not_compared()
assert report["ours"]["package"] == "reading its own package is not touching the host"
def test_a_kind_with_another_count_is_red_and_names_the_kind_and_both_sides():
b = footprint(kinds=dict(KINDS, gpu=2))
def test_how_many_processes_of_a_kind_a_launch_has_is_not_judged_only_whether_a_kind_is_there():
"""The kinds of process follow the rule of the paths (`file_rule`): a kind is red only when it is in all the measured launches of one engine and in none of the other's."""
report = judge(footprint(), footprint(kinds=dict(KINDS, gpu=2)), a_a=True)
assert report["verdict"] == "green" and report["differences"] == [], "gpu is in every launch of both: the count is not compared"
assert report["not_judged"]["kinds"] == []
def test_a_kind_that_one_engine_has_in_every_measured_launch_and_the_other_in_none_is_red_and_names_the_kind_and_both_sides():
b = footprint(kinds={k: n for k, n in KINDS.items() if k != "gpu"})
report = judge(footprint(), b, a_a=True)
assert report["verdict"] == "red"
assert [(d["seed"], d["leaf"], d["a"], d["b"]) for d in report["differences"]] == [(11, "proc.gpu", 1, 2), (12, "proc.gpu", 1, 2)]
assert any("seed 12 proc.gpu: A 1 | B 2" in p for p in report["problems"])
assert [(d["seed"], d["leaf"], d["a"], d["b"]) for d in report["differences"]] == [(11, "proc.gpu", 1, host.MISSING), (12, "proc.gpu", 1, host.MISSING)]
assert any("seed 12 proc.gpu: A 1 | B \"<missing>\"" in p for p in report["problems"])
def test_a_kind_that_exists_on_one_side_only_is_red():
@@ -131,9 +138,42 @@ def test_a_kind_that_exists_on_one_side_only_is_red():
assert sorted({(d["leaf"], d["a"], d["b"]) for d in report["differences"]}) == [("proc.rdd", host.MISSING, 1)]
def test_a_helper_that_is_spawned_one_more_time_is_red():
report = judge(footprint(), footprint(kinds=dict(KINDS, **{"pingsender.exe": 1})), a_a=True)
assert {d["leaf"] for d in report["differences"]} == {"proc.pingsender.exe"}
def test_a_helper_that_one_engine_spawns_in_every_launch_and_the_other_in_none_is_red():
report = judge(footprint(), footprint(kinds=dict(KINDS, **{"lsb_release": 1})), a_a=True)
assert {d["leaf"] for d in report["differences"]} == {"proc.lsb_release"}
def six_launches(engine, extra=None, kinds=None):
"""A footprint of six measured launches (the warm-up and five seeds), launch `i` having the kinds `extra[i]` besides KINDS: the shape of a run of the oracle."""
extra = extra or {}
fp = footprint(engine, kinds=kinds)
fp["seeds"] = [seed_footprint(s, dict(KINDS, **extra.get(i + 1, {}))) for i, s in enumerate(range(5))]
return with_warmup(fp, kinds=dict(KINDS, **extra.get(0, {})), seed=0)
def test_the_separate_pingsender_is_red_in_one_launch_of_six_where_the_rule_of_the_kinds_would_only_list_it():
"""`pingsender[.exe]` is not a kind of the rule (`judged_kinds`): it is held in every launch (`pingsender_problems`), as before."""
for exe in host.PINGSENDER_EXES:
a, b = six_launches("A"), six_launches("B", {3: {exe: 1}})
report = host.judge(a, b, a_a=True, floors=SMALL)
assert report["verdict"] == "red" and any("the separate %s ran (B266" % exe in p for p in report["problems"])
assert report["differences"] == [] and all(e["kind"] != exe for e in report["not_judged"]["kinds"])
def test_a_kind_in_six_launches_of_six_of_the_candidate_and_in_none_of_the_68_is_red():
c = six_launches("candidate", {i: {"rdd": 1} for i in range(6)})
report = host.judge(six_launches("A"), c, a_a=False, expected=[], also_68=[six_launches("A again")], floors=SMALL)
assert report["verdict"] == "red" and [d["leaf"] for d in report["differences"]] == ["proc.rdd"] * 5
assert {(d["a"], d["b"]) for d in report["differences"]} == {(host.MISSING, 1)} and report["not_judged"]["kinds"] == []
def test_a_kind_in_some_launches_of_one_engine_and_in_none_of_the_other_is_listed_not_red():
c = six_launches("candidate", {0: {"rdd": 1}, 2: {"rdd": 1}, 5: {"rdd": 2}})
report = host.judge(six_launches("A"), c, a_a=False, expected=[], also_68=[six_launches("A again")], floors=SMALL)
assert report["verdict"] == "green" and report["differences"] == [], report["problems"]
(entry,) = report["not_judged"]["kinds"]
assert entry["kind"] == "rdd" and entry["A"]["measured"] == [0, 12] and entry["B"]["measured"] == [3, 6] and entry["watch"] is True, "in half of the launches of one engine and in none of the other's"
assert entry["spawned_by"] == {"A": [], "B": []}
def test_the_count_of_the_tab_kind_is_not_compared_and_its_presence_is():
@@ -151,6 +191,8 @@ def test_the_content_processes_that_name_themselves_after_a_remote_type_are_of_t
a, b = footprint(kinds=dict(KINDS, **names)), footprint(kinds=dict(KINDS, **dict(names, **{"Web Content": 5})))
assert judge(a, b, a_a=True)["verdict"] == "green"
del b["seeds"][0]["kinds"]["WebExtensions"]
assert judge(a, b, a_a=True)["verdict"] == "green", "gone from one launch of B: not in all the launches of A and none of B's"
del b["seeds"][1]["kinds"]["WebExtensions"]
assert {d["leaf"] for d in judge(a, b, a_a=True)["differences"]} == {"proc.WebExtensions"}
assert [host.is_tab(k) for k in ("tab", "tab/isForBrowser", "Web Content", "gpu", "utility/sandboxingKind=1", "fork<-forkserver")] == [
True, True, True, False, False, False]
@@ -211,10 +253,11 @@ def test_the_declared_gfxtest_difference_passes_in_an_a_b():
def test_a_difference_next_to_the_declared_one_is_still_red():
c = a_candidate_without_gfxtest()
c["seeds"][0]["kinds"]["utility/sandboxingKind=1"] = 1
for seed in c["seeds"]:
seed["kinds"]["utility/sandboxingKind=1"] = 1
report = judge(footprint(), c, expected=expected())
assert report["verdict"] == "red"
assert [d["leaf"] for d in report["differences"]] == ["proc.utility/sandboxingKind=1"]
assert [d["leaf"] for d in report["differences"]] == ["proc.utility/sandboxingKind=1"] * len(SEEDS)
def test_the_declared_difference_the_other_way_round_is_red():
@@ -458,7 +501,7 @@ def test_a_closed_linux_run_makes_a_footprint_of_its_kinds_and_its_host_paths(tm
assert fp["kinds"] == {"glxtest": 1, "lsb_release": 1, "parent": 1, "tab/isForBrowser": 1, "utility/sandboxingKind=1": 1}
assert "/etc/hosts" not in fp["files"] and "/etc/localtime" in fp["files"] and "/proc/N/status" in fp["files"] and "/e/firefox/libxul.so" not in fp["files"]
assert fp["ours"] == {"package": 2, "profile": 1} and fp["trace"]["source"] == "strace" and fp["problems"] == []
assert host.leaves_of(fp)["proc.tab/isForBrowser"] == 1 and not any(leaf.startswith("file.") for leaf in host.leaves_of(fp)), "the host paths are judged over all the launches"
assert "tab/isForBrowser" in host.judged_kinds(fp) and not any(leaf.startswith(("file.", "proc.")) for leaf in host.leaves_of(fp)), "the host paths and the kinds are judged over all the launches"
def test_the_strace_stand_in_prints_the_paths_of_the_descriptors_only_when_asked(monkeypatch):
@@ -747,7 +790,7 @@ def with_warmup(fp, kinds=None, files=None, touched_by=None, spawned_by=None, se
def test_an_engine_run_makes_its_warm_up_launch_first_of_the_first_seed_then_its_measured_ones_and_the_idle_launch_last(tmp_path, monkeypatch):
calls = []
def fake_run_seed(binary, seed, work, name=None, idle=False, datareporting_dir=None):
def fake_run_seed(binary, seed, work, name=None, idle=False, datareporting_dir=None, audit_dir=None):
calls.append((seed, name, idle))
return seed_footprint(seed)
@@ -759,7 +802,7 @@ def test_an_engine_run_makes_its_warm_up_launch_first_of_the_first_seed_then_its
def test_a_warm_up_that_failed_is_red_in_the_document_like_a_measured_launch(monkeypatch):
def fake_run_seed(binary, seed, work, name=None, idle=False, datareporting_dir=None):
def fake_run_seed(binary, seed, work, name=None, idle=False, datareporting_dir=None, audit_dir=None):
fp = seed_footprint(seed)
if name == "warmup":
fp["problems"] = ["the file trace did not see the end canary file of the oracle"]
@@ -820,20 +863,37 @@ def test_the_report_lists_what_is_only_in_the_warm_up_and_says_when_both_engines
assert "WARMUP-ONLY firefox-68 again seed 11 proc.backgroundtask/pingsender" in out
def test_the_pingsenders_of_a_short_launch_are_none_or_the_three_of_a_first_run_and_nothing_else():
def test_how_many_pingsenders_a_launch_has_is_not_judged_it_is_listed():
"""Run 45228081536 (A/A of the 68, Windows): 2 pingsenders in seed 4 of one side was red ("not 0 or 3"), and the sockets they start, 3 in seed 63 of A and none of B, were a difference of
counts. Mozilla's start of the pingsender varies from a launch to the next: any number of them, in any of the launches, is green, in the list of what is not judged."""
ping = host.PINGSENDER_KIND
a = six_launches("A", {i: {ping: 3} for i in range(6)})
for n, where in ((0, {}), (1, {1: {ping: 1}}), (2, {1: {ping: 2}, 4: {ping: 2}}), (4, {0: {ping: 4}, 5: {ping: 4}})):
report = host.judge(a, six_launches("B", where), a_a=True, floors=SMALL)
assert report["verdict"] == ("red" if n == 0 else "green"), (n, report["problems"][:2])
if n:
(entry,) = report["not_judged"]["kinds"]
assert entry["kind"] == ping and entry["A"]["measured"] == [6, 6] and entry["B"]["measured"][1] == 6 and 0 < entry["B"]["measured"][0] < 6, n
pings = with_pingsenders(footprint(), 3)
assert judge(pings, footprint("again"), a_a=True)["verdict"] == "green", "3 on one side and 0 on the other is the approved tolerance"
assert judge(with_pingsenders(footprint(), 3), with_pingsenders(footprint("again"), 3), a_a=True)["verdict"] == "green"
for n in (1, 2, 4):
report = judge(with_pingsenders(footprint(), n), footprint("again"), a_a=True)
assert report["verdict"] == "red" and any("%d pingsender processes, not 0 or 3" % n in p and "TelemetrySend.sys.mjs:1083" in p for p in report["problems"]), n
report = judge(pings, footprint("again"), a_a=True)
assert report["verdict"] == "red" and {d["leaf"] for d in report["differences"]} == {"proc." + ping}, "in every launch of one engine and in none of the other's: the rule of every kind"
def test_three_pingsenders_that_are_not_the_pings_of_a_first_run_or_not_spawned_by_the_parent_are_red():
def test_a_pingsender_kind_in_six_launches_of_six_of_one_engine_and_in_none_of_the_other_is_red_and_one_in_some_launches_is_listed():
ping, child = host.PINGSENDER_KIND, "socket<-pingsender"
both = {i: {ping: 3, child: 3} for i in range(6)}
report = host.judge(six_launches("A", both), six_launches("B"), a_a=True, floors=SMALL)
assert report["verdict"] == "red" and {d["leaf"] for d in report["differences"]} == {"proc." + ping, "proc." + child}
some = host.judge(six_launches("A", both), six_launches("B", {0: {child: 1}, 3: {ping: 2, child: 2}}), a_a=True, floors=SMALL)
assert some["verdict"] == "green" and {e["kind"] for e in some["not_judged"]["kinds"]} == {ping, child}
def test_the_types_and_the_parents_of_the_pingsenders_are_not_judged_only_the_separate_executable_is():
wrong = with_pingsenders(footprint(), 3, types=("event", "event", "new-profile"))
assert any("not the pings of a first run" in p for p in judge(wrong, footprint("again"), a_a=True)["problems"])
orphan = with_pingsenders(footprint(), 3, parent="gpu")
assert any("not all spawned by the parent" in p for p in judge(orphan, footprint("again"), a_a=True)["problems"])
for fp in (wrong, orphan):
assert judge(fp, with_pingsenders(footprint("again"), 3), a_a=True)["problems"] == []
def test_the_separate_pingsender_executable_is_red_whatever_the_count():
@@ -855,7 +915,7 @@ def test_what_only_the_pingsender_touches_is_a_path_like_any_other_and_its_desti
return fp
one_side = judge(with_surface(footprint(), 3), footprint("again"), a_a=True)
assert {d["leaf"] for d in one_side["differences"]} == {"file." + imagehlp}, "its paths are paths like any other: in every launch of one side and in none of the other"
assert {d["leaf"] for d in one_side["differences"]} == {"file." + imagehlp, "proc." + host.PINGSENDER_KIND}, "its paths and its kind are like any other: in every launch of one side and in none of the other"
assert not any(d["category"] == "net" for d in one_side["differences"]), "its destinations on one side only are left out"
same = judge(with_surface(footprint(), 3), with_surface(footprint("again"), 3), a_a=True)
assert same["verdict"] == "green", same["problems"]
@@ -1771,15 +1831,17 @@ def test_what_a_pingsender_spawns_is_named_after_it_and_comes_and_goes_with_the_
got = host.derive_labels(labels, parents)
assert got == {1: "parent", 2: "socket", 3: host.PINGSENDER_KIND, 4: "socket<-pingsender", 5: host.PINGSENDER_KIND, 6: "socket<-pingsender", 7: "tab/isForBrowser"}
kinds = {"parent": 1, "socket": 1, "socket<-pingsender": 2, host.PINGSENDER_KIND: 2, "gpu": 1, "glxtest": 1, "tab/isForBrowser": 2}
# the pingsenders (and so what they spawn) on one side only: left out; the parent's own socket is compared
# the pingsenders (and so what they spawn) in every launch of one side and none of the other: red like any kind; the parent's own socket is a kind of its own
a = with_pingsenders(footprint(kinds=kinds), 3)
assert judge(a, footprint("again", kinds={k: n for k, n in kinds.items() if "pingsender" not in k}), a_a=True)["verdict"] == "green"
# on both sides the spawned processes are compared
report = judge(a, footprint("again", kinds={k: n for k, n in kinds.items() if "pingsender" not in k}), a_a=True)
assert {d["leaf"] for d in report["differences"]} == {"proc." + host.PINGSENDER_KIND, "proc.socket<-pingsender"}
# on both sides, what they spawn is listed by the launches that have it, and its count is not compared
b = with_pingsenders(footprint("again", kinds=dict(kinds, **{"socket<-pingsender": 3})), 3)
report = judge(a, b, a_a=True)
assert report["verdict"] == "red" and {(d["leaf"], d["a"], d["b"]) for d in report["differences"]} == {("proc.socket<-pingsender", 2, 3)}
lost = footprint("again", kinds={k: n for k, n in kinds.items() if k != "socket"})
assert {d["leaf"] for d in judge(with_pingsenders(footprint(kinds=kinds), 0), lost, a_a=True)["differences"]} == {"proc.socket"}, "the parent's own socket still counts"
assert report["verdict"] == "green" and report["differences"] == [] and report["not_judged"]["kinds"] == []
plain = {k: n for k, n in kinds.items() if "pingsender" not in k}
lost = footprint("again", kinds={k: n for k, n in plain.items() if k != "socket"})
assert {d["leaf"] for d in judge(footprint(kinds=plain), lost, a_a=True)["differences"]} == {"proc.socket"}, "the parent's own socket still counts"
def test_a_creator_pid_that_windows_reused_before_the_launch_is_not_in_its_tree():
@@ -2198,7 +2260,7 @@ def test_a_fake_launch_that_died_with_minus_11_is_a_red_line_with_the_evidence_a
def test_a_launch_that_did_not_end_with_0_is_in_the_verdict_of_the_run_named_by_side_seed_and_launch_whatever_launch_it_was(monkeypatch, tmp_path):
bad = crash.exit_problem(-11, False, seed=12, launch="measured")
def fake_run_seed(binary, seed, work, name=None, idle=False, datareporting_dir=None):
def fake_run_seed(binary, seed, work, name=None, idle=False, datareporting_dir=None, audit_dir=None):
fp = seed_footprint(seed)
if name is None and seed == 12:
fp["problems"] = [bad]
@@ -2483,13 +2545,16 @@ def test_a_path_only_the_gfxtest_touched_in_a_seed_where_both_sides_have_it_is_a
assert report["stale"] == ["gfxtest-69"]
def test_the_entry_covers_only_the_seeds_where_the_process_is_gone_and_the_path_of_another_seed_is_red():
def test_a_candidate_that_still_spawns_the_gfxtest_in_one_seed_does_not_show_the_declared_difference_and_lists_the_paths():
"""The kind is judged over all the launches (`file_rule`), not seed by seed: a candidate that has the gfxtest in one seed is not the 69 that no longer spawns it, the entry is stale
and red, and the paths only the gfxtest touched stay differences like any path only one engine has (no process of the candidate touches them)."""
a = with_files(footprint(), GFX_PCI, GFX_ONLY)
c = footprint("candidate", kinds={k: n for k, n in KINDS.items() if k != "gfxtest"})
c["seeds"][1]["kinds"] = dict(KINDS)
report = judge(a, c, expected=expected())
assert report["verdict"] == "red" and {(d["seed"], d["leaf"]) for d in report["differences"]} == {(SEEDS[1], "file./sys/bus/pci"), (SEEDS[1], "file./sys/bus/pci/")}
assert {d["seed"] for d in report["declared"]} == {SEEDS[0]}
assert report["verdict"] == "red" and report["stale"] == ["gfxtest-69"] and report["declared"] == []
assert {d["leaf"] for d in report["differences"]} == {"file." + p for p in GFX_PCI}, "no proc.gfxtest: the kind is in a launch of the candidate"
assert {e["kind"] for e in report["not_judged"]["kinds"]} == {"gfxtest"}
def test_the_declared_list_may_only_shrink_and_stays_applied_by_kind():
@@ -2855,19 +2920,21 @@ def test_the_list_of_datareporting_is_relative_sorted_with_sizes_and_a_read_erro
def test_an_engine_run_hands_the_datareporting_folder_to_every_launch_and_the_run_command_puts_it_next_to_the_footprint(tmp_path, monkeypatch):
got = []
def fake_run_seed(binary, seed, work, name=None, idle=False, datareporting_dir=None):
got.append((name, datareporting_dir))
def fake_run_seed(binary, seed, work, name=None, idle=False, datareporting_dir=None, audit_dir=None):
got.append((name, datareporting_dir, audit_dir))
return seed_footprint(seed)
monkeypatch.setattr(host, "run_seed", fake_run_seed)
monkeypatch.setattr(host.os.path, "realpath", lambda p: p)
host.run_engine("ff", "linux-x86_64", [11], "firefox-68", None, tmp_path / "dr")
assert got == [("warmup", tmp_path / "dr"), (None, tmp_path / "dr"), ("idle", tmp_path / "dr")]
host.run_engine("ff", "linux-x86_64", [11], "firefox-68", None, tmp_path / "dr", tmp_path / "audit")
assert got == [("warmup", tmp_path / "dr", tmp_path / "audit"), (None, tmp_path / "dr", tmp_path / "audit"), ("idle", tmp_path / "dr", tmp_path / "audit")]
seen = {}
monkeypatch.setattr(host, "run_engine", lambda binary, leg, seeds, label, crash_dir=None, datareporting_dir=None: seen.update(crash=crash_dir, dr=datareporting_dir) or {"format": host.FORMAT, "problems": []})
monkeypatch.setattr(host, "run_engine", lambda binary, leg, seeds, label, crash_dir=None, datareporting_dir=None, audit_dir=None:
seen.update(crash=crash_dir, dr=datareporting_dir, audit=audit_dir) or {"format": host.FORMAT, "problems": []})
(tmp_path / "o").mkdir()
host.main(["run", "ff", "--leg", "linux-x86_64", "--out", str(tmp_path / "o" / "footprint-68.json"), "--seeds", "11"])
assert seen["dr"] == tmp_path / "o" / "footprint-68.datareporting" and seen["crash"] == tmp_path / "o" / "footprint-68.crash"
assert seen["dr"] == tmp_path / "o" / "footprint-68.datareporting" and seen["crash"] == tmp_path / "o" / "footprint-68.crash"
assert seen["audit"] == tmp_path / "o" / "footprint-68.audit", "the raw events of the audit of every launch go in the folder that is the artifact, next to the datareporting lists"
# -
@@ -3043,3 +3110,222 @@ def test_a_stock_firefox_with_no_parent_found_is_a_broken_control_that_says_so_a
document = host.run_stock("windows-x86_64")
problems = host.stock_control_problems(document)
assert len(problems) == 1 and "parent process of the stock Firefox of Playwright was not found" in problems[0] and "does not reach the platform provider" not in problems[0]
# -
# A pid is not a process (run 45221868374): Windows hands the pid of a process that ended to the next one it creates.
def audit_with_parent(rid, pid, ppid, image, cmd, parent_image):
"""A 4688 event that also carries the image the audit gives for the creator (`ParentProcessName`)."""
return audit(rid, pid, ppid, image, cmd).replace("</EventData>", '<Data Name="ParentProcessName">%s</Data></EventData>' % parent_image)
def audit_end(rid, pid):
"""A 4689 event: the process `pid` ended."""
return ('<Event %s><System><Provider Name="Microsoft-Windows-Security-Auditing"/><EventID>4689</EventID><EventRecordID>%d</EventRecordID></System>'
'<EventData><Data Name="SubjectUserSid">S-1-5-18</Data><Data Name="Status">0x0</Data><Data Name="ProcessId">0x%x</Data>'
'<Data Name="ProcessName">%s</Data></EventData></Event>' % (NS, rid, pid, FIREFOX))
def ev(rid, pid, ppid, image=FIREFOX, parent_image="", kind=""):
return {"rid": rid, "pid": pid, "ppid": ppid, "image": image, "parent_image": parent_image, "cmd": "", "time": "", "kind": kind}
def test_the_audit_reads_the_end_of_a_process_and_the_image_of_its_creator():
xml = "\n".join([audit_with_parent(5, 102, 100, FIREFOX, "x", "C:\\lab\\ff\\FIREFOX.exe"), audit_end(6, 102), audit(7, 103, 100, FIREFOX, "y")])
events = host.parse_audit_events(xml)
assert [(e["pid"], e["parent_image"]) for e in events] == [(102, "C:\\lab\\ff\\FIREFOX.exe"), (103, "")], "the end is not a creation; a creation without the creator's image says ''"
assert host.parse_audit_ends(xml) == [{"rid": 6, "pid": 102, "image": FIREFOX, "time": ""}]
assert host.parse_audit_ends("") == []
def test_a_child_born_while_its_creator_lives_stays_in_the_tree_though_the_pid_is_taken_later_by_a_stranger():
events = [ev(1, 100, 50), ev(2, 101, 100), ev(3, 102, 101), ev(5, 101, 900, "C:\\Windows\\notepad.exe"), ev(6, 103, 101, "C:\\Windows\\notepad.exe"), ev(7, 104, 100)]
ends = [{"rid": 4, "pid": 101}, {"rid": 8, "pid": 104}]
assert [e["pid"] for e in host.process_tree(events, {100}, ends)] == [100, 101, 102, 104], "101 and its child were born alive; the stranger of record 5 and its child (6) are not"
# without the ends the stranger is still seen: it carries the pid of a process of the tree and its creator is not in the tree, so the pid is no longer that process's
assert [e["pid"] for e in host.process_tree(events, {100})] == [100, 101, 102, 104]
assert [e["rid"] for e in host.process_tree(events, {100}, ends)] == [1, 2, 3, 7], "the births of the tree are the ones before the pid was taken"
def test_a_child_registered_after_the_end_of_its_creator_is_in_the_tree_while_the_pid_has_not_been_born_again():
"""Run 45228081536: the pingsender of the parent is registered (4688) after the end (4689) of the parent: the creator's end is not a reason to leave it out. Red on e3572f28, where
the pid of a creator that had ended was no longer the tree's."""
events = [ev(1, 100, 50), ev(2, 101, 100), ev(4, 105, 101, "C:\\lab\\ff\\pingsender.exe")]
ends = [{"rid": 3, "pid": 101}]
assert [e["pid"] for e in host.process_tree(events, {100}, ends)] == [100, 101, 105]
assert [e["pid"] for e in host.process_tree(events, {100})] == [100, 101, 105], "the ends are read, they do not decide"
def test_a_child_of_a_pid_that_was_born_again_as_a_stranger_is_not_in_the_tree_the_ends_or_not():
"""Run 45221868374: `svchost -s wlidsvc`, `wevtutil` and `wsl` took pids that processes of the tree had had. The pid of the tree stops being the tree's only when the same pid is
BORN again as a process that does not join; what is born from that pid after it is the stranger's."""
events = [ev(1, 100, 50), ev(2, 101, 100), ev(4, 101, 900, "C:\\Windows\\System32\\svchost.exe"), ev(5, 105, 101, "C:\\Windows\\System32\\wevtutil.exe"), ev(6, 106, 100)]
for ends in ([], [{"rid": 3, "pid": 101}]):
assert [e["pid"] for e in host.process_tree(events, {100}, ends)] == [100, 101, 106], ends
again = [ev(1, 100, 50), ev(2, 101, 100), ev(4, 101, 100), ev(5, 105, 101)]
assert [e["pid"] for e in host.process_tree(again, {100})] == [100, 101, 101, 105], "the same pid born again from the tree is the tree's again"
def test_the_creator_the_audit_names_must_be_the_image_the_creator_was_born_with():
events = [ev(1, 100, 50), ev(2, 101, 100, parent_image="c:\\LAB\\ff\\firefox.EXE"), ev(3, 102, 100, parent_image="C:\\Windows\\System32\\python.exe"), ev(4, 103, 100)]
assert [e["pid"] for e in host.process_tree(events, {100})] == [100, 101, 103], "the same file name under another spelling or no name stays; python.exe is not firefox.exe"
assert [e["pid"] for e in host.process_tree(events, {999})] == [], "a root that never appears has no tree"
# a root born before the audit (no event of its own) has no image to compare: its children join by its pid
assert [e["pid"] for e in host.process_tree([ev(4, 7, 100, parent_image="C:\\Windows\\System32\\python.exe")], {100})] == [7]
def reconstruct_idle_launch_of_run_45221868374():
"""The 4688 and 4689 events of the idle launch of run 45221868374, rebuilt from the rows of its lifecycle (kind, start or end, order): the footprint keeps no pid
and no creator, so these are the test's. The real firefox processes: the first `parent` is the root (its creator is the oracle's pid 50), the second parent is its
child, the tabs, the utility and the pingsender are the second parent's, the last socket is the pingsender's. What the run took into the tree besides them
(`svchost -s wlidsvc`, `wevtutil`, `wsl`, and the socket of 16:59:20, born before any pingsender and whose command line names another parent) is given a pid
Windows had already handed out: the pid of the process that ended last in the tree, when one had (a process taking the pid of one that is gone, its creator the
oracle), and before any process ended, a new pid whose creator is the root's pid and whose audit names python.exe as that creator.
Returns `(events, ends)`, each event with its `kind` and `legit`."""
import collections
rows = json.loads((Path(__file__).parent / "data" / "ab_host_pid_reuse" / "45221868374" / "idle-lifecycle.json").read_text(encoding="utf-8"))["lifecycle"]
tools = {"wevtutil.exe": "C:\\Windows\\System32\\wevtutil.exe", "svchost.exe": "C:\\Windows\\System32\\svchost.exe", "wsl.exe": "C:\\Windows\\System32\\wsl.exe"}
events, ends, running, dead, rid, fresh = [], [], {}, [], 0, iter(range(2000, 3000))
seen = collections.Counter()
for row in rows:
kind, rid = row["kind"], rid + 1
if row["event"] == "end":
pid = running[kind].pop(0)
ends.append({"rid": rid, "pid": pid})
dead.append(pid)
continue
legit = kind in ("parent", "tab/isForBrowser", "utility/sandboxingKind=0", "backgroundtask/pingsender") or (kind == "socket" and seen["backgroundtask/pingsender"] > 0)
if legit:
pid = [1000, 1001][seen["parent"]] if kind == "parent" else next(fresh)
creator = {"parent": [50, 1000][min(seen["parent"], 1)], "socket": (running.get("backgroundtask/pingsender") or [None])[0]}.get(kind, 1001)
events.append(dict(ev(rid, pid, creator, FIREFOX, FIREFOX, kind), legit=True))
else:
if dead:
pid, creator, said = dead.pop(), 50, ""
else:
pid, creator, said = next(fresh), 1000, "C:\\Windows\\System32\\python.exe"
events.append(dict(ev(rid, pid, creator, tools.get(kind, FIREFOX), said, kind), legit=False))
seen[kind] += 1
running.setdefault(kind, []).append(pid)
return events, ends
def test_the_idle_launch_of_run_45221868374_has_only_the_processes_of_the_engine_in_its_tree():
events, ends = reconstruct_idle_launch_of_run_45221868374()
intruders = [e["kind"] for e in events if not e["legit"]]
assert sorted(intruders) == sorted(["svchost.exe"] * 2 + ["wevtutil.exe"] * 15 + ["wsl.exe"] * 2 + ["socket"]), "the rows of the run: what was not the engine's"
tree = host.process_tree(events, {1000}, ends)
assert [e["kind"] for e in tree if not e["legit"]] == [], "no service of the machine and no tool of the oracle is in the tree"
assert sorted(e["kind"] for e in tree) == sorted(["parent", "parent", "tab/isForBrowser", "tab/isForBrowser", "utility/sandboxingKind=0", "backgroundtask/pingsender", "socket"]), \
"every process of the engine is still in it"
# and a tree that holds none of them is a tree that can exit: every process of it ended in the run
assert {e["pid"] for e in tree} <= {x["pid"] for x in ends}
def _name(path):
return re.split(r"[\\/]", path)[-1]
# -
# The raw events of the audit of every Windows launch are saved next to the footprint (run 45228081536: a process that was or was not in the tree could not be told from the artifact).
def a_launch_with_a_stranger_and_an_end(tmp_path, monkeypatch):
stranger = audit_with_parent(30, 107, 5, "C:\\Windows\\System32\\svchost.exe", "svchost.exe -k netsvcs -p -s wlidsvc", "C:\\Windows\\System32\\services.exe")
fake = FakeTools(tmp_path, TREE + [audit_end(20, 107), stranger], TREE_FILES)
monkeypatch.setattr(host, "_tool", fake)
trace = host.WindowsTrace(tmp_path)
trace.start()
got = trace.finish({100}, alive=lambda pid: False, sleep=lambda s: None)
trace.cleanup()
return got
def test_the_audit_of_a_launch_lists_every_event_it_read_the_excluded_ones_with_the_reason(tmp_path, monkeypatch):
got = a_launch_with_a_stranger_and_an_end(tmp_path, monkeypatch)
events, ends, roots = got["audit"]
listing = host.audit_listing(events, roots, ends, "measured", 4)
assert listing["format"] == host.AUDIT_FORMAT and (listing["launch"], listing["seed"], listing["roots"]) == ("measured", 4, [100])
rows = listing["events"]
assert [r["rid"] for r in rows] == sorted(r["rid"] for r in rows) and len(rows) == len(TREE) + 2, "every 4688 and 4689 the log gave, in the order of the log"
by_rid = {r["rid"]: r for r in rows}
assert (by_rid[10]["event"], by_rid[10]["pid"], by_rid[10]["ppid"], by_rid[10]["in_tree"]) == (4688, 100, 1, True) and "root" in by_rid[10]["why"]
assert by_rid[12]["image"] == FIREFOX and by_rid[12]["in_tree"] and by_rid[12]["time"] == "" and by_rid[12]["cmd"].endswith("tab")
assert (by_rid[15]["pid"], by_rid[15]["in_tree"]) == (105, False) and "creator (pid 999) is not a process of the tree" in by_rid[15]["why"]
assert (by_rid[20]["event"], by_rid[20]["pid"], by_rid[20]["ppid"], by_rid[20]["in_tree"]) == (4689, 107, None, True)
assert by_rid[20]["image"] == FIREFOX
stranger = by_rid[30]
assert (stranger["pid"], stranger["in_tree"], stranger["parent_image"]) == (107, False, "C:\\Windows\\System32\\services.exe") and "stranger" in stranger["why"]
assert listing["in_tree"] == sum(1 for r in rows if r["in_tree"])
def test_a_creator_the_audit_names_with_another_image_is_said_in_the_reason():
events = [ev(1, 100, 50, FIREFOX), ev(2, 101, 100, "C:\\Windows\\System32\\wevtutil.exe", parent_image="C:\\Windows\\System32\\python.exe")]
(root, other) = host.walk_tree(events, {100})
assert other["in_tree"] is False and "python.exe" in other["why"] and "firefox.exe" in other["why"]
def test_the_audit_of_a_launch_is_saved_as_launch_dash_seed_json_and_a_write_that_fails_is_said_not_raised(tmp_path, monkeypatch, capsys):
got = a_launch_with_a_stranger_and_an_end(tmp_path, monkeypatch)
folder = tmp_path / "footprint-68.audit"
host.save_audit(folder, "measured", 4, got["audit"])
host.save_audit(folder, "idle", 0, got["audit"])
assert sorted(p.name for p in folder.iterdir()) == ["idle-0.json", "measured-4.json"]
saved = json.loads((folder / "measured-4.json").read_text(encoding="utf-8"))
assert saved["format"] == host.AUDIT_FORMAT and saved["events"][0]["rid"] == 10 and any(not r["in_tree"] for r in saved["events"])
host.save_audit(None, "measured", 4, got["audit"]) # no folder: nothing happens
host.save_audit(folder, "measured", 4, None) # nothing read: nothing happens
blocked = tmp_path / "file"
blocked.write_text("x", encoding="utf-8")
host.save_audit(blocked / "audit", "measured", 5, got["audit"])
assert "the audit of the tree could not be saved (seed 5, launch measured)" in capsys.readouterr().out
def test_the_audit_goes_to_the_save_and_never_into_the_footprint_the_judge_reads(tmp_path, monkeypatch):
got = a_launch_with_a_stranger_and_an_end(tmp_path, monkeypatch)
class Done:
def finish(self, roots):
return got
kept = []
monkeypatch.setattr(host, "_context", lambda binary, windows, work: host.Context("win32", app=["D:\\lab\\ff"], temp=["D:\\lab\\tmp"], devices=DEVICES))
fp = host._seed_result(FIREFOX, 4, tmp_path, [], tmp_path / "none.log", Done(), 100, True, None, kept.append)
assert kept == [got["audit"]] and "audit" not in fp and "events" not in fp and "rid" not in json.dumps(fp)
assert host.leaves_of(fp) == {}
def test_the_windows_trace_reads_the_ends_and_the_tree_leaves_the_stranger_that_took_a_pid_of_it(tmp_path, monkeypatch):
stranger = audit(30, 107, 5, "C:\\Windows\\System32\\svchost.exe", "svchost.exe -k netsvcs -p -s wlidsvc")
child = audit(31, 108, 107, "C:\\Windows\\System32\\wevtutil.exe", "wevtutil qe Security")
fake = FakeTools(tmp_path, TREE + [audit_end(20, 107), stranger, child], TREE_FILES)
monkeypatch.setattr(host, "_tool", fake)
trace = host.WindowsTrace(tmp_path)
trace.start()
got = trace.finish({100}, alive=lambda pid: False, sleep=lambda s: None)
trace.cleanup()
assert [(e["pid"], _name(e["image"])) for e in got["tree"]][-1] == (107, "pingsender.exe") and len(got["tree"]) == 6, "the svchost that has the pid of the pingsender is not the pingsender"
asked = [c for c in fake.calls if c[0] == "wevtutil" and "/c:1" not in c][0]
assert "EventID=4689" in asked[3] and trace.ends_ok is True
sets = [c for c in fake.calls if c[:2] == ["auditpol", "/set"]]
assert [c[2] for c in sets] == ["/subcategory:" + host.AUDIT_GUID, "/subcategory:" + host.AUDIT_END_GUID, "/subcategory:" + host.AUDIT_END_GUID, "/subcategory:" + host.AUDIT_GUID]
assert sets[1][-1] == "/success:enable" and sets[2][-2:] == ["/success:disable", "/failure:disable"], "the termination audit is turned on, and put back as it was"
def test_a_machine_that_cannot_audit_the_ends_says_so_and_tells_the_strangers_by_their_birth(tmp_path, monkeypatch):
fake = FakeTools(tmp_path, TREE + [audit(30, 107, 5, "C:\\Windows\\System32\\svchost.exe", "svchost.exe -k x")], TREE_FILES)
def refusing(argv, timeout=300.0):
if argv[:2] == ["auditpol", "/set"] and argv[2] == "/subcategory:" + host.AUDIT_END_GUID:
raise host.TraceError("auditpol /set failed")
return fake(argv, timeout)
monkeypatch.setattr(host, "_tool", refusing)
trace = host.WindowsTrace(tmp_path)
trace.start()
got = trace.finish({100}, alive=lambda pid: False, sleep=lambda s: None)
trace.cleanup()
assert trace.ends_ok is False and got["problems"] == []
assert [e["pid"] for e in got["tree"]] == [100, 101, 102, 103, 104, 107], "107 is the pingsender: the svchost that took its pid has a creator that is not in the tree"
assert [c[2] for c in fake.calls if c[:2] == ["auditpol", "/set"]] == ["/subcategory:" + host.AUDIT_GUID] * 2
+25 -1
View File
@@ -22,7 +22,7 @@ pytestmark = pytest.mark.unit
DATA = Path(__file__).resolve().parent / "data" / "ab_host_aa"
SMALL = {"proc": 2, "file": 3}
WINDOWS_RUNS = ("45060573559", "45077433049", "45088980743", "45077330681")
WINDOWS_RUNS = ("45060573559", "45077433049", "45088980743", "45077330681", "45228081536")
LINUX_RUN = "45088980743-linux"
BS = chr(92)
@@ -295,3 +295,27 @@ def test_the_log_prints_the_not_judged_list_with_the_watched_paths_before_the_ot
watch = next(i for i, line in enumerate(lines) if line.startswith("WATCH") and "/p/watched" in line)
other = next(i for i, line in enumerate(lines) if line.startswith("LISTED") and "/p/once" in line)
assert summary < watch < other and "2 paths, 1 to watch" in lines[summary]
def test_the_a_a_of_run_45228081536_was_red_on_the_pingsenders_and_is_green_now_that_they_are_listed():
"""Run 45228081536 (oss-invisible/playwright, job 137879971705, `e2e (host, windows)`): the A/A of the 68 was red on two lines, seed 4 side B `2 pingsender processes, not 0 or 3` and
seed 63 `proc.socket<-pingsender: A 3 | B <missing>`. The pingsenders of the 68 were in all 6 measured launches of the first run and in 4 of the second, the sockets they start in 3 and
in none: Mozilla's pingsender starts or not from a launch to the next. Now they are listed, not judged."""
first, again = real("45228081536", "68"), real("45228081536", "68-again")
assert [s["kinds"].get(host.PINGSENDER_KIND, 0) for s in again["seeds"]] == [3, 0, 2, 0, 3], "the data are the run's: 2 pingsenders in seed 4 of B"
assert first["seeds"][4]["kinds"]["socket<-pingsender"] == 3 and "socket<-pingsender" not in again["seeds"][4]["kinds"], "seed 63"
for a, b, mine, other in ((first, again, "A", "B"), (again, first, "B", "A")):
report = host.judge(a, b, a_a=True)
assert report["verdict"] == "green", report["problems"]
assert report["problems"] == [] and report["differences"] == []
listed = {e["kind"]: e for e in report["not_judged"]["kinds"]}
assert set(listed) == {host.PINGSENDER_KIND, "socket<-pingsender"}, "the pingsenders and what they start are in the list of what is not judged"
assert listed[host.PINGSENDER_KIND][mine]["measured"] == [6, 6] and listed[host.PINGSENDER_KIND][other]["measured"] == [4, 6]
assert listed["socket<-pingsender"][mine]["measured"] == [3, 6] and listed["socket<-pingsender"][other]["measured"] == [0, 6]
assert listed[host.PINGSENDER_KIND]["spawned_by"][mine] == ["parent"]
def test_the_kinds_of_a_real_run_that_are_there_in_every_launch_of_both_engines_are_not_listed():
first, again = real("45228081536", "68"), real("45228081536", "68-again")
report = host.judge(first, again, a_a=True)
assert {"parent", "rdd", "tab/isForBrowser"} & {e["kind"] for e in report["not_judged"]["kinds"]} == set()
+4
View File
@@ -716,6 +716,10 @@ def test_the_windows_host_job_turns_on_the_location_service_of_the_runner_before
assert "Set-Service -Name lfsvc -StartupType Manual" in step and "Start-Service -Name lfsvc" in step
assert "throw" in step and "'Running'" in step, "a service that is not on is red with its reason"
assert "New-Item -Path $key -Force" not in step, "-Force on an existing registry key would empty it"
# Windows' own answer, the question stock Firefox asks (run 45206303882: the keys said Allow and the provider was not started): read before and after, red unless Allowed
assert "AppCapability]::Create('location').CheckAccess()" in step and "powershell.exe" in step
assert step.index('"CheckAccess(location) before:') < step.index("Set-ItemProperty") < step.index('"CheckAccess(location) after:')
assert "if ($after -ne 'Allowed') { $bad +=" in step and step.index("if ($after -ne 'Allowed')") < step.index("if ($bad) { throw")
first_launch = body.index(" - name: Run the host oracle's A/A\n")
assert body.index(name) < first_launch, "the laboratory is set before the first launch"