Release 0.58.0: invisible-core 68.80.0 on firefox-68 (the security state of a retail profile) (#552)

* security state: fetch has the engine generate it, every launch gives the core its engine, and CI launches with a fixed ready directory

The core replaced the intermediates list with the security state (intermediates, OneCRL and the CRLite filters, generated by the engine and copied into every profile). The CLI's fetch calls update_security_state(engine=<the binary it installed>); server.py's one write_user_js passes engine=<the executable of the launch> (no engine_argv: a generation is its own headless run, the core's default line). STEALTHFOX_SECURITY_STATE replaces STEALTHFOX_INTERMEDIATES in every workflow that launches the browser (scripts/ci_lab_security_state.py, ci/security-state/ with a result and no data, pinned by sha256); the unit tests' conftest patches ensure_security_state.

Tests: tests/test_cli.py (fetch), tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py, tests/test_ci_lab_security_state.py, tests/test_ci_workflows_set_the_security_state.py, each red on the code of main.

* e2e: the engine's security state - generation, a normal launch, a certificate revoked in a CRLite delta refused at the first navigation, a launch with no state

wrapper.e2e.securitystate, both legs, in the candidate's wrapper-e2e job: the engine launched directly in its generate mode (exit, the contract's keys, the hashes are the sha256 of the files, the bytes of security_state/) and through the core's generate; a normal launch writes no security-state pref and re-imports nothing; with Mozilla's CRLite test filters and a CA on Mozilla's default test key, a leaf with the serial and SCTs of revoked-in-delta.example.com is refused with SEC_ERROR_REVOKED_CERTIFICATE at the first navigation, a valid one loads, and the revoked one loads with no state; a launch with no or an empty state starts. Red on firefox-67 (no generate mode); the last test is a guard.

* ci: the required list only grows, so the two test files of the intermediates lab keep their names and guard that the old road stays gone

The judge of main refused the list of the branch: wrapper.unit.all.* lost tests/test_ci_lab_intermediates.py and tests/test_ci_workflows_set_the_intermediates_list.py. Both files come back with tests that the lab's files and steps are gone and that every leg that had the step sets the security state (red on main, 5 of 5). The unit suites count what the candidate collected (2183 and 2184) plus these 5: 2188 on Linux, 2189 on Windows.

* ci: the unit rows count what the candidate's gate collected (2168 linux, 2169 windows)

* Release 0.58.0: invisible-core 68.80.0 on firefox-68 (the security state of a retail profile)

* test: the frames of a goto are counted once all are announced, within the goto's own deadline

With Fission the innermost frame of a-b-a lives in a third process and its
announcement may reach the client after the top document's load (2 of 3
frames 0.22 s after the goto, run 44888497316). A frame that never comes
is still red.
This commit is contained in:
Federico Elia authored and GitHub committed 2026-11-21 11:12:31 +01:00
1 parent 4c7faecde0
commit 0d3a710c02
28 files changed
+940 -270

No files matched your search

+12 -12
View File
@@ -114,11 +114,11 @@ jobs:
# the fontconfig e2e trace the opens of the browser: strace is not in the runner image (setsid is, util-linux)
sudo apt-get install -y strace
sudo "$(which python)" -m playwright install-deps firefox
# The preloaded-intermediates list is a file of the repository (ci/intermediates.json, empty, the sha256 in ci/intermediates.pin.json): with
# STEALTHFOX_INTERMEDIATES set the core neither downloads nor checks Mozilla's. BEFORE `fetch`, which makes the list present (it would download it).
- name: The intermediates list (a fixed file of the repository)
# The security state is a ready directory of the repository (ci/security-state/, a result with no data, the sha256 in ci/security-state.pin.json): with
# STEALTHFOX_SECURITY_STATE set the core neither downloads nor generates one. BEFORE `fetch`, which makes the state present (it would download and generate it).
- name: The security state (a fixed directory of the repository)
shell: bash
run: python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json
run: python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json
- name: Fetch the published firefox binary
run: echo "FF=$(python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
- name: The protocol mirror agrees with the engine it is pinned to
@@ -331,11 +331,11 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"
# The intermediates list of the repository (ci/intermediates.json, empty): with STEALTHFOX_INTERMEDIATES set the core asks Mozilla for nothing.
# BEFORE `fetch`, which makes the list present (it would download it).
- name: The intermediates list (a fixed file of the repository)
# The security state is a ready directory of the repository (ci/security-state/, a result with no data, the sha256 in ci/security-state.pin.json): with
# STEALTHFOX_SECURITY_STATE set the core neither downloads nor generates one. BEFORE `fetch`, which makes the state present (it would download and generate it).
- name: The security state (a fixed directory of the repository)
shell: bash
run: python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json
run: python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json
- name: Fetch the published firefox binary
run: echo "FF=$(python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
- name: The keyboard shortcut selects all (the browser opens on the runner's desktop, as in e2e-hunt.yml)
@@ -371,11 +371,11 @@ jobs:
python -m pip install --upgrade pip
python -m pip install ".[dev]"
python -m pip install "playwright==$(cat scripts/playwright_pin.txt)"
# The preloaded-intermediates list is a file of the repository (ci/intermediates.json, empty, the sha256 in ci/intermediates.pin.json): with
# STEALTHFOX_INTERMEDIATES set the core neither downloads nor checks Mozilla's. BEFORE `fetch`, which makes the list present (it would download it).
- name: The intermediates list (a fixed file of the repository)
# The security state is a ready directory of the repository (ci/security-state/, a result with no data, the sha256 in ci/security-state.pin.json): with
# STEALTHFOX_SECURITY_STATE set the core neither downloads nor generates one. BEFORE `fetch`, which makes the state present (it would download and generate it).
- name: The security state (a fixed directory of the repository)
shell: bash
run: python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json
run: python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json
- name: Fetch the published firefox binary
run: echo "FF=$(cd "$RUNNER_TEMP" && python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
# The GeoIP database made by the repository, as on the Linux run (no download, the same bytes every run).
+4 -4
View File
@@ -88,10 +88,10 @@ jobs:
sudo "$(which python)" -m playwright install-deps firefox
- name: Playwright's own Firefox (the control)
run: python -m playwright install firefox
# The preloaded-intermediates list is a file of the repository (ci/intermediates.json, empty, the sha256 in ci/intermediates.pin.json): with
# STEALTHFOX_INTERMEDIATES set the core neither downloads nor checks Mozilla's. BEFORE `fetch`, which makes the list present (it would download it).
- name: The intermediates list (a fixed file of the repository)
run: python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json
# The security state is a ready directory of the repository (ci/security-state/, a result with no data, the sha256 in ci/security-state.pin.json): with
# STEALTHFOX_SECURITY_STATE set the core neither downloads nor generates one. BEFORE `fetch`, which makes the state present (it would download and generate it).
- name: The security state (a fixed directory of the repository)
run: python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json
- name: Fetch the published firefox binary
run: echo "FF=$(cd "$RUNNER_TEMP" && python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
# The GeoIP database made by the repository (no download, the same bytes every run).
+4 -4
View File
@@ -234,11 +234,11 @@ jobs:
run: |
python -m ruff check --select F821,F811,F601 --no-cache --output-format concise .
# The preloaded-intermediates list is a file of the repository (ci/intermediates.json, empty, the sha256 in ci/intermediates.pin.json): with
# STEALTHFOX_INTERMEDIATES set the core neither downloads nor checks Mozilla's.
- name: The intermediates list (a fixed file of the repository)
# The security state is a ready directory of the repository (ci/security-state/, a result with no data, the sha256 in ci/security-state.pin.json): with
# STEALTHFOX_SECURITY_STATE set the core neither downloads nor generates one.
- name: The security state (a fixed directory of the repository)
shell: bash
run: python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json
run: python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json
# The GeoIP database is made by the repository (scripts/ci_lab_geoip.py: the same bytes on every run, the sha256 in ci/geoip.json), never a
# site and never a licensed file: without STEALTHFOX_GEOIP_MMDB the core asks GitHub which database is the latest on every call
+14
View File
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.58.0] - 2026-11-21
### Changed
- Pins invisible-core 68.80.0 on the engine firefox-68 (Firefox 159.0).
- Every profile starts with the security state a retail Firefox has: the intermediate certificates, OneCRL and the CRLite revocation filters.
`invisible-playwright fetch` downloads them from Mozilla's service and has the engine build them once; every launch copies the result into its
profile. Filters ten days old or more are left out, as a retail Firefox does, with one warning that says to run `fetch`.
### Fixed
- `networkidle` waits for the end of the document request that is still arriving when the page is cut, instead of ending early.
- A navigation the page's process reports as aborted while the parent is still carrying its request now waits for that request, so a
`goto` no longer fails with a false abort.
- Behind a SOCKS5 proxy, WebRTC sockets on ports Windows reserves no longer take the proxy's UDP association from the sockets that work.
## [0.57.1] - 2026-11-20
### Fixed
-1
View File
@@ -1 +0,0 @@
{"format":1,"collection":"security-state/intermediates","collection_timestamp":0,"fetched_utc":"1970-01-01T00:00:00Z","count":0,"set_sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","certs":[]}
-6
View File
@@ -1,6 +0,0 @@
{
"comment": "The preloaded-intermediates list every CI leg launches with (STEALTHFOX_INTERMEDIATES): EMPTY (format 1, no certificates), so a leg never asks Mozilla for the real list (the core neither downloads nor checks when the variable is set) and every run has the same bytes. Set by scripts/ci_lab_intermediates.py. To change the list, change ci/intermediates.json and sha256 here in one commit; `set` refuses to go on when they differ. The real list is looked at only by what the release proves about the product.",
"file": "ci/intermediates.json",
"sha256": "f4f6a2332a4d589a1e8aaa4e73c820644a764125bb2970667afc7351e7cb3465",
"bytes": 219
}
+3 -2
View File
@@ -14,6 +14,7 @@
{"id": "wrapper.e2e.fakeweb", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "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), each judged against what stock Firefox does, as tests/fakeweb/pages.json declares it. 4 = 3 + 1. 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": 2168, "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_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.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_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.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_actions_without_a_point.py", "tests/test_add_script_tag.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_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.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_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.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_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_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_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.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_legacy_in_the_wrapper.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", "tests/test_popup_adoption_unit.py", "tests/test_prefs_composition_arm.py", "tests/test_preload_newtab_is_written_only_when_asked.py", "tests/test_protocol_names_are_declared.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_publish_gate_wiring.py", "tests/teLine truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 2169, "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_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.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_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.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_actions_without_a_point.py", "tests/test_add_script_tag.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_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.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_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.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_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_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_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_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_legacy_in_the_wrapper.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", "tests/test_popup_adoption_unit.py", "tests/test_prefs_composition_arm.py", "tests/test_prefs_composition_arm_on_windows.py", "tests/test_preload_newtab_is_written_only_when_asked.py", "tests/test_protocol_names_are_declared.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_publish_gate_wirLine truncated
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 2178, "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_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.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_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.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_actions_without_a_point.py", "tests/test_add_script_tag.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_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_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.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_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_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_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.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_legacy_in_the_wrapper.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", "tests/test_popup_adoption_unit.py", "tests/test_prefs_composition_arm.py", "tests/test_preload_newtabLine truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 2179, "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_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.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_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.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_actions_without_a_point.py", "tests/test_add_script_tag.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_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_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.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_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_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_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_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_legacy_in_the_wrapper.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", "tests/test_popup_adoption_unit.py", "tests/test_prefs_composition_arm.py", "tests/test_prefs_composition_arm_on_windows.py", "tests/tLine 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)."}
]
+6
View File
@@ -0,0 +1,6 @@
{
"comment": "The ready security state every job of ci.yml launches with (STEALTHFOX_SECURITY_STATE, set at the top of the workflow): a result with NO data (format 1, ok, no CRLite hashes, zero timestamps, no engine) and no security_state/ directory, so a launch copies nothing and no job asks Mozilla for anything or runs the engine's generate mode (the core neither downloads nor generates when the variable is set). To change it, change ci/security-state/securitystate-result.json and sha256 here in one commit; tests/test_ci_sets_the_security_state.py fails when they differ.",
"file": "ci/security-state/securitystate-result.json",
"sha256": "15bed64b8d0d0db9e6e5cceeec231bbca5300cdc6715280a647895dd6f6f14a4",
"bytes": 260
}
@@ -0,0 +1 @@
{"format":1,"ok":true,"error":null,"engine":{"version":"","build_id":""},"collections":{"intermediates":{"collection_timestamp":0},"onecrl":{"collection_timestamp":0},"cert-revocations":{"collection_timestamp":0,"channel":"default"}},"crlite_filter_hashes":[]}
+2 -2
View File
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "invisible_playwright"
version = "0.57.1"
version = "0.58.0"
description = "Playwright wrapper for a patched Firefox with deterministic stealth profile."
readme = "README.md"
requires-python = ">=3.11"
@@ -69,7 +69,7 @@ dependencies = [
# metadata; nothing in src/ hardcodes a second copy (tests/test_core_pin.py
# fails if one appears). What stays invisible to install-time machinery is the
# --no-deps / lockfile residue, and _pin.py is the only layer that sees it.
"invisible_core==67.79.0",
"invisible_core==68.80.0",
# ⛔ playwright is NO LONGER a dependency: since the full fork, the Python
# client lives in src/invisible_playwright/_pw/ and its server in
# src/invisible_playwright/_juggler/ (no Node driver). Reintroducing it would not visibly
-82
View File
@@ -1,82 +0,0 @@
"""The preloaded-intermediates list of a CI leg: a fixed (empty) file of the repository, and the variable that makes the core use it.
python scripts/ci_lab_intermediates.py set [--pin ci/intermediates.pin.json] # checks the file against the pin, exports STEALTHFOX_INTERMEDIATES
Why this exists: without ``STEALTHFOX_INTERMEDIATES`` the core downloads Mozilla's intermediates list on a cold cache (in line, at the first launch or at
`invisible_playwright fetch`) and asks once a week whether it changed, from the python of the test. A CI leg reaches no site for its data and every run has to
have the same bytes, so the leg launches with ``ci/intermediates.json``: a valid list in the engine's format 1 with no certificate. With the variable set the
core neither downloads nor checks, ever. ``ci/intermediates.pin.json`` holds the sha256 of the file: ``set`` refuses to go on when the file is not that.
``set`` writes ``STEALTHFOX_INTERMEDIATES=<absolute path>`` to ``$GITHUB_ENV`` (every later step of the job sees it) and, when there is no
``$GITHUB_ENV``, to stdout. The paths of the pin are relative to the repository, not to the working directory of the caller.
"""
from __future__ import annotations
import argparse
import hashlib
import json
import os
import sys
from pathlib import Path
ENV = "STEALTHFOX_INTERMEDIATES"
ROOT = Path(__file__).resolve().parents[1]
class Refused(Exception):
pass
def sha256_of(path) -> str:
return hashlib.sha256(Path(path).read_bytes()).hexdigest()
def load_pin(path) -> dict:
try:
pin = json.loads(Path(path).read_text(encoding="utf-8"))
except (OSError, ValueError) as exc:
raise Refused("the pin %s cannot be read: %s" % (path, exc))
sha = pin.get("sha256") if isinstance(pin, dict) else None
if not isinstance(sha, str) or len(sha) != 64 or any(c not in "0123456789abcdef" for c in sha):
raise Refused("the pin %s has no sha256 that is a sha256" % path)
if not isinstance(pin.get("file"), str) or not pin["file"]:
raise Refused("the pin %s names no file" % path)
return pin
def resolve(pin: dict, pin_path) -> Path:
"""The file the pin names, checked against its sha256: a file that is not the pinned one is refused."""
target = Path(pin["file"])
if not target.is_absolute():
target = ROOT / target
if not target.is_file():
raise Refused("the file %s of the pin cannot be found" % pin["file"])
got = sha256_of(target)
if got != pin["sha256"]:
raise Refused("%s has sha256 %s, the pin says %s: change both in one commit" % (pin["file"], got, pin["sha256"]))
return target.resolve()
def main(argv=None) -> int:
ap = argparse.ArgumentParser(description=__doc__.split("\n", 1)[0])
sub = ap.add_subparsers(dest="cmd", required=True)
s = sub.add_parser("set")
s.add_argument("--pin", default="ci/intermediates.pin.json")
ns = ap.parse_args(argv)
try:
path = resolve(load_pin(ns.pin), ns.pin)
except Refused as exc:
print("ci_lab_intermediates: %s" % exc, file=sys.stderr)
return 1
line = "%s=%s" % (ENV, path)
env_file = os.environ.get("GITHUB_ENV")
if env_file:
with open(env_file, "a", encoding="utf-8", newline="\n") as fh:
fh.write(line + "\n")
else:
print(line)
return 0
if __name__ == "__main__":
sys.exit(main())
+87
View File
@@ -0,0 +1,87 @@
"""The security state of a CI leg: a fixed, ready directory of the repository, and the variable that makes the core use it.
python scripts/ci_lab_security_state.py set [--pin ci/security-state.pin.json] # checks the directory against the pin, exports STEALTHFOX_SECURITY_STATE
Why this exists: without ``STEALTHFOX_SECURITY_STATE`` the core downloads Mozilla's security-state collections on a cold cache (in line, at the first launch or at
`invisible_playwright fetch`), has the engine generate the state from them and copies it into every profile. A CI leg reaches no site for its data, runs no generation and
every run has to have the same bytes, so the leg launches with ``ci/security-state/``: a ready directory that holds ONLY ``securitystate-result.json`` (a result with no
data: format 1, ok, no CRLite hashes, zero timestamps, no engine) and no ``security_state/``, so a launch copies nothing. With the variable set the core neither downloads
nor generates, ever. ``ci/security-state.pin.json`` holds the sha256 of that file: ``set`` refuses to go on when the file is not that, or when the directory holds
anything else.
``set`` writes ``STEALTHFOX_SECURITY_STATE=<absolute directory>`` to ``$GITHUB_ENV`` (every later step of the job sees it) and, when there is no ``$GITHUB_ENV``, to
stdout. The paths of the pin are relative to the repository, not to the working directory of the caller.
"""
from __future__ import annotations
import argparse
import hashlib
import json
import os
import sys
from pathlib import Path
ENV = "STEALTHFOX_SECURITY_STATE"
ROOT = Path(__file__).resolve().parents[1]
class Refused(Exception):
pass
def sha256_of(path) -> str:
return hashlib.sha256(Path(path).read_bytes()).hexdigest()
def load_pin(path) -> dict:
try:
pin = json.loads(Path(path).read_text(encoding="utf-8"))
except (OSError, ValueError) as exc:
raise Refused("the pin %s cannot be read: %s" % (path, exc))
sha = pin.get("sha256") if isinstance(pin, dict) else None
if not isinstance(sha, str) or len(sha) != 64 or any(c not in "0123456789abcdef" for c in sha):
raise Refused("the pin %s has no sha256 that is a sha256" % path)
if not isinstance(pin.get("file"), str) or not pin["file"]:
raise Refused("the pin %s names no file" % path)
return pin
def resolve(pin: dict, pin_path) -> Path:
"""The directory of the file the pin names, checked: the file has the pinned sha256 and it is the ONLY entry of its directory."""
target = Path(pin["file"])
if not target.is_absolute():
target = ROOT / target
if not target.is_file():
raise Refused("the file %s of the pin cannot be found" % pin["file"])
got = sha256_of(target)
if got != pin["sha256"]:
raise Refused("%s has sha256 %s, the pin says %s: change both in one commit" % (pin["file"], got, pin["sha256"]))
others = sorted(p.name for p in target.parent.iterdir() if p.name != target.name)
if others:
raise Refused("the directory %s holds more than %s: %s" % (target.parent, target.name, ", ".join(others)))
return target.parent.resolve()
def main(argv=None) -> int:
ap = argparse.ArgumentParser(description=__doc__.split("\n", 1)[0])
sub = ap.add_subparsers(dest="cmd", required=True)
s = sub.add_parser("set")
s.add_argument("--pin", default="ci/security-state.pin.json")
ns = ap.parse_args(argv)
try:
path = resolve(load_pin(ns.pin), ns.pin)
except Refused as exc:
print("ci_lab_security_state: %s" % exc, file=sys.stderr)
return 1
line = "%s=%s" % (ENV, path)
env_file = os.environ.get("GITHUB_ENV")
if env_file:
with open(env_file, "a", encoding="utf-8", newline="\n") as fh:
fh.write(line + "\n")
else:
print(line)
return 0
if __name__ == "__main__":
sys.exit(main())
+5 -1
View File
@@ -6261,7 +6261,11 @@ class BrowserTypeDispatcher(Dispatcher):
# profile sees them; without it, the language alone decides.
keyboard_layout = prefs.pop(KEYBOARD_LAYOUT_PREF, None) or profiles_pref(
prefs.get("intl.accept_languages") or "")
write_user_js(profile, prefs)
# The security state is placed in the profile by this one call, FOR THE ENGINE THIS LAUNCH RUNS: a generation is tied to its
# build id, so the core is told which binary it is (`engine=`). `engine_argv` is NOT passed: the line this launch runs is
# headed or headless, with `-juggler-pipe` and the caller's `args`, none of which a generation may use (it is its own
# headless run on a work profile); the core's default line for the engine is the right one.
write_user_js(profile, prefs, engine=executable)
# ⛔ THE CALLER'S TIMEOUT, not ours. `launch(timeout=)` is a
# documented option and this server ignored it, so a caller who
# shortened it waited the full built-in 60 s anyway - and one who
+7 -6
View File
@@ -38,7 +38,7 @@ import argparse
import sys
from . import __version__
from invisible_core import BINARY_VERSION, FIREFOX_UPSTREAM_VERSION, update_intermediates
from invisible_core import BINARY_VERSION, FIREFOX_UPSTREAM_VERSION, update_security_state
from invisible_core.download import cache_root, engine_root, ensure_binary # noqa: F401
from ._pin import (
@@ -86,13 +86,14 @@ def _cmd_fetch(_args: argparse.Namespace) -> int:
except Exception as e:
print(f"error: {e}", file=sys.stderr)
return 1
# The list of preloaded intermediate certificates the core declares to the engine: `fetch` is where the user asks for what is current, so it looks for a
# newer list EVERY time (a small request to the changes feed; the list is downloaded only when it changed) and puts it in the cache. A launch only reads the
# cache. A failure here is a warning and nothing more: it changes neither the exit code nor the last line (`update_intermediates` itself does not raise).
# The security state the core copies into every profile (the intermediates, OneCRL and the CRLite filters a retail Firefox has from its first second): `fetch` is
# where the user asks for what is current, so it looks for newer data EVERY time (a small request to the changes feed; a collection is downloaded only when it
# changed), has THIS engine generate the state from it and puts the result in the cache. A launch only copies from the cache. A failure here is a warning and
# nothing more: it changes neither the exit code nor the last line (`update_security_state` itself does not raise).
try:
update_intermediates()
update_security_state(engine=path)
except Exception as e:
print(f"warning: the intermediates list could not be fetched: {e}", file=sys.stderr)
print(f"warning: the security state could not be fetched: {e}", file=sys.stderr)
# Last line, alone, so `$(invisible-playwright fetch)` is a path.
print(path)
return 0
+8 -7
View File
@@ -172,19 +172,20 @@ def _what_the_core_declares_for_a_proxy_is_recorded(monkeypatch):
@pytest.fixture(autouse=True)
def _a_unit_test_asks_mozilla_for_no_intermediates_list(request, monkeypatch):
"""Outside the e2e, a launch declares no intermediates list.
def _a_unit_test_asks_mozilla_for_no_security_state(request, monkeypatch):
"""Outside the e2e, a launch asks Mozilla for nothing and runs no generation.
The core's `write_user_js` (every launch the server makes) declares Mozilla's list: on a cold cache it downloads it in line, and the line it writes would
differ with the cache of whoever runs the test. The function is stubbed, as the core's own suite does (tests/conftest.py of invisible-core): no list, no
request. The tests of `fetch` set their own; a test marked `e2e` gets the real one (the CI legs point it at the empty file of `ci/intermediates.json`)."""
The core's `write_user_js` (every launch the server makes) places the security state in the profile: on a cold cache it downloads Mozilla's collections in line and
has the engine generate the state from them, and what it copies would differ with the cache of whoever runs the test. The function the launch calls
(`ensure_security_state`) is stubbed, as the core's own suite does (tests/conftest.py of invisible-core): nothing ready, no request, no engine. The tests of `fetch`
set their own; a test marked `e2e` gets the real one (the CI legs point STEALTHFOX_SECURITY_STATE at the ready directory of `ci/security-state/`)."""
if request.node.get_closest_marker("e2e") is not None:
return
try:
import invisible_core._intermediates as _im
import invisible_core._security_state as _ss
except Exception: # the package is absent: the tests that need it say so
return
monkeypatch.setattr(_im, "ensure_intermediates", lambda *a, **kw: None)
monkeypatch.setattr(_ss, "ensure_security_state", lambda *a, **kw: None)
@pytest.fixture(autouse=True)
+1
View File
@@ -0,0 +1 @@
{"format":1,"source":"Mozilla's security/manager/ssl/tests/unit/test_crlite_filters","files":{"20200101-0-filter":{"path":"security/manager/ssl/tests/unit/test_crlite_filters/20200101-0-filter","sha256":"3c116fb9feacdf83b74fd0a4d38b9427df19733021b97ff40e9aa53f8e81b71b","base64":"AwABAAAAAAAAAFQiJZjzPTZIBULa7ODmuU3hXA7ujFkUykjXXjxIToA/AAAAAAAAAAB/TnFOGAkAAAEAAAAAAAAAIAAAAAAAAABUIiWY8z02SAVC2uzg5rlN4VwO7oxZFMpI1148SE6APwIAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABgAAAAAAAAA="},"20200101-1-filter.delta":{"path":"security/manager/ssl/tests/unit/test_crlite_filters/20200101-1-filter.delta","sha256":"27a608525e50b97ca3b8d6e9b91a517be681731576efda99a6b02d3024b968bb","base64":"AwABAAAAAAAAAFQiJZjzPTZIBULa7ODmuU3hXA7ujFkUykjXXjxIToA/AAAAAAAAAAB/TnFOGAkAAAEAAAAAAAAAIAAAAAAAAABUIiWY8z02SAVC2uzg5rlN4VwO7oxZFMpI1148SE6APwEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAAAAAA=="},"int.pem":{"path":"security/manager/ssl/tests/unit/test_crlite_filters/int.pem","sha256":"4b604e9b4254131a85fad2bca65fde30e53b68feeab9144e9db08b84ada5a365","base64":"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5akNDQWJLZ0F3SUJBZ0lVVXhuMGYrZFl5bFNtUzM1Nkx2RFZQWWFYdHlzd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0RURUxNQWtHQTFVRUF3d0NZMkV3SWhnUE1qQXlNREF4TURFd01EQXdNREJhR0E4eU1ESXdNREl3TVRBdwpNREF3TUZvd0RqRU1NQW9HQTFVRUF3d0RhVzUwTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCCkNnS0NBUUVBdW9oUnFFU09GdFpCL1c2MmlBWTJFRDA4RTlucTVEVkt0T3oxYUZkc0pIdkJ4eVdvNE5nZnZiR2MKQnB0dUdvYnlhK0t2V25WcmFtUnhDSHFsV3FkRmgvY2MxU1NjQW43TlEvd2VhZEE0SUNtVHF5RERTZVRidVV6QwphMndPN1JXQ0QvRityV2thc2RNQ09vc3FRZTZuY09BUERZMzlaZ3Nyc0NTU3BIMjVpR0Y1a0xGWGtEM1NPOFhnCnVFZ2ZxRGZUaUVQdkp4YllWYmRtV3FwK0FwQXZPbnNRZ0FZa3pCeHNsNjJXWVZ1MzRwWVN3SFV4b3d5UjNiVEsKOS95dEhTWFRDZSs1Rnc2bmFPR3pleThpYjJuanRJcVZZUjN1SnRZbG5hdVJDRTQyeXh3a0JDeS9Gb3N2NWZHUAptUmN4dUxQK1NTUDZjbEhFTWRVRHJOb1lDalh0alFJREFRQUJveDB3R3pBTUJnTlZIUk1FQlRBREFRSC9NQXNHCkExVWREd1FFQXdJQkJqQU5CZ2txaGtpRzl3MEJBUXNGQUFPQ0FRRUFodEdyNlZoZHJiOXJIZEpoTUhIck9YNEsKbFlDL0ZBVmhkY2R4RG8vN2JGam5ON1RYWFd4VjgzUzBwK01SRmw5Tk9Xa1A0SzJGSGVOUDd4OTdPcE4xOTIvSgo2V3ZsT01Wbk8zc0o0c21GRlFscVpYNVBoZzNTYk5rU01EdFJJOUd0TllSTHNJanpTb2d4VzFCZldpTDNZdnJSCnNIYlROV01DR2d1cUZlUkdZVjhQQ2ZhMjBJcDdqZDZwbXRsQ0ZTWmY1T3JYQjl2QnA5azZTS0hhSXpXMk5xTDUKTjV6TUwvcXIrS0x3cFRjVGVweEcrVHkzUzZIVnE0eWMwaVUrMDRWNS9yM0V1Rk5VTTIvTTV0OXRQN1lxTnA1QwprU1BEVGw0RzRsQU1NN1hHOXVHYytrR0JURHI3QmZyY0RBM0hqZG00NVE0UUJ4ZkZYNGhzN2JFOGp6OHFWdz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K"},"valid.example.com.pem":{"path":"security/manager/ssl/tests/unit/test_crlite_filters/valid.example.com.pem","sha256":"14cf7809b590b9eb7a6fa0263f38a7b8113b701d1969462eb7e7c0ae8614676b","base64":"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVYekNDQTBlZ0F3SUJBZ0lVZmNreElWR3pIVzE4SW1YZG9YNEFreHZmRll3d0RRWUpLb1pJaHZjTkFRRUwKQlFBd0RqRU1NQW9HQTFVRUF3d0RhVzUwTUNJWUR6SXdNakF3TVRBeE1EQXdNREF3V2hnUE1qQXlNREF5TURFdwpNREF3TURCYU1Cd3hHakFZQmdOVkJBTU1FWFpoYkdsa0xtVjRZVzF3YkdVdVkyOXRNSUlCSWpBTkJna3Foa2lHCjl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF1b2hScUVTT0Z0WkIvVzYyaUFZMkVEMDhFOW5xNURWS3RPejEKYUZkc0pIdkJ4eVdvNE5nZnZiR2NCcHR1R29ieWErS3ZXblZyYW1SeENIcWxXcWRGaC9jYzFTU2NBbjdOUS93ZQphZEE0SUNtVHF5RERTZVRidVV6Q2Eyd083UldDRC9GK3JXa2FzZE1DT29zcVFlNm5jT0FQRFkzOVpnc3JzQ1NTCnBIMjVpR0Y1a0xGWGtEM1NPOFhndUVnZnFEZlRpRVB2SnhiWVZiZG1XcXArQXBBdk9uc1FnQVlrekJ4c2w2MlcKWVZ1MzRwWVN3SFV4b3d5UjNiVEs5L3l0SFNYVENlKzVGdzZuYU9HemV5OGliMm5qdElxVllSM3VKdFlsbmF1UgpDRTQyeXh3a0JDeS9Gb3N2NWZHUG1SY3h1TFArU1NQNmNsSEVNZFVEck5vWUNqWHRqUUlEQVFBQm80SUJvVENDCkFaMHdIQVlEVlIwUkJCVXdFNElSZG1Gc2FXUXVaWGhoYlhCc1pTNWpiMjB3TWdZSUt3WUJCUVVIQVFFRUpqQWsKTUNJR0NDc0dBUVVGQnpBQmhoWm9kSFJ3T2k4dmJHOWpZV3hvYjNOME9qZzRPRGd2TUlJQlJ3WUtLd1lCQkFIVwplUUlFQWdTQ0FUY0VnZ0V6QVRFQkx3QlVJaVdZOHowMlNBVkMydXpnNXJsTjRWd083b3haRk1wSTExNDhTRTZBClB3QUFBVzllWnVnQUFBQUVBUUVBYlNsdmRPeGM1bmtEbDJlY1hDL0NxZStRTHRRNzhqWkJmbDZPZCs0TlNVTloKK1lYVUkxSk93aXYwdHNlMmhjTDR4cHBkMHlnbzRGV2VYSDVwbkFCOTBCdnJZQXcraXh0VzNHQ0VyRzVGVE1KTwpNUVZlUE8yd2I1dDB3VWJrQlRpYmZ4NjlhcTU5dW43T211R25TZDBCbnJrK2x5eVo4VHdhaDRQMmlzOHJCTnB6Cis2ZDBjd0ZWTnJCU2tNWkhTUWdpWnIySS84Z2ZuY0VDcVBTSzhFMjV4cUdVY0UwT0JkczdDcW9EL0txTzUzQ0sKeWhzdTEvbG55MGpFQnhyTDZ5dDlKZ2VqeVF0dzF4TW5uQWlFY0dsTGtCbUFYNVR4VGMvZGtnMWtXY3ZRYTM0ZgpnbEZieUpDM3hrWThpK2dJcDRsTVJ1QVV3VWRiVHROTTFqNktUSVgzU1RBTkJna3Foa2lHOXcwQkFRc0ZBQU9DCkFRRUFRejRFYmFsOFgzb084Unl4V29oRHByTndNVGVnR1ZYY3Ntd1lsSUhJQjFYa0xsb2Q4aVk0dGNNQ2Y4UmsKbEFURE9vSXNsZjdNenNZcVd6dHBpT1RSREczUTFmS25qa0tzak9mRTQzMkxwNitDVEdWVm9aSTlMeFdkL25EegpPd01rbm1NRDJiWHVxK1pzdG1LRDRxanN3Yi9ZRy9rN2VtQ21EQ0s2Q1l4T05nRzNSSkpmUDZ0UW84b1hVQ3RFCnpIQ1M0bEhTWjcxOEFqTnpBZURxNEc2WHBzN0RNVHVEYmRMVEhMVFdVUTZ1N2o5c3k1cTFzUmU2S2VZWklUU20KMWZ2WjYwWG5zblF5cVdYSGVTekxCb2pVdzlTQVlEOC9ZVnZQWXRWaHNnR0JXeHFOY0VBNmJCZUxXbkVNeUhocgpDMVlkZEFSd1FDM1JJSjZ5MFk0eTRHek42QT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K"},"revoked-in-delta.example.com.pem":{"path":"security/manager/ssl/tests/unit/test_crlite_filters/revoked-in-delta.example.com.pem","sha256":"93bc3e3494e14ec7a828c205678d1736ca6310288Line truncated
@@ -0,0 +1,5 @@
{
"format": 1,
"source": "security/manager/tools/pykey.py, RSAKey.shared* (the key of the specification `default`)",
"pem": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC6iFGoRI4W1kH9\nbraIBjYQPTwT2erkNUq07PVoV2wke8HHJajg2B+9sZwGm24ahvJr4q9adWtqZHEI\neqVap0WH9xzVJJwCfs1D/B5p0DggKZOrIMNJ5Nu5TMJrbA7tFYIP8X6taRqx0wI6\niypB7qdw4A8Njf1mCyuwJJKkfbmIYXmQsVeQPdI7xeC4SB+oN9OIQ+8nFthVt2Za\nqn4CkC86exCABiTMHGyXrZZhW7filhLAdTGjDJHdtMr3/K0dJdMJ77kXDqdo4bN7\nLyJvaeO0ipVhHe4m1iWdq5EITjbLHCQELL8Wiy/l8Y+ZFzG4s/5JI/pyUcQx1QOs\n2hgKNe2NAgMBAAECggEBAJ7LzjhhpFTsseD+j4XdQ8kvWCXOLpl4hNDhqUnaosWs\nVZskBFDlrJ/gw+McDu+mUlpl8MIhlABO4atGPd6e6CKHzJPnRqkZKcXmrD2IdT9s\nJbpZeec+XY+yOREaPNq4pLDN9fnKsF8SM6ODNcZLVWBSXn47kq18dQTPHcfLAFeI\nr8vh6Pld90AqFRUw1YCDRoZOs3CqeZVqWHhiy1M3kTB/cNkcltItABppAJuSPGgz\niMnzbLm16+ZDAgQceNkIIGuHAJy4yrrK09vbJ5L7kRss9NtmA1hb6a4Mo7jmQXqg\nSwbkcOoaO1gcoDpngckxW2KzDmAR8iRyWUbuxXxtlEECgYEA3W4dT//r9o2InE0R\nTNqqnKpjpZN0KGyKXCmnF7umA3VkTVyqZ0xLi8cyY1hkYiDkVQ12CKwn1Vttt0+N\ngSfvj6CQmLaRR94GVXNEfhg9Iv59iFrOtRPZWB3V4HwakPXOCHneExNx7O/JznLp\nxD3BJ9I4GQ3oEXc8pdGTAfSMdCsCgYEA16dz2evDgKdn0v7Ak0rU6LVmckB3Gs3r\nta15b0eP7E1FmF77yVMpaCicjYkQL63yHzTi3UlA66jAnW0fFtzClyl3TEMnXpJR\n3b5JCeH9O/Hkvt9Go5uLODMo70rjuVuS8gcK8myefFybWH/t3gXo59hspXiG+xZY\nEKd7mEW8MScCgYEAlkcrQaYQwK3hryJmwWAONnE1W6QtS1oOtOnX6zWBQAul3RMs\n2xpekyjHu8C7sBVeoZKXLt+X0SdR2Pz2rlcqMLHqMJqHEt1OMyQdse5FX8CT9byb\nWS11bmYhR08ywHryL7J100B5KzK6JZC7smGu+5WiWO6lN2VTFb6cJNGRmS0CgYAo\ntFCnp1qFZBOyvab3pj49lk+57PUOOCPvbMjo+ibuQT+LnRIFVA8Su+egx2got7pl\nrYPMpND+KiIBFOGzXQPVqFv+Jwa9UPzmz83VcbRspiG47UfWBbvnZbCqSgZlrCU2\nTaIBVAMuEgS4VZ0+NPtbF3yaVv+TUQpaSmKHwVHeLQKBgCgGe5NVgB0u9S36ltit\ntYlnPPjuipxv9yruq+nva+WKT0q/BfeIlH3IUf2qNFQhR6caJGv7BU7naqNGq80m\nks/J5ExR5vBpxzXgc7oBn2pyFJYckbJoccrqv48GRBigJpDjmo1f8wZ7fNt/ULH1\nNBinA5ZsT8d0v3QCr2xDJH9D\n-----END PRIVATE KEY-----\n"
}
@@ -0,0 +1,69 @@
"""A launch tells the core WHICH ENGINE it runs, so the security state it copies into the profile was generated by that engine.
The core places the security state (intermediates, OneCRL, CRLite) in a profile inside `write_user_js`, and a generation is tied to the engine's build id. The server's one
call `write_user_js(profile, prefs)` named no engine, so the core fell back to the SEALED engine: with an engine the caller chose (`executable_path=`) the state was looked up
and, on a cold cache, generated for another binary. The launch passes `engine=<the executable it runs>`; `engine_argv` stays the core's default, because the line this launch
runs (`-juggler-pipe`, headed or headless, the caller's `args`) is not a line a generation may use.
Known-bad: the call without `engine=`; it reaches `ensure_security_state` with `engine=None`.
"""
from __future__ import annotations
import pytest
from invisible_core.juggler.connection import EventListeners
from invisible_playwright._juggler import server as module
from invisible_playwright._juggler.server import BrowserTypeDispatcher, JugglerServer
from _browser_census import closes_with_the_test
class _Engine(EventListeners):
def __init__(self):
EventListeners.__init__(self)
closes_with_the_test(self)
def send(self, method, params=None, session=None, timeout=30.0):
return {"browserContextId": "ctx-1", "targetId": "t-1"}
def startup_send(self, method, params=None):
return self.send(method, params, timeout=None)
def close(self, timeout=5.0):
pass
def _launch(monkeypatch, **params):
server = JugglerServer()
server.attach(type("R", (), {"emit_message": lambda self, m: None})())
monkeypatch.setattr(module.juggler, "launch", lambda executable, profile_dir, **kwargs: _Engine())
try:
BrowserTypeDispatcher(server).op_launch(dict({"executablePath": "the-engine-of-this-launch", "firefoxUserPrefs": {}}, **params))
finally:
server.shutdown()
@pytest.mark.unit
def test_the_launch_asks_the_core_for_the_security_state_of_the_engine_it_runs(monkeypatch):
"""Through the core's real `write_user_js` and `place_security_state`: what reaches `ensure_security_state` is the engine of the launch and no launch line."""
import invisible_core._security_state as security_state
seen = []
monkeypatch.setattr(security_state, "ensure_security_state", lambda *a, **kw: seen.append(kw) or None)
_launch(monkeypatch)
assert len(seen) == 1, seen
assert seen[0].get("engine") == "the-engine-of-this-launch"
assert seen[0].get("engine_argv") is None, "the launch line of the session is not a generation's line"
@pytest.mark.unit
def test_the_engine_is_the_one_the_caller_chose_for_a_headed_launch_with_arguments_too(monkeypatch):
import invisible_core._security_state as security_state
seen = []
monkeypatch.setattr(security_state, "ensure_security_state", lambda *a, **kw: seen.append(kw) or None)
_launch(monkeypatch, headless=False, args=["-width", "800"])
assert [(kw.get("engine"), kw.get("engine_argv")) for kw in seen] == [("the-engine-of-this-launch", None)]
+15 -77
View File
@@ -1,7 +1,10 @@
"""scripts/ci_lab_intermediates.py: a CI leg launches with a fixed list of intermediates that the repository holds, and the core is told so."""
import hashlib
import importlib.util
import json
"""The intermediates lab of the CI is gone: the security state replaced it (scripts/ci_lab_security_state.py, ci/security-state/).
The core no longer declares an intermediates list: it copies a ready security state (intermediates, OneCRL and the CRLite filters, generated by the
engine) into every profile, and a CI leg points STEALTHFOX_SECURITY_STATE at a fixed directory of the repository. A leftover of the old lab (the
script, its pinned list, a workflow that still exports STEALTHFOX_INTERMEDIATES) would be a second road that nothing reads. The file keeps its name
because ci/required-suites.json only grows (scripts/ci_verdict.py, against main): its tests now guard that the old road stays gone.
"""
from pathlib import Path
import pytest
@@ -11,78 +14,13 @@ pytestmark = pytest.mark.unit
ROOT = Path(__file__).resolve().parents[1]
def _load():
spec = importlib.util.spec_from_file_location("ci_lab_intermediates_under_test", ROOT / "scripts" / "ci_lab_intermediates.py")
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
def test_the_files_of_the_intermediates_lab_are_gone():
for rel in ("scripts/ci_lab_intermediates.py", "ci/intermediates.json", "ci/intermediates.pin.json"):
assert not (ROOT / rel).exists(), "%s is a leftover of the intermediates lab" % rel
lab = _load()
PIN = ROOT / "ci" / "intermediates.pin.json"
LIST = ROOT / "ci" / "intermediates.json"
RUN = "python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json"
def test_the_pin_is_the_hash_of_the_file_it_names():
pin = lab.load_pin(PIN)
assert pin["file"] == "ci/intermediates.json" and pin["comment"]
assert hashlib.sha256(LIST.read_bytes()).hexdigest() == pin["sha256"]
assert len(LIST.read_bytes()) == pin["bytes"]
def test_the_file_is_a_valid_list_of_format_1_with_no_certificate():
raw = LIST.read_bytes()
listing = json.loads(raw)
assert listing["format"] == 1 and listing["collection"] == "security-state/intermediates"
assert listing["count"] == len(listing["certs"]) == 0
assert listing["set_sha256"] == hashlib.sha256(b"").hexdigest() # the hash of no derHash at all
assert list(listing) == ["format", "collection", "collection_timestamp", "fetched_utc", "count", "set_sha256", "certs"]
assert raw == json.dumps(listing, separators=(",", ":"), ensure_ascii=True).encode("utf-8"), "not written as the core writes it (compact, no final newline)"
def test_set_writes_the_variable_with_the_absolute_path_to_github_env(tmp_path, monkeypatch):
env_file = tmp_path / "github_env"
monkeypatch.setenv("GITHUB_ENV", str(env_file))
assert lab.main(["set", "--pin", str(PIN)]) == 0
assert env_file.read_text(encoding="utf-8") == "STEALTHFOX_INTERMEDIATES=%s\n" % LIST.resolve()
assert Path(LIST.resolve()).is_absolute()
def test_without_github_env_it_prints_the_line(monkeypatch, capsys):
monkeypatch.delenv("GITHUB_ENV", raising=False)
assert lab.main(["set", "--pin", str(PIN)]) == 0
assert capsys.readouterr().out == "STEALTHFOX_INTERMEDIATES=%s\n" % LIST.resolve()
def test_a_file_that_is_not_the_pinned_one_is_refused_and_exports_nothing(tmp_path, monkeypatch, capsys):
other = tmp_path / "other.json"
other.write_bytes(LIST.read_bytes() + b"\n")
pin = tmp_path / "pin.json"
pin.write_text(json.dumps({"file": str(other), "sha256": lab.load_pin(PIN)["sha256"]}), encoding="utf-8")
env_file = tmp_path / "github_env"
monkeypatch.setenv("GITHUB_ENV", str(env_file))
assert lab.main(["set", "--pin", str(pin)]) == 1
assert not env_file.exists()
assert "change both in one commit" in capsys.readouterr().err
def test_a_pin_that_is_not_a_pin_or_names_a_missing_file_is_refused(tmp_path, monkeypatch):
monkeypatch.delenv("GITHUB_ENV", raising=False)
bad = tmp_path / "pin.json"
for text in ("not json", "{}", json.dumps({"file": "x", "sha256": "xyz"}), json.dumps({"sha256": "0" * 64})):
bad.write_text(text, encoding="utf-8")
with pytest.raises(lab.Refused):
lab.load_pin(bad)
assert lab.main(["set", "--pin", str(bad)]) == 1
bad.write_text(json.dumps({"file": str(tmp_path / "nowhere.json"), "sha256": "0" * 64}), encoding="utf-8")
assert lab.main(["set", "--pin", str(bad)]) == 1
def test_the_command_runs_as_the_workflows_run_it():
import subprocess
import sys
done = subprocess.run([sys.executable] + RUN.split()[1:], cwd=ROOT, capture_output=True, text=True, env={k: v for k, v in __import__("os").environ.items() if k != "GITHUB_ENV"})
assert done.returncode == 0, done.stderr
assert done.stdout == "STEALTHFOX_INTERMEDIATES=%s\n" % LIST.resolve()
def test_no_workflow_names_the_intermediates_lab():
for wf in sorted((ROOT / ".github" / "workflows").glob("*.yml")):
text = wf.read_text(encoding="utf-8")
for word in ("STEALTHFOX_INTERMEDIATES", "ci_lab_intermediates", "intermediates.pin.json"):
assert word not in text, "%s still names %s" % (wf.name, word)
+110
View File
@@ -0,0 +1,110 @@
"""scripts/ci_lab_security_state.py: a CI leg launches with a fixed, ready security state that the repository holds, and the core is told so."""
import hashlib
import importlib.util
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
import pytest
pytestmark = pytest.mark.unit
ROOT = Path(__file__).resolve().parents[1]
def _load():
spec = importlib.util.spec_from_file_location("ci_lab_security_state_under_test", ROOT / "scripts" / "ci_lab_security_state.py")
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
lab = _load()
PIN = ROOT / "ci" / "security-state.pin.json"
RESULT = ROOT / "ci" / "security-state" / "securitystate-result.json"
RUN = "python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json"
def test_the_pin_is_the_hash_of_the_file_it_names():
pin = lab.load_pin(PIN)
assert pin["file"] == "ci/security-state/securitystate-result.json" and pin["comment"]
assert hashlib.sha256(RESULT.read_bytes()).hexdigest() == pin["sha256"]
assert len(RESULT.read_bytes()) == pin["bytes"]
def test_the_directory_is_a_ready_state_with_no_data():
"""A result with no data: ok, no engine, zero timestamps, no CRLite hashes; and no `security_state/`, so a launch copies nothing."""
result = json.loads(RESULT.read_bytes())
assert result["format"] == 1 and result["ok"] is True and result["error"] is None
assert result["engine"] == {"version": "", "build_id": ""}
assert result["crlite_filter_hashes"] == []
assert all(c["collection_timestamp"] == 0 for c in result["collections"].values())
assert sorted(p.name for p in RESULT.parent.iterdir()) == ["securitystate-result.json"]
def test_set_writes_the_variable_with_the_absolute_directory_to_github_env(tmp_path, monkeypatch):
env_file = tmp_path / "github_env"
monkeypatch.setenv("GITHUB_ENV", str(env_file))
assert lab.main(["set", "--pin", str(PIN)]) == 0
assert env_file.read_text(encoding="utf-8") == "STEALTHFOX_SECURITY_STATE=%s\n" % RESULT.parent.resolve()
assert Path(RESULT.parent.resolve()).is_absolute()
def test_without_github_env_it_prints_the_line(monkeypatch, capsys):
monkeypatch.delenv("GITHUB_ENV", raising=False)
assert lab.main(["set", "--pin", str(PIN)]) == 0
assert capsys.readouterr().out == "STEALTHFOX_SECURITY_STATE=%s\n" % RESULT.parent.resolve()
def _copy_of_the_state(tmp_path):
directory = tmp_path / "state"
directory.mkdir()
shutil.copy(RESULT, directory / RESULT.name)
pin = tmp_path / "pin.json"
pin.write_text(json.dumps({"file": str(directory / RESULT.name), "sha256": lab.load_pin(PIN)["sha256"]}), encoding="utf-8")
return directory, pin
def test_a_file_that_is_not_the_pinned_one_is_refused_and_exports_nothing(tmp_path, monkeypatch, capsys):
directory, pin = _copy_of_the_state(tmp_path)
(directory / RESULT.name).write_bytes(RESULT.read_bytes() + b"\n")
env_file = tmp_path / "github_env"
monkeypatch.setenv("GITHUB_ENV", str(env_file))
assert lab.main(["set", "--pin", str(pin)]) == 1
assert not env_file.exists()
assert "change both in one commit" in capsys.readouterr().err
def test_a_directory_that_holds_anything_else_is_refused_and_exports_nothing(tmp_path, monkeypatch, capsys):
"""Data in the directory would be copied into every profile of the leg: the leg launches with NO data, and the pin only vouches for the one file."""
directory, pin = _copy_of_the_state(tmp_path)
env_file = tmp_path / "github_env"
monkeypatch.setenv("GITHUB_ENV", str(env_file))
assert lab.main(["set", "--pin", str(pin)]) == 0
env_file.unlink()
(directory / "security_state").mkdir()
(directory / "security_state" / "data.safe.bin").write_bytes(b"x")
assert lab.main(["set", "--pin", str(pin)]) == 1
assert not env_file.exists()
assert "security_state" in capsys.readouterr().err
def test_a_pin_that_is_not_a_pin_or_names_a_missing_file_is_refused(tmp_path, monkeypatch):
monkeypatch.delenv("GITHUB_ENV", raising=False)
bad = tmp_path / "pin.json"
for text in ("not json", "{}", json.dumps({"file": "x", "sha256": "xyz"}), json.dumps({"sha256": "0" * 64})):
bad.write_text(text, encoding="utf-8")
with pytest.raises(lab.Refused):
lab.load_pin(bad)
assert lab.main(["set", "--pin", str(bad)]) == 1
bad.write_text(json.dumps({"file": str(tmp_path / "nowhere.json"), "sha256": "0" * 64}), encoding="utf-8")
assert lab.main(["set", "--pin", str(bad)]) == 1
def test_the_command_runs_as_the_workflows_run_it():
done = subprocess.run([sys.executable] + RUN.split()[1:], cwd=ROOT, capture_output=True, text=True, env={k: v for k, v in os.environ.items() if k != "GITHUB_ENV"})
assert done.returncode == 0, done.stderr
assert done.stdout == "STEALTHFOX_SECURITY_STATE=%s\n" % RESULT.parent.resolve()
@@ -1,9 +1,8 @@
"""The workflows that run the wrapper's tests launch with the intermediates list of ci/intermediates.json, so the core asks Mozilla for nothing.
"""No workflow sets an intermediates list any more: the legs that did set the security state in its place.
Without STEALTHFOX_INTERMEDIATES the core downloads Mozilla's intermediates list on a cold cache (`invisible_playwright fetch` and the first launch) and checks
it once a week. tests.yml and e2e.yml (its Linux run, its Windows parts and the Windows job of Control+A) set the variable (scripts/ci_lab_intermediates.py set) ONCE, before the step that
runs pytest and, where the leg has one, before the step that fetches the engine (`fetch` makes the list present, so it would be the first to download).
user-install.yml proves the installation a user gets and is left as it is.
The step "The intermediates list (a fixed file of the repository)" of e2e.yml, fakeweb.yml and tests.yml became "The security state (a fixed
directory of the repository)" (tests/test_ci_workflows_set_the_security_state.py says where and how). The file keeps its name because
ci/required-suites.json only grows (scripts/ci_verdict.py, against main): its test now guards that no leg goes back to the old step.
"""
from pathlib import Path
@@ -12,48 +11,11 @@ import pytest
pytestmark = pytest.mark.unit
WORKFLOWS = Path(__file__).resolve().parents[1] / ".github" / "workflows"
SET = "python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json"
FETCH = " - name: Fetch the published firefox binary\n"
RUNS_PYTEST = {
"tests.yml": " - name: Run pytest\n",
"e2e.yml": " - name: Run the full e2e suite under a virtual display, without the root ones\n",
"e2e.yml#windows": " - name: Run this part of the e2e\n",
"e2e.yml#control-a": " - name: The keyboard shortcut selects all",
"fakeweb.yml": " - name: Profile P2, stock first and ours second",
}
COMMAND = "python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json"
def _scope(name):
"""The text of one workflow, or of one leg of it: `e2e.yml` is its Linux job, `e2e.yml#windows` its Windows parts, `e2e.yml#control-a` the
Windows job of the keyboard shortcut (it fetches and launches too)."""
file, _, leg = name.partition("#")
text = (WORKFLOWS / file).read_text(encoding="utf-8")
if file != "e2e.yml":
return text
windows = text.index("\n e2e-windows:\n")
if leg == "windows":
return text[windows:]
if leg == "control-a":
start = text.index("\n e2e-windows-control-a:\n")
return text[start:windows] if start < windows else text[start:]
ends = [i for i in (text.find("\n e2e-windows-control-a:\n"), windows) if i >= 0]
return text[:min(ends)]
@pytest.mark.parametrize("name, pytest_step", sorted(RUNS_PYTEST.items()))
def test_the_list_is_set_once_before_the_step_that_runs_the_tests(name, pytest_step):
text = _scope(name)
assert text.count(SET) == 1, "%s sets the intermediates list %d times" % (name, text.count(SET))
assert pytest_step in text, "the step that runs the tests of %s moved: update this test with it" % name
assert text.index(SET) < text.index(pytest_step), "%s sets the list after the tests started" % name
@pytest.mark.parametrize("name", ["e2e.yml", "e2e.yml#windows", "e2e.yml#control-a", "fakeweb.yml"])
def test_the_list_is_set_before_the_engine_is_fetched(name):
text = _scope(name)
assert FETCH in text, "the fetch step of %s moved: update this test with it" % name
assert text.index(SET) < text.index(FETCH), "%s fetches before the list is set: `fetch` would download Mozilla's" % name
def test_the_workflow_that_proves_the_installation_is_left_alone():
assert SET not in (WORKFLOWS / "user-install.yml").read_text(encoding="utf-8")
@pytest.mark.parametrize("name", ["e2e.yml", "fakeweb.yml", "tests.yml"])
def test_the_leg_sets_the_security_state_and_no_intermediates_list(name):
text = (WORKFLOWS / name).read_text(encoding="utf-8")
assert "- name: The intermediates list" not in text, "%s still has the intermediates step" % name
assert COMMAND in text, "%s does not set the security state" % name
@@ -0,0 +1,60 @@
"""The workflows that run the wrapper's tests launch with the ready security state of ci/security-state/, so the core asks Mozilla for nothing and runs no generation.
Without STEALTHFOX_SECURITY_STATE the core downloads Mozilla's security-state collections on a cold cache (`invisible_playwright fetch` and the first launch) and has the
engine generate the state from them. tests.yml, fakeweb.yml and e2e.yml (its Linux run, its Windows parts and the Windows job of Control+A) set the variable
(scripts/ci_lab_security_state.py set) ONCE, before the step that runs pytest and, where the leg has one, before the step that fetches the engine (`fetch` makes the state
present, so it would be the first to download and generate).
user-install.yml proves the installation a user gets and is left as it is.
"""
from pathlib import Path
import pytest
pytestmark = pytest.mark.unit
WORKFLOWS = Path(__file__).resolve().parents[1] / ".github" / "workflows"
SET = "python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json"
FETCH = " - name: Fetch the published firefox binary\n"
RUNS_PYTEST = {
"tests.yml": " - name: Run pytest\n",
"e2e.yml": " - name: Run the full e2e suite under a virtual display, without the root ones\n",
"e2e.yml#windows": " - name: Run this part of the e2e\n",
"e2e.yml#control-a": " - name: The keyboard shortcut selects all",
"fakeweb.yml": " - name: Profile P2, stock first and ours second",
}
def _scope(name):
"""The text of one workflow, or of one leg of it: `e2e.yml` is its Linux job, `e2e.yml#windows` its Windows parts, `e2e.yml#control-a` the
Windows job of the keyboard shortcut (it fetches and launches too)."""
file, _, leg = name.partition("#")
text = (WORKFLOWS / file).read_text(encoding="utf-8")
if file != "e2e.yml":
return text
windows = text.index("\n e2e-windows:\n")
if leg == "windows":
return text[windows:]
if leg == "control-a":
start = text.index("\n e2e-windows-control-a:\n")
return text[start:windows] if start < windows else text[start:]
ends = [i for i in (text.find("\n e2e-windows-control-a:\n"), windows) if i >= 0]
return text[:min(ends)]
@pytest.mark.parametrize("name, pytest_step", sorted(RUNS_PYTEST.items()))
def test_the_security_state_is_set_once_before_the_step_that_runs_the_tests(name, pytest_step):
text = _scope(name)
assert text.count(SET) == 1, "%s sets the security state %d times" % (name, text.count(SET))
assert pytest_step in text, "the step that runs the tests of %s moved: update this test with it" % name
assert text.index(SET) < text.index(pytest_step), "%s sets the security state after the tests started" % name
@pytest.mark.parametrize("name", ["e2e.yml", "e2e.yml#windows", "e2e.yml#control-a", "fakeweb.yml"])
def test_the_security_state_is_set_before_the_engine_is_fetched(name):
text = _scope(name)
assert FETCH in text, "the fetch step of %s moved: update this test with it" % name
assert text.index(SET) < text.index(FETCH), "%s fetches before the security state is set: `fetch` would download Mozilla's and generate" % name
def test_the_workflow_that_proves_the_installation_is_left_alone():
assert SET not in (WORKFLOWS / "user-install.yml").read_text(encoding="utf-8")
+15 -13
View File
@@ -8,9 +8,9 @@ from invisible_playwright import cli
@pytest.fixture(autouse=True)
def _fetch_does_not_download_the_intermediates(monkeypatch):
"""`fetch` also looks for a newer intermediates list (`update_intermediates`), which reaches Mozilla: a test that is not about it does not."""
monkeypatch.setattr("invisible_playwright.cli.update_intermediates", lambda *a, **k: (None, False), raising=False)
def _fetch_does_not_download_the_security_state(monkeypatch):
"""`fetch` also looks for a newer security state (`update_security_state`), which reaches Mozilla and runs the engine: a test that is not about it does not."""
monkeypatch.setattr("invisible_playwright.cli.update_security_state", lambda *a, **k: (None, False))
@pytest.mark.unit
@@ -105,27 +105,29 @@ def test_fetch_prints_the_path_as_its_last_line(tmp_path, monkeypatch, capsys):
@pytest.mark.unit
def test_fetch_looks_for_a_newer_intermediates_list_after_the_engine(tmp_path, monkeypatch, capsys):
"""The known-bad is a `fetch` that only makes sure a list is cached (`ensure_intermediates`, no request on a warm cache): a user who runs `fetch` asking for
what is current keeps a stale list. The engine is made present, then `update_intermediates` is called (and `ensure_intermediates` is not), in that
order, and the path of the engine is still the last line."""
def test_fetch_looks_for_a_newer_security_state_after_the_engine_and_for_that_engine(tmp_path, monkeypatch, capsys):
"""The known-bad is a `fetch` that still calls the removed `update_intermediates` (or none at all): a user who runs `fetch` asking for what is current keeps a stale
state, or the engine is never asked to generate one. The engine is made present, then `update_security_state` is called with THAT engine (and
`update_intermediates` is not), in that order, and the path of the engine is still the last line."""
fake = tmp_path / "firefox.exe"
fake.write_text("x")
calls = []
monkeypatch.setattr("invisible_playwright.cli.ensure_binary", lambda: calls.append("engine") or fake)
monkeypatch.setattr("invisible_playwright.cli.update_intermediates", lambda *a, **k: calls.append("update") or (None, False), raising=False)
monkeypatch.setattr("invisible_playwright.cli.ensure_intermediates", lambda *a, **k: calls.append("ensure"), raising=False)
monkeypatch.setattr("invisible_playwright.cli.update_security_state", lambda *a, **k: calls.append(("update", a, k)) or (None, False))
monkeypatch.setattr("invisible_core.update_security_state", lambda *a, **k: calls.append(("core", a, k)) or (None, False))
monkeypatch.setattr("invisible_core.update_intermediates", lambda *a, **k: calls.append("intermediates"), raising=False)
monkeypatch.setattr("invisible_playwright.cli.update_intermediates", lambda *a, **k: calls.append("intermediates"), raising=False)
monkeypatch.setattr("invisible_core.download.iter_cached_engines", lambda: [])
rc = cli.main(["fetch"])
assert rc == 0
assert calls == ["engine", "update"]
assert calls == ["engine", ("update", (), {"engine": fake})]
assert capsys.readouterr().out.strip().splitlines()[-1] == str(fake)
@pytest.mark.unit
def test_a_failing_intermediates_list_is_a_warning_and_changes_neither_the_exit_nor_the_last_line(tmp_path, monkeypatch, capsys):
def test_a_failing_security_state_is_a_warning_and_changes_neither_the_exit_nor_the_last_line(tmp_path, monkeypatch, capsys):
fake = tmp_path / "firefox.exe"
fake.write_text("x")
@@ -133,14 +135,14 @@ def test_a_failing_intermediates_list_is_a_warning_and_changes_neither_the_exit_
raise RuntimeError("no route to host")
monkeypatch.setattr("invisible_playwright.cli.ensure_binary", lambda: fake)
monkeypatch.setattr("invisible_playwright.cli.update_intermediates", refuses)
monkeypatch.setattr("invisible_playwright.cli.update_security_state", refuses)
monkeypatch.setattr("invisible_core.download.iter_cached_engines", lambda: [])
rc = cli.main(["fetch"])
cap = capsys.readouterr()
assert rc == 0
assert "no route to host" in cap.err and "intermediates" in cap.err
assert "no route to host" in cap.err and "security state" in cap.err
assert cap.out.strip().splitlines()[-1] == str(fake)
+2 -2
View File
@@ -254,9 +254,9 @@ def test_the_workflow_runs_stock_and_ours_and_never_reruns_or_forgives():
assert "|| true" not in WORKFLOW and "|| echo" not in WORKFLOW
assert "fetch | tail -1" in WORKFLOW # the published engine, as e2e.yml
assert "gh run download" not in WORKFLOW # no engine of a named run: the candidate runs the entry itself
# the lab database and the intermediates list are made by the repository before the first launch (the scripts launch the core as the tests do)
# the lab database and the security state are made by the repository before the first launch (the scripts launch the core as the tests do)
first_run = WORKFLOW.index(" - name: Profile P2")
assert WORKFLOW.index("scripts/ci_lab_geoip.py build") < first_run and WORKFLOW.index("scripts/ci_lab_intermediates.py set") < WORKFLOW.index("fetch | tail -1")
assert WORKFLOW.index("scripts/ci_lab_geoip.py build") < first_run and WORKFLOW.index("scripts/ci_lab_security_state.py set") < WORKFLOW.index("fetch | tail -1")
def test_the_workflow_starts_on_the_fake_web_files_of_a_pull_request_and_of_main_and_by_hand():
+10 -1
View File
@@ -24,6 +24,7 @@ from http.server import BaseHTTPRequestHandler
import pytest
from _servers import LocalServer
from _waits import awatch
pytestmark = pytest.mark.e2e
@@ -119,6 +120,10 @@ def site():
thread.join()
async def _pump():
await asyncio.sleep(0.05)
def _run(firefox_binary, scenario):
from invisible_playwright.async_api import InvisiblePlaywright
@@ -145,7 +150,11 @@ def test_a_goto_to_the_address_the_page_is_at_ends_every_time(firefox_binary, si
response = await page.goto(url, timeout=30000)
took = time.monotonic() - began
title = await page.title()
seen.append((i, response.status if response else None, page.url, title, len(page.frames), round(took, 2)))
# The frames are counted once they have all been announced, within the goto's own 30 s: with Fission the innermost frame of a-b-a lives
# in a third process, and its announcement may reach the client after the top document's load (measured: 2 of 3 after 0.22 s, run
# 44888497316). A frame that never comes is still red below.
frames_seen = await awatch(lambda: len(page.frames), lambda n: n >= frames, 30, _pump)
seen.append((i, response.status if response else None, page.url, title, frames_seen.history[-1][1], round(took, 2)))
return seen
seen = _run(firefox_binary, scenario)
+1 -1
View File
@@ -73,7 +73,7 @@ _LEAKS = ("PYTHONPATH", "PYTHONHOME", "VIRTUAL_ENV",
"INVISIBLE_PLAYWRIGHT_ENGINE_DIR", "INVISIBLE_PLAYWRIGHT_CACHE_DIR",
"INVISIBLE_DOWNLOAD_DEADLINE", "STEALTHFOX_GITHUB_TOKEN", "GITHUB_TOKEN",
"INVISIBLE_SEAL_FILE", "INVISIBLE_CORE_PIN", "INVISIBLE_CORE_AUTOFIX",
"INVISIBLE_CORE_AUTOFIX_TIMEOUT", "UV", "STEALTHFOX_GEOIP_MMDB", "STEALTHFOX_INTERMEDIATES",
"INVISIBLE_CORE_AUTOFIX_TIMEOUT", "UV", "STEALTHFOX_GEOIP_MMDB", "STEALTHFOX_SECURITY_STATE",
"STEALTHFOX_FONT_MANIFEST", "STEALTHFOX_WEBRTC_NETWORK",
"INVPW_CURSOR_TIMER", "INVISIBLE_CORE_AUTOFIX_ATTEMPTED",
"INVPW_SESSION_TOKEN", "INVPW_DESKTOP")
+488
View File
@@ -0,0 +1,488 @@
"""The security state the core declares, against the engine: generated by the engine, copied into a profile, read by the first navigation.
A retail Firefox has, in `cert_storage`, the intermediates of the public web, OneCRL and the CRLite filters from its first second. The core downloads the three inputs
(`intermediates.json`, `onecrl.json`, `crlite.json` and the filter files) and does not write cert_storage itself: the engine has a GENERATE MODE, a launch whose profile
holds exactly four prefs (`zoom.stealth.securitystate.generate` and the paths of the three files), which imports them through its own code, writes
`<profile>/securitystate-result.json` and `<profile>/security_state/`, prints nothing and exits 0 only when the result says ok. A normal launch imports nothing: the core
copies a ready `security_state/` into the profile (`STEALTHFOX_SECURITY_STATE` names a ready directory), and Juggler hands the client nothing before cert_storage has read it.
What is proved here, on the engine in use:
1. the engine, launched directly as the contract says, generates what it is given: the result has exactly the contract's keys and says the inputs' timestamps, channel
and filter hashes, and `security_state/` holds the database and the bytes of the full filter and of the delta; the core's own validation (`generate`) passes on it;
2. a normal launch declares no pref of the mode, leaves no result file and re-imports nothing (the filter and the delta in the profile are the ready directory's bytes);
3. a certificate that Mozilla's CRLite test data say is revoked in a DELTA is refused at the FIRST navigation of the first page (SEC_ERROR_REVOKED_CERTIFICATE), and one that
is not revoked loads. The same revoked certificate loads when the ready directory holds no data, so the refusal comes from the security state and from nothing else;
4. a launch with a ready directory that has no `security_state/`, or an empty one, starts and loads a page.
The CRLite data are Mozilla's own test data (`security/manager/ssl/tests/unit/test_crlite_filters/`: the filters, and the certificates they say are revoked), in
`tests/data/security_state_crlite.json` (per file: Mozilla's path, sha256, base64; the sha256 is checked before use). The filters are keyed on the issuer's public key
and on the serial of the leaf (and on the timestamps of its SCTs), so the test builds, on every run, certificates that have the same issuer key (Mozilla's `int.pem` has no
key specification in its certspec: its key is the one `pykey.py` calls `default`, in `tests/data/security_state_default_key.json`) and the same serials and SCT
extensions as Mozilla's `revoked-in-delta.example.com.pem` and `valid.example.com.pem`, signed by a fresh root that the profile trusts and valid now. Everything is on loopback.
"""
from __future__ import annotations
import base64
import configparser
import datetime
import hashlib
import ipaddress
import json
import os
import ssl
import subprocess
import sys
import threading
from http.server import BaseHTTPRequestHandler
from pathlib import Path
import pytest
from _servers import LocalServer
pytestmark = pytest.mark.e2e
DATA = Path(__file__).resolve().parent / "data"
GENERATE_TIMEOUT_S = 120
PREF_GENERATE = "zoom.stealth.securitystate.generate"
PREF_INTERMEDIATES = "zoom.stealth.intermediates.file"
PREF_ONECRL = "zoom.stealth.onecrl.file"
PREF_CRLITE = "zoom.stealth.crlite.file"
MODE_PREFS = (PREF_GENERATE, PREF_INTERMEDIATES, PREF_ONECRL, PREF_CRLITE)
RESULT_NAME = "securitystate-result.json"
STATE_DIR = "security_state"
FULL = "20200101-0-filter"
DELTA = "20200101-1-filter.delta"
REVOKED_NAME = "revoked-in-delta.example.com.pem"
VALID_NAME = "valid.example.com.pem"
INTERMEDIATES_TS = 1763000000001
ONECRL_TS = 1763000000002
CRLITE_TS = 1763000000003
SEC_ERROR_REVOKED_CERTIFICATE = "SEC_ERROR_REVOKED_CERTIFICATE"
#: The result of a ready directory that holds no data (the one of the core's ci/security-state): a launch with it copies nothing.
RESULT_WITHOUT_DATA = {"format": 1, "ok": True, "error": None, "engine": {"version": "", "build_id": ""},
"collections": {"intermediates": {"collection_timestamp": 0}, "onecrl": {"collection_timestamp": 0},
"cert-revocations": {"collection_timestamp": 0, "channel": "default"}},
"crlite_filter_hashes": []}
# --- the engine under test -------------------------------------------------------------------------------------------------------------------------------
@pytest.fixture(scope="module")
def ff(request):
"""The engine: STEALTHFOX_E2E_BINARY, else what the whole suite uses (INVPW_BINARY_PATH, or the cached one)."""
declared = os.environ.get("STEALTHFOX_E2E_BINARY")
if declared and os.path.exists(declared):
return declared
return request.getfixturevalue("firefox_binary")
def _application_ini(binary):
parser = configparser.RawConfigParser()
parser.read(str(Path(binary).parent / "application.ini"), encoding="utf-8")
return parser["App"]["BuildID"], parser["App"]["Version"]
# --- processes ---------------------------------------------------------------------------------------------------------------------------------------------
def _kill_tree(proc):
"""The process and everything it started."""
import psutil
try:
parent = psutil.Process(proc.pid)
victims = parent.children(recursive=True) + [parent]
except psutil.NoSuchProcess:
return
for victim in victims:
try:
victim.kill()
except psutil.NoSuchProcess:
pass
proc.wait()
def _engine_env(work: Path) -> dict:
"""The environment of a direct launch of the engine: its per-user directories inside `work`, so that nothing is written outside it."""
env = dict(os.environ)
for variable, name in (("XDG_CONFIG_HOME", "xdg-config"), ("XDG_CACHE_HOME", "xdg-cache"), ("APPDATA", "appdata"), ("LOCALAPPDATA", "localappdata"),
("HOME", "home"), ("TMP", "tmp"), ("TEMP", "tmp"), ("TMPDIR", "tmp")):
directory = work / name
directory.mkdir(exist_ok=True)
env[variable] = str(directory)
env["MOZ_CRASHREPORTER_DISABLE"] = "1"
return env
def _run_to_the_end(argv, env, cwd, timeout_s):
"""Runs `argv` with nothing on stdout and stderr; (exit code, None) or (None, "timed out ...") with its whole tree ended."""
flags = getattr(subprocess, "CREATE_NO_WINDOW", 0) if sys.platform == "win32" else 0
proc = subprocess.Popen(argv, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, env=env, cwd=str(cwd), creationflags=flags)
try:
try:
return proc.wait(timeout=timeout_s), None
except subprocess.TimeoutExpired:
return None, "did not finish within %s s" % timeout_s
finally:
_kill_tree(proc)
# --- the files the core would write ----------------------------------------------------------------------------------------------------------------------------
def _crlite_data():
return json.loads((DATA / "security_state_crlite.json").read_bytes().decode("utf-8"))["files"]
def _crlite_file(name):
"""The bytes of one of Mozilla's test files, after its sha256 is checked."""
entry = _crlite_data()[name]
raw = base64.b64decode(entry["base64"], validate=True)
assert hashlib.sha256(raw).hexdigest() == entry["sha256"], "%s of tests/data/security_state_crlite.json is not the bytes it says" % name
return raw
def _x509():
from cryptography import x509
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.x509.oid import NameOID
return x509, hashes, serialization, ec, NameOID
def _der(cert):
return cert.public_bytes(_x509()[2].Encoding.DER)
def _b64(raw):
return base64.b64encode(raw).decode("ascii")
def _utc(moment):
return moment.strftime("%Y-%m-%dT%H:%M:%SZ")
def _a_few_intermediates(now):
"""Self-made certificates in the format of the core's list: a few, with the hash of each DER and its subject."""
x509, hashes, _serialization, ec, name_oid = _x509()
certs = []
for n in range(3):
key = ec.generate_private_key(ec.SECP256R1())
name = x509.Name([x509.NameAttribute(name_oid.COMMON_NAME, "Security State Test Intermediate %d" % n)])
cert = (x509.CertificateBuilder().subject_name(name).issuer_name(name).public_key(key.public_key()).serial_number(x509.random_serial_number())
.not_valid_before(now - datetime.timedelta(days=1)).not_valid_after(now + datetime.timedelta(days=30))
.add_extension(x509.BasicConstraints(ca=True, path_length=0), critical=True).sign(key, hashes.SHA256()))
raw = _der(cert)
certs.append({"derHash": _b64(hashlib.sha256(raw).digest()), "cert": _b64(raw), "subject": _b64(name.public_bytes())})
certs.sort(key=lambda c: c["derHash"])
return certs
def _make_inputs(directory):
"""The three files the core declares and the two filter files, in `directory`: `Inputs`."""
from invisible_core._security_state_generate import Inputs
now = datetime.datetime.now(datetime.timezone.utc).replace(microsecond=0)
certs = _a_few_intermediates(now)
intermediates = {"format": 1, "collection": "security-state/intermediates", "collection_timestamp": INTERMEDIATES_TS, "fetched_utc": _utc(now),
"count": len(certs), "set_sha256": hashlib.sha256("\n".join(sorted(c["derHash"] for c in certs)).encode("ascii")).hexdigest(), "certs": certs}
onecrl = {"format": 1, "collection": "onecrl", "collection_timestamp": ONECRL_TS, "updated_utc": _utc(now),
"revocations": [{"issuerName": _b64(hashlib.sha256(b"issuer-%d" % n).digest()), "serialNumber": _b64(hashlib.sha256(b"serial-%d" % n).digest()[:16])} for n in range(3)]
+ [{"subject": _b64(hashlib.sha256(b"subject").digest()), "pubKeyHash": _b64(hashlib.sha256(b"key").digest())}]}
parts = {}
for name in (FULL, DELTA):
raw = _crlite_file(name)
(directory / name).write_bytes(raw)
parts[name] = {"file": name, "sha256": hashlib.sha256(raw).hexdigest(), "size": len(raw)}
crlite = {"format": 1, "collection": "cert-revocations", "channel": "default", "collection_timestamp": CRLITE_TS, "updated_utc": _utc(now),
"full": parts[FULL], "deltas": [parts[DELTA]]}
for file_name, document in (("intermediates.json", intermediates), ("onecrl.json", onecrl), ("crlite.json", crlite)):
(directory / file_name).write_bytes(json.dumps(document, separators=(",", ":")).encode("utf-8"))
return Inputs(directory / "intermediates.json", directory / "onecrl.json", directory / "crlite.json")
@pytest.fixture(scope="module")
def inputs(tmp_path_factory):
"""The inputs of the generate mode, made once for the module."""
return _make_inputs(tmp_path_factory.mktemp("security-state-inputs"))
# --- the generation ----------------------------------------------------------------------------------------------------------------------------------------
def _user_js(inputs) -> bytes:
"""EXACTLY the four prefs of the contract."""
lines = ['user_pref("%s", true);' % PREF_GENERATE]
for pref, path in ((PREF_INTERMEDIATES, inputs.intermediates), (PREF_ONECRL, inputs.onecrl), (PREF_CRLITE, inputs.crlite)):
lines.append("user_pref(%s, %s);" % (json.dumps(pref), json.dumps(str(Path(path).resolve()))))
return ("\n".join(lines) + "\n").encode("utf-8")
_READY = {}
def _ready(ff, inputs, root):
"""The ready directory the CORE makes from the inputs with the engine (its validation included), made once for the module; a failure is kept and said again."""
from invisible_core._security_state_generate import default_argv, engine_id_of, generate
if "state" not in _READY:
out = Path(root) / "ready"
try:
generate(default_argv(ff), inputs, engine_id_of(ff), out)
_READY["state"] = (out, None)
except Exception as exc:
_READY["state"] = (None, exc)
out, error = _READY["state"]
if error is not None:
raise error
return out
def _a_ready_directory_with(root, name, *, state):
"""A ready directory with the result only (`state` None) or with an empty `security_state/` (`state` "empty")."""
directory = Path(root) / name
directory.mkdir()
(directory / RESULT_NAME).write_bytes(json.dumps(RESULT_WITHOUT_DATA, separators=(",", ":")).encode("utf-8"))
if state == "empty":
(directory / STATE_DIR).mkdir()
return directory
def test_the_engine_generates_the_security_state_it_is_given(ff, inputs, tmp_path_factory):
files = inputs
work = tmp_path_factory.mktemp("generate")
profile = work / "profile"
profile.mkdir()
(profile / "user.js").write_bytes(_user_js(files))
code, why = _run_to_the_end([ff, "-headless", "-no-remote", "-profile", str(profile)], _engine_env(work), work, GENERATE_TIMEOUT_S)
said = (profile / RESULT_NAME).read_bytes().decode("utf-8") if (profile / RESULT_NAME).is_file() else "no %s" % RESULT_NAME
assert code == 0, "the engine in generate mode %s (exit code %r); its result: %s" % (why or "exited", code, said)
result = json.loads((profile / RESULT_NAME).read_bytes().decode("utf-8"))
assert set(result) == {"format", "ok", "error", "engine", "collections", "crlite_filter_hashes"}, sorted(result)
assert result["format"] == 1 and result["ok"] is True and result["error"] is None, result
build_id, version = _application_ini(ff)
assert set(result["engine"]) == {"version", "build_id"} and result["engine"]["build_id"] == build_id and result["engine"]["version"] == version, result["engine"]
assert set(result["collections"]) == {"intermediates", "onecrl", "cert-revocations"}, sorted(result["collections"])
for name, stamp in (("intermediates", INTERMEDIATES_TS), ("onecrl", ONECRL_TS), ("cert-revocations", CRLITE_TS)):
assert result["collections"][name]["collection_timestamp"] == stamp, (name, result["collections"][name])
assert result["collections"]["cert-revocations"]["channel"] == "default", result["collections"]["cert-revocations"]
full, delta = _crlite_file(FULL), _crlite_file(DELTA)
assert sorted(result["crlite_filter_hashes"]) == sorted([hashlib.sha256(full).hexdigest(), hashlib.sha256(delta).hexdigest()]), result["crlite_filter_hashes"]
state = profile / STATE_DIR
assert (state / "data.safe.bin").is_file() and (state / "data.safe.bin").stat().st_size > 0, sorted(p.name for p in state.iterdir())
assert (state / "crlite.filter").read_bytes() == full, "crlite.filter is not the bytes of the full filter"
deltas = sorted(p for p in state.iterdir() if p.name.endswith(".delta"))
assert [p.read_bytes() for p in deltas] == [delta], "the delta files of security_state/ are %s, not the one delta" % [p.name for p in deltas]
# The same inputs through the core: its validation of the report and of the directory.
assert _ready(ff, files, work).is_dir()
# --- a normal launch ---------------------------------------------------------------------------------------------------------------------------------------
class _Page(BaseHTTPRequestHandler):
timeout = 5
def do_GET(self):
body = b"<!doctype html><title>page</title><p>ok"
self.send_response(200)
self.send_header("Content-Type", "text/html")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def log_message(self, *args):
pass
class _Server(LocalServer):
def handle_error(self, request, client_address):
pass # a browser that refuses the certificate drops the connection in the middle of the handshake
@pytest.fixture
def http_page():
server = _Server(("127.0.0.1", 0), _Page)
threading.Thread(target=server.serve_forever, daemon=True).start()
try:
yield "http://127.0.0.1:%d/" % server.server_address[1]
finally:
server.shutdown()
server.server_close()
def _browse(ff, profile, url, prefs=None):
"""A launch of the wrapper on `profile`; its FIRST action is to go to `url`: (status of the response) or the error of the navigation."""
from invisible_playwright import InvisiblePlaywright
with InvisiblePlaywright(headless=True, seed=7, binary_path=ff, profile_dir=profile, extra_prefs=prefs) as context:
page = context.new_page()
try:
response = page.goto(url, wait_until="domcontentloaded", timeout=60000)
except Exception as exc:
return exc
return response.status
def test_a_normal_launch_declares_no_security_state_pref_and_imports_nothing(ff, inputs, tmp_path_factory, monkeypatch, http_page):
ready = _ready(ff, inputs, tmp_path_factory.mktemp("ready-root"))
monkeypatch.setenv("STEALTHFOX_SECURITY_STATE", str(ready))
profile = tmp_path_factory.mktemp("normal") / "profile"
outcome = _browse(ff, profile, http_page)
assert outcome == 200, "the first page did not load: %r" % (outcome,)
user_js = (profile / "user.js").read_bytes().decode("utf-8")
assert [pref for pref in MODE_PREFS if pref in user_js] == [], "user.js of a normal launch names a pref of the generate mode"
assert not (profile / RESULT_NAME).exists(), "a normal launch left a %s in the profile" % RESULT_NAME
given = sorted(p.name for p in (ready / STATE_DIR).iterdir() if p.name == "crlite.filter" or p.name.endswith(".delta"))
assert len(given) == 2, "the ready directory holds %s, not the full filter and a delta" % given
for name in given:
assert (profile / STATE_DIR / name).read_bytes() == (ready / STATE_DIR / name).read_bytes(), "%s of the profile is not the ready directory's bytes" % name
# --- a certificate revoked in a delta -----------------------------------------------------------------------------------------------------------------------
def _certificates(now):
"""A fresh root, the CA `CN=int` with Mozilla's default key (so with the public key the filters are keyed on) and two leaves for 127.0.0.1 that carry the serial and the
SCT extension of Mozilla's revoked-in-delta and valid certificates: (root DER, int, {name: (leaf, leaf key)}, int key)."""
x509, hashes, serialization, ec, name_oid = _x509()
key_doc = json.loads((DATA / "security_state_default_key.json").read_bytes().decode("utf-8"))
int_key = serialization.load_pem_private_key(key_doc["pem"].encode("ascii"), password=None)
mozilla_int = x509.load_pem_x509_certificate(_crlite_file("int.pem"))
public = serialization.Encoding.DER, serialization.PublicFormat.SubjectPublicKeyInfo
assert int_key.public_key().public_bytes(*public) == mozilla_int.public_key().public_bytes(*public), \
"the default key of %s is not the public key of Mozilla's int.pem" % key_doc["source"]
def name(common):
return x509.Name([x509.NameAttribute(name_oid.COMMON_NAME, common)])
def builder(subject, issuer, public_key):
return (x509.CertificateBuilder().subject_name(subject).issuer_name(issuer).public_key(public_key).not_valid_before(now - datetime.timedelta(days=1))
.not_valid_after(now + datetime.timedelta(days=30)))
ca_usage = x509.KeyUsage(digital_signature=False, content_commitment=False, key_encipherment=False, data_encipherment=False, key_agreement=False,
key_cert_sign=True, crl_sign=True, encipher_only=False, decipher_only=False)
root_key = ec.generate_private_key(ec.SECP256R1())
root = (builder(name("Security State Test Root"), name("Security State Test Root"), root_key.public_key()).serial_number(x509.random_serial_number())
.add_extension(x509.BasicConstraints(ca=True, path_length=None), critical=True).add_extension(ca_usage, critical=True).sign(root_key, hashes.SHA256()))
intermediate = (builder(mozilla_int.subject, root.subject, int_key.public_key()).serial_number(x509.random_serial_number())
.add_extension(x509.BasicConstraints(ca=True, path_length=0), critical=True).add_extension(ca_usage, critical=True).sign(root_key, hashes.SHA256()))
assert intermediate.subject == mozilla_int.subject
leaves = {}
for label, source in (("revoked", REVOKED_NAME), ("valid", VALID_NAME)):
mozilla = x509.load_pem_x509_certificate(_crlite_file(source))
sct = mozilla.extensions.get_extension_for_oid(x509.oid.ExtensionOID.PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS)
key = ec.generate_private_key(ec.SECP256R1())
leaf = (builder(name("localhost"), intermediate.subject, key.public_key()).serial_number(mozilla.serial_number)
.add_extension(x509.BasicConstraints(ca=False, path_length=None), critical=True)
.add_extension(x509.SubjectAlternativeName([x509.DNSName("localhost"), x509.IPAddress(ipaddress.ip_address("127.0.0.1"))]), critical=False)
.add_extension(x509.ExtendedKeyUsage([x509.oid.ExtendedKeyUsageOID.SERVER_AUTH]), critical=False)
.add_extension(x509.UnrecognizedExtension(sct.oid, sct.value.public_bytes()), critical=False).sign(int_key, hashes.SHA256()))
copied = leaf.extensions.get_extension_for_oid(x509.oid.ExtensionOID.PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS)
assert copied.value.public_bytes() == sct.value.public_bytes() and leaf.serial_number == mozilla.serial_number, "the SCT list or the serial of %s was not copied" % source
leaves[label] = (leaf, key)
return root, intermediate, leaves
def _https_server(directory, label, leaf, key, intermediate):
"""An HTTPS server on 127.0.0.1 (a thread per connection) whose chain is the leaf and the intermediate; the handshake is made in the thread of the connection."""
_x509_module, _hashes, serialization, _ec, _name_oid = _x509()
chain = directory / (label + "-chain.pem")
chain.write_bytes(leaf.public_bytes(serialization.Encoding.PEM) + intermediate.public_bytes(serialization.Encoding.PEM))
key_file = directory / (label + "-key.pem")
key_file.write_bytes(key.private_bytes(serialization.Encoding.PEM, serialization.PrivateFormat.PKCS8, serialization.NoEncryption()))
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(str(chain), str(key_file))
server = _Server(("127.0.0.1", 0), _Page)
server.socket = context.wrap_socket(server.socket, server_side=True, do_handshake_on_connect=False)
threading.Thread(target=server.serve_forever, daemon=True).start()
return server
# What `FF -xpcshell` runs to make `cert9.db` (the package has the shell but not the harness: a directory provider for the profile and profile-do-change, as the engine's own
# gate does). `add` trusts the root for SSL; `check` is a second process that only asks whether the profile trusts it.
_TRUST_JS = r"""
"use strict";
const env = name => Services.env.get(name);
const file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(env("ST_PROFILE"));
Services.dirsvc.QueryInterface(Ci.nsIDirectoryService).registerProvider({
getFile(prop, persistent) {
persistent.value = true;
return ["ProfD", "ProfLD", "ProfDS", "ProfLDS"].includes(prop) ? file.clone() : null;
},
QueryInterface: ChromeUtils.generateQI(["nsIDirectoryServiceProvider"]),
});
Services.obs.notifyObservers(null, "profile-do-change", "security-state-test");
const certdb = Cc["@mozilla.org/security/x509certdb;1"].getService(Ci.nsIX509CertDB);
if (env("ST_MODE") == "add") {
certdb.addCertFromBase64(env("ST_ROOT"), "CTu,,");
}
const root = certdb.constructX509FromBase64(env("ST_ROOT"));
const trusted = certdb.isCertTrusted(root, Ci.nsIX509Cert.CA_CERT, Ci.nsIX509CertDB.TRUSTED_SSL);
quit(trusted ? 0 : 3);
"""
def _trust_the_root(ff, profile, root_der, work):
"""`cert9.db` of `profile` with the root trusted for SSL, made BEFORE the browser starts, and read back by a second process."""
script = work / "trust.js"
script.write_text(_TRUST_JS, encoding="utf-8")
profile.mkdir(parents=True, exist_ok=True)
for mode in ("add", "check"):
env = _engine_env(work)
env.update(ST_MODE=mode, ST_PROFILE=str(profile), ST_ROOT=_b64(root_der))
code, why = _run_to_the_end([ff, "-xpcshell", str(script)], env, work, 120)
assert code == 0, "xpcshell (%s) %s, exit code %r: the root is not trusted in %s" % (mode, why or "exited", code, profile)
assert (profile / "cert9.db").is_file(), "no cert9.db in the profile after the root was added"
def _refused(outcome):
return isinstance(outcome, Exception) and SEC_ERROR_REVOKED_CERTIFICATE in str(outcome)
def test_a_certificate_revoked_in_a_delta_is_refused_at_the_first_navigation(ff, inputs, tmp_path_factory, monkeypatch):
now = datetime.datetime.now(datetime.timezone.utc).replace(microsecond=0)
root, intermediate, leaves = _certificates(now)
work = tmp_path_factory.mktemp("revoked")
servers = {label: _https_server(work, label, leaf, key, intermediate) for label, (leaf, key) in leaves.items()}
urls = {label: "https://127.0.0.1:%d/" % server.server_address[1] for label, server in servers.items()}
# The copied SCTs are signed by Mozilla's test log, which Firefox does not know. With certificate transparency off Firefox hands the embedded timestamps to CRLite as they
# are, which is what Mozilla's own test_crlite_filters.js does; this changes nothing of what is tested here: whether cert_storage has read the filters at the first navigation.
prefs = {"security.pki.certificate_transparency.mode": 0}
try:
def profile_of(name):
profile = work / name
_trust_the_root(ff, profile, _der(root), work)
return profile
ready = _ready(ff, inputs, tmp_path_factory.mktemp("ready-root"))
monkeypatch.setenv("STEALTHFOX_SECURITY_STATE", str(ready))
outcome = _browse(ff, profile_of("with-data"), urls["revoked"], prefs)
assert _refused(outcome), "the certificate revoked in the delta was not refused at the first navigation: %r" % (outcome,)
# (a) the same engine, a certificate that is not revoked: it loads, so the refusal above is not a refusal of every certificate of the run.
outcome = _browse(ff, profile_of("valid"), urls["valid"], prefs)
assert outcome == 200, "the valid certificate was not accepted at the first navigation: %r" % (outcome,)
# (b) a ready directory with no data: the revoked certificate loads, so the refusal comes from the security state.
monkeypatch.setenv("STEALTHFOX_SECURITY_STATE", str(_a_ready_directory_with(work, "ready-without-data", state=None)))
outcome = _browse(ff, profile_of("without-data"), urls["revoked"], prefs)
assert outcome == 200, "with no security state the certificate must load (the refusal of the first launch is the state's): %r" % (outcome,)
finally:
for server in servers.values():
server.shutdown()
server.server_close()
# --- nothing to copy -----------------------------------------------------------------------------------------------------------------------------------
def test_a_launch_with_no_or_an_empty_security_state_starts(ff, tmp_path_factory, monkeypatch, http_page):
for state in (None, "empty"):
ready = _a_ready_directory_with(tmp_path_factory.mktemp("ready-root"), "ready", state=state)
monkeypatch.setenv("STEALTHFOX_SECURITY_STATE", str(ready))
outcome = _browse(ff, tmp_path_factory.mktemp("start") / "profile", http_page)
assert outcome == 200, "with %s the first page did not load: %r" % ("no security_state/ directory" if state is None else "an empty security_state/ directory", outcome)
+1 -1
View File
@@ -67,7 +67,7 @@ _LEAKS = ("PYTHONPATH", "PYTHONHOME", "VIRTUAL_ENV",
"INVISIBLE_PLAYWRIGHT_ENGINE_DIR", "INVISIBLE_PLAYWRIGHT_CACHE_DIR",
"INVISIBLE_DOWNLOAD_DEADLINE", "STEALTHFOX_GITHUB_TOKEN", "GITHUB_TOKEN",
"INVISIBLE_SEAL_FILE", "INVISIBLE_CORE_PIN", "INVISIBLE_CORE_AUTOFIX",
"INVISIBLE_CORE_AUTOFIX_TIMEOUT", "UV", "STEALTHFOX_GEOIP_MMDB", "STEALTHFOX_INTERMEDIATES",
"INVISIBLE_CORE_AUTOFIX_TIMEOUT", "UV", "STEALTHFOX_GEOIP_MMDB", "STEALTHFOX_SECURITY_STATE",
"STEALTHFOX_FONT_MANIFEST", "STEALTHFOX_WEBRTC_NETWORK",
"INVPW_CURSOR_TIMER", "INVISIBLE_CORE_AUTOFIX_ATTEMPTED",
"INVPW_SESSION_TOKEN", "INVPW_DESKTOP")