cfsolve 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +10 -9
- data/THIRD_PARTY_LICENSES/README.md +71 -254
- data/THIRD_PARTY_LICENSES/{derive_builder_macro-0.20.2/LICENSE-APACHE → bytecount-0.6.9/LICENSE.Apache2} +0 -1
- data/THIRD_PARTY_LICENSES/{darling-0.20.11/LICENSE → bytecount-0.6.9/LICENSE.MIT} +1 -3
- data/THIRD_PARTY_LICENSES/{ident_case-1.0.1/LICENSE → cobs-0.3.0/LICENSE-MIT} +1 -1
- data/THIRD_PARTY_LICENSES/cow-utils-0.1.3/LICENSE +21 -0
- data/THIRD_PARTY_LICENSES/{hashbrown-0.14.5 → embedded-io-0.4.0}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{ahash-0.8.12 → embedded-io-0.6.1}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{browserslist-data-0.1.4 → escape-simd-0.1.1}/LICENSE +1 -1
- data/THIRD_PARTY_LICENSES/escape-simd-0.1.1/NOTICE +62 -0
- data/THIRD_PARTY_LICENSES/json-escape-simd-3.1.3/LICENSE +21 -0
- data/THIRD_PARTY_LICENSES/{miette-7.6.0/LICENSE → json-escape-simd-3.1.3/LICENSE-APACHE} +0 -1
- data/THIRD_PARTY_LICENSES/json-escape-simd-3.1.3/NOTICE +62 -0
- data/THIRD_PARTY_LICENSES/memchr-2.8.3/UNLICENSE +24 -0
- data/THIRD_PARTY_LICENSES/{derive_builder_core-0.20.2 → nonmax-0.5.5}/LICENSE-APACHE +1 -2
- data/THIRD_PARTY_LICENSES/{dashmap-5.5.3/LICENSE → nonmax-0.5.5/LICENSE-MIT} +2 -4
- data/THIRD_PARTY_LICENSES/{rand-0.8.5 → num-bigint-0.5.1}/LICENSE-MIT +0 -1
- data/THIRD_PARTY_LICENSES/oxc-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/{browserslist-rs-0.19.0 → oxc-browserslist-5.0.1}/LICENSE +1 -0
- data/THIRD_PARTY_LICENSES/oxc_allocator-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_allocator-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_macros-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_macros-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_visit-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ast_visit-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_codegen-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_codegen-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_compat-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_compat-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_data_structures-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_data_structures-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_diagnostics-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_diagnostics-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_ecmascript-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_ecmascript-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_estree-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_estree-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_index-5.0.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_parser-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_parser-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_regular_expression-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_regular_expression-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_semantic-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_semantic-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_span-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_span-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_str-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_str-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/oxc_syntax-0.157.0/LICENSE +22 -0
- data/THIRD_PARTY_LICENSES/oxc_syntax-0.157.0/THIRD-PARTY-LICENSE +763 -0
- data/THIRD_PARTY_LICENSES/{fixedbitset-0.5.7 → postcard-1.1.3}/LICENSE-MIT +1 -1
- data/THIRD_PARTY_LICENSES/{bytes-str-0.2.7/LICENSE → self_cell-1.3.0/LICENSE-APACHE} +1 -2
- data/THIRD_PARTY_LICENSES/self_cell-1.3.0/LICENSE-GPLv2 +339 -0
- data/THIRD_PARTY_LICENSES/{darling_core-0.20.11 → smawk-0.3.3}/LICENSE +1 -1
- data/UPSTREAM.md +10 -8
- data/ext/cfsolve/Cargo.lock +534 -1727
- data/ext/cfsolve/Cargo.toml +4 -0
- data/ext/cfsolve/src/main.rs +1 -1
- data/lib/cfsolve/profiles/safari-26-ios/answers.json +2570 -1894
- data/lib/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +1867 -1192
- data/lib/cfsolve/profiles/safari-26-ios.json +102 -156
- data/lib/cfsolve/version.rb +2 -2
- data/vendor/cfsolve/Cargo.lock +561 -1729
- data/vendor/cfsolve/Cargo.toml +26 -8
- data/vendor/cfsolve/README.md +4 -35
- data/vendor/cfsolve/examples/build_profile.rs +17 -15
- data/vendor/cfsolve/examples/capture_session.rs +37 -0
- data/vendor/cfsolve/examples/check_answers.rs +66 -0
- data/vendor/cfsolve/examples/compare_session.rs +189 -0
- data/vendor/cfsolve/examples/solver_profile.rs +84 -0
- data/vendor/cfsolve/examples/solver_smoke.rs +9 -8
- data/vendor/cfsolve/examples/stage2_snapshot.rs +6 -3
- data/vendor/cfsolve/examples/tls_echo.rs +3 -3
- data/vendor/cfsolve/examples/vm_snapshot.rs +32 -33
- data/vendor/cfsolve/profiles/safari-26-ios/answers.json +2570 -1894
- data/vendor/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +1867 -1192
- data/vendor/cfsolve/profiles/safari-26-ios.json +102 -156
- data/vendor/cfsolve/scripts/capture_cssom.mjs +42 -0
- data/vendor/cfsolve/scripts/serve_cssom.py +111 -0
- data/vendor/cfsolve/src/bin/capture-proxy/main.rs +3 -2
- data/vendor/cfsolve/src/bin/challenge/cli.rs +8 -2
- data/vendor/cfsolve/src/bin/challenge/main.rs +7 -2
- data/vendor/cfsolve/src/capture/profile.rs +7 -18
- data/vendor/cfsolve/src/capture/proxy/tests.rs +1 -1
- data/vendor/cfsolve/src/capture/proxy.rs +44 -13
- data/vendor/cfsolve/src/capture/recorded.rs +42 -7
- data/vendor/cfsolve/src/capture/sessions.rs +4 -3
- data/vendor/cfsolve/src/capture/upstream.rs +1 -1
- data/vendor/cfsolve/src/challenge/codec.rs +4 -2
- data/vendor/cfsolve/src/challenge/expression.rs +161 -117
- data/vendor/cfsolve/src/challenge/installed/audit.rs +132 -0
- data/vendor/cfsolve/src/challenge/installed.rs +127 -269
- data/vendor/cfsolve/src/challenge/merge.rs +120 -80
- data/vendor/cfsolve/src/challenge/orchestrator.rs +57 -44
- data/vendor/cfsolve/src/challenge/payload.rs +175 -35
- data/vendor/cfsolve/src/challenge/program.rs +197 -178
- data/vendor/cfsolve/src/challenge/reduced_timing.rs +55 -40
- data/vendor/cfsolve/src/challenge/source.rs +151 -96
- data/vendor/cfsolve/src/challenge/state.rs +236 -122
- data/vendor/cfsolve/src/challenge/tally.rs +64 -50
- data/vendor/cfsolve/src/challenge.rs +1 -0
- data/vendor/cfsolve/src/deobfuscate/analysis/bindings.rs +187 -185
- data/vendor/cfsolve/src/deobfuscate/analysis/effects.rs +42 -51
- data/vendor/cfsolve/src/deobfuscate/analysis/hoisting.rs +147 -228
- data/vendor/cfsolve/src/deobfuscate/analysis/properties.rs +250 -425
- data/vendor/cfsolve/src/deobfuscate/analysis/unconditional.rs +79 -0
- data/vendor/cfsolve/src/deobfuscate/analysis.rs +259 -41
- data/vendor/cfsolve/src/deobfuscate/argument_arrays.rs +70 -73
- data/vendor/cfsolve/src/deobfuscate/arrow_blocks.rs +91 -104
- data/vendor/cfsolve/src/deobfuscate/ast.rs +383 -0
- data/vendor/cfsolve/src/deobfuscate/bitwise.rs +44 -54
- data/vendor/cfsolve/src/deobfuscate/blocks.rs +36 -29
- data/vendor/cfsolve/src/deobfuscate/call_helpers.rs +80 -131
- data/vendor/cfsolve/src/deobfuscate/control_flow.rs +239 -297
- data/vendor/cfsolve/src/deobfuscate/copy_propagation.rs +114 -135
- data/vendor/cfsolve/src/deobfuscate/dead_branches.rs +62 -61
- data/vendor/cfsolve/src/deobfuscate/dead_properties.rs +197 -214
- data/vendor/cfsolve/src/deobfuscate/dispatch.rs +238 -298
- data/vendor/cfsolve/src/deobfuscate/encoded_strings.rs +201 -205
- data/vendor/cfsolve/src/deobfuscate/function_lengths.rs +32 -38
- data/vendor/cfsolve/src/deobfuscate/helper_objects.rs +346 -536
- data/vendor/cfsolve/src/deobfuscate/hygiene.rs +197 -0
- data/vendor/cfsolve/src/deobfuscate/int32_helpers.rs +121 -155
- data/vendor/cfsolve/src/deobfuscate/literals.rs +116 -67
- data/vendor/cfsolve/src/deobfuscate/loops.rs +43 -43
- data/vendor/cfsolve/src/deobfuscate/memoized_strings.rs +127 -131
- data/vendor/cfsolve/src/deobfuscate/merged_functions.rs +262 -220
- data/vendor/cfsolve/src/deobfuscate/pipeline.rs +199 -244
- data/vendor/cfsolve/src/deobfuscate/register_arrays.rs +361 -322
- data/vendor/cfsolve/src/deobfuscate/removal.rs +83 -52
- data/vendor/cfsolve/src/deobfuscate/simplify.rs +147 -0
- data/vendor/cfsolve/src/deobfuscate/state_machines.rs +88 -110
- data/vendor/cfsolve/src/deobfuscate/statements.rs +228 -228
- data/vendor/cfsolve/src/deobfuscate/static_members.rs +46 -31
- data/vendor/cfsolve/src/deobfuscate/testing.rs +49 -59
- data/vendor/cfsolve/src/deobfuscate/unused_bindings.rs +92 -102
- data/vendor/cfsolve/src/deobfuscate.rs +15 -11
- data/vendor/cfsolve/src/embedding_page/extra_params.rs +23 -32
- data/vendor/cfsolve/src/embedding_page/page.rs +28 -2
- data/vendor/cfsolve/src/embedding_page/render_sample.rs +184 -147
- data/vendor/cfsolve/src/error.rs +40 -5
- data/vendor/cfsolve/src/fingerprint.rs +8 -2
- data/vendor/cfsolve/src/http/client.rs +9 -1
- data/vendor/cfsolve/src/http/requests.rs +2 -2
- data/vendor/cfsolve/src/js/ast.rs +479 -254
- data/vendor/cfsolve/src/js/objects.rs +9 -2
- data/vendor/cfsolve/src/lib.rs +1 -0
- data/vendor/cfsolve/src/listing/fold.rs +19 -92
- data/vendor/cfsolve/src/listing/query.rs +26 -291
- data/vendor/cfsolve/src/listing.rs +0 -1
- data/vendor/cfsolve/src/performance_clock.rs +20 -1
- data/vendor/cfsolve/src/profiling.rs +49 -0
- data/vendor/cfsolve/src/script.rs +35 -24
- data/vendor/cfsolve/src/session/challenge_page.rs +41 -21
- data/vendor/cfsolve/src/session/channel.rs +2 -2
- data/vendor/cfsolve/src/session/initial.rs +19 -10
- data/vendor/cfsolve/src/session/probes.rs +160 -125
- data/vendor/cfsolve/src/session/sink.rs +26 -1
- data/vendor/cfsolve/src/session/tests/challenge_page.rs +36 -1
- data/vendor/cfsolve/src/session/timing.rs +58 -53
- data/vendor/cfsolve/src/session/widget.rs +5 -6
- data/vendor/cfsolve/src/session.rs +1 -1
- data/vendor/cfsolve/src/solver.rs +3 -1
- data/vendor/cfsolve/src/stage2/analysis/analyze.rs +50 -33
- data/vendor/cfsolve/src/stage2/analysis/audit.rs +4 -2
- data/vendor/cfsolve/src/stage2/analysis/discovery.rs +61 -66
- data/vendor/cfsolve/src/stage2/analysis/envelope.rs +33 -22
- data/vendor/cfsolve/src/stage2/analysis/recognize.rs +3 -5
- data/vendor/cfsolve/src/stage2/analysis.rs +0 -1
- data/vendor/cfsolve/src/stage2/audit_globals.rs +378 -0
- data/vendor/cfsolve/src/stage2/benchmark.rs +66 -38
- data/vendor/cfsolve/src/stage2/call_stack.rs +1463 -1017
- data/vendor/cfsolve/src/stage2/challenge_page.rs +3 -2
- data/vendor/cfsolve/src/stage2/interaction/checkbox.rs +202 -150
- data/vendor/cfsolve/src/stage2/interaction/click.rs +2 -2
- data/vendor/cfsolve/src/stage2/interaction/native.rs +2 -1
- data/vendor/cfsolve/src/stage2/interaction/plan.rs +5 -7
- data/vendor/cfsolve/src/stage2/payload/recover.rs +56 -25
- data/vendor/cfsolve/src/stage2/probes/clock.rs +1 -3
- data/vendor/cfsolve/src/stage2/probes/ice.rs +11 -10
- data/vendor/cfsolve/src/stage2/probes/media.rs +47 -33
- data/vendor/cfsolve/src/stage2/probes/performance.rs +13 -8
- data/vendor/cfsolve/src/stage2/probes/rects.rs +12 -17
- data/vendor/cfsolve/src/stage2/probes/stack.rs +50 -103
- data/vendor/cfsolve/src/stage2/probes/websocket_echo.rs +17 -86
- data/vendor/cfsolve/src/stage2/probes.rs +0 -1
- data/vendor/cfsolve/src/stage2/queries.rs +50 -0
- data/vendor/cfsolve/src/stage2/records.rs +4 -13
- data/vendor/cfsolve/src/stage2/reference.json +1 -1
- data/vendor/cfsolve/src/stage2/reference.rs +98 -100
- data/vendor/cfsolve/src/stage2/registry.rs +41 -34
- data/vendor/cfsolve/src/stage2/replay.rs +182 -254
- data/vendor/cfsolve/src/stage2/stylesheets.rs +176 -0
- data/vendor/cfsolve/src/stage2/syntax.rs +88 -0
- data/vendor/cfsolve/src/stage2/trace.rs +152 -108
- data/vendor/cfsolve/src/stage2/vocabulary.rs +103 -403
- data/vendor/cfsolve/src/stage2.rs +4 -1
- data/vendor/cfsolve/src/vm/disassemble.rs +46 -13
- data/vendor/cfsolve/src/vm/dispatch.rs +93 -65
- data/vendor/cfsolve/src/vm/extract.rs +347 -250
- data/vendor/cfsolve/src/vm/interpret/access.rs +67 -68
- data/vendor/cfsolve/src/vm/interpret/builtin.rs +16 -63
- data/vendor/cfsolve/src/vm/interpret/call.rs +192 -51
- data/vendor/cfsolve/src/vm/interpret/compile.rs +643 -0
- data/vendor/cfsolve/src/vm/interpret/copies.rs +232 -120
- data/vendor/cfsolve/src/vm/interpret/evaluate/tests.rs +149 -40
- data/vendor/cfsolve/src/vm/interpret/evaluate.rs +189 -572
- data/vendor/cfsolve/src/vm/interpret/explore.rs +159 -46
- data/vendor/cfsolve/src/vm/interpret/formula.rs +131 -0
- data/vendor/cfsolve/src/vm/interpret/frozen.rs +169 -0
- data/vendor/cfsolve/src/vm/interpret/intrinsic.rs +414 -0
- data/vendor/cfsolve/src/vm/interpret/mix32.rs +189 -0
- data/vendor/cfsolve/src/vm/interpret/native_dispatch.rs +220 -0
- data/vendor/cfsolve/src/vm/interpret/pattern.rs +1736 -0
- data/vendor/cfsolve/src/vm/interpret/plan.rs +605 -330
- data/vendor/cfsolve/src/vm/interpret/register_helpers.rs +384 -0
- data/vendor/cfsolve/src/vm/interpret/run.rs +314 -54
- data/vendor/cfsolve/src/vm/interpret/semantics.rs +71 -46
- data/vendor/cfsolve/src/vm/interpret/setup.rs +80 -45
- data/vendor/cfsolve/src/vm/interpret/string_decoder.rs +482 -0
- data/vendor/cfsolve/src/vm/interpret.rs +16 -3
- data/vendor/cfsolve/src/vm/machine.rs +58 -47
- data/vendor/cfsolve/src/vm/output.rs +13 -5
- data/vendor/cfsolve/src/vm/packed_names.rs +311 -0
- data/vendor/cfsolve/src/vm/session.rs +197 -110
- data/vendor/cfsolve/src/vm/value.rs +35 -19
- data/vendor/cfsolve/src/vm.rs +3 -1
- data/vendor/cfsolve/vendor/btls-sys/Cargo.toml +3 -0
- data/vendor/cfsolve/vendor/btls-sys/build/main.rs +20 -0
- data/vendor/cfsolve/vendor/btls-sys/src/lib.rs +3 -0
- metadata +106 -183
- data/THIRD_PARTY_LICENSES/Inflector-0.11.4/LICENSE.md +0 -22
- data/THIRD_PARTY_LICENSES/arrayvec-0.7.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/ascii-1.1.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/ascii-1.1.0/LICENSE-MIT +0 -22
- data/THIRD_PARTY_LICENSES/ast_node-5.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/better_scoped_tls-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/bitvec-1.0.1/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/bstr-1.12.1/COPYING +0 -8
- data/THIRD_PARTY_LICENSES/bstr-1.12.1/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/cargo-platform-0.1.9/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/cargo_metadata-0.19.2/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/darling_macro-0.20.11/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/debugid-0.8.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/derive_builder-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/derive_builder_core-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/derive_builder_macro-0.20.2/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/foldhash-0.1.5/LICENSE +0 -19
- data/THIRD_PARTY_LICENSES/from_variant-3.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/funty-2.0.0/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/hashbrown-0.16.1/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/heck-0.5.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/hermit-abi-0.5.2/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/hermit-abi-0.5.2/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/hstr-3.0.3/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/if_chain-1.0.3/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/if_chain-1.0.3/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/is-macro-0.3.7/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/itoa-1.0.17/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/jsonc-parser-0.26.3/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/lazy_static-1.5.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/lazy_static-1.5.0/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/lru-0.16.2/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/memchr-2.7.6/COPYING +0 -3
- data/THIRD_PARTY_LICENSES/memchr-2.7.6/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/miette-derive-7.6.0/LICENSE +0 -229
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/COPYRIGHT +0 -7
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/normpath-0.2.0/LICENSE-THIRD-PARTY +0 -210
- data/THIRD_PARTY_LICENSES/num_cpus-1.17.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/num_cpus-1.17.0/LICENSE-MIT +0 -20
- data/THIRD_PARTY_LICENSES/owo-colors-4.2.3/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/par-core-2.0.0/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/par-iter-2.0.0/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/path-clean-0.1.0/LICENSE-APACHE +0 -13
- data/THIRD_PARTY_LICENSES/path-clean-0.1.0/LICENSE-MIT +0 -18
- data/THIRD_PARTY_LICENSES/path-clean-1.0.1/LICENSE-APACHE +0 -13
- data/THIRD_PARTY_LICENSES/path-clean-1.0.1/LICENSE-MIT +0 -18
- data/THIRD_PARTY_LICENSES/pathdiff-0.2.3/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/pathdiff-0.2.3/LICENSE-MIT +0 -23
- data/THIRD_PARTY_LICENSES/petgraph-0.7.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/precomputed-map-0.2.0/LICENSE +0 -21
- data/THIRD_PARTY_LICENSES/preset_env_base-6.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/radium-0.7.0/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/radix_fmt-1.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/rand-0.8.5/COPYRIGHT +0 -12
- data/THIRD_PARTY_LICENSES/rand-0.8.5/LICENSE-APACHE +0 -176
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/COPYRIGHT +0 -12
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/LICENSE-APACHE +0 -187
- data/THIRD_PARTY_LICENSES/rand_core-0.6.4/LICENSE-MIT +0 -26
- data/THIRD_PARTY_LICENSES/regress-0.10.5/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/regress-0.10.5/LICENSE-MIT +0 -21
- data/THIRD_PARTY_LICENSES/ryu-1.0.22/LICENSE-APACHE +0 -176
- data/THIRD_PARTY_LICENSES/ryu-1.0.22/LICENSE-BOOST +0 -23
- data/THIRD_PARTY_LICENSES/scoped-tls-1.0.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/scoped-tls-1.0.1/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/siphasher-0.3.11/COPYING +0 -7
- data/THIRD_PARTY_LICENSES/smallvec-1.15.1/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/smartstring-1.0.1/LICENCE.md +0 -355
- data/THIRD_PARTY_LICENSES/st-map-0.2.4/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/static-map-macro-0.3.4/LICENSE +0 -202
- data/THIRD_PARTY_LICENSES/string_enum-1.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/strsim-0.11.1/LICENSE +0 -23
- data/THIRD_PARTY_LICENSES/swc-52.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_allocator-4.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_atoms-9.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_common-18.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_compiler_base-45.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_config-3.1.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_config_macro-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_core-54.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_ast-19.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_codegen-21.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_codegen_macros-2.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_bugfixes-39.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_common-30.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2015-39.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2016-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2017-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2018-36.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2019-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2020-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2021-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es2022-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_compat_es3-26.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_ext_transforms-25.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_hooks-0.3.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_loader-18.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_minifier-42.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_parser-32.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_preset_env-45.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transformer-6.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms-44.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_base-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_classes-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_compat-40.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_macros-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_module-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_optimization-37.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_proposal-35.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_react-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_transforms_typescript-38.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_usage_analyzer-27.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_utils-25.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_ecma_visit-19.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_eq_ignore_macros-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_error_reporters-20.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_macros_common-1.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_node_comments-18.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_timer-1.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_trace_macro-2.0.2/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_transform_common-12.0.0/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/swc_visit-2.0.1/LICENSE +0 -201
- data/THIRD_PARTY_LICENSES/tap-1.0.1/LICENSE.txt +0 -21
- data/THIRD_PARTY_LICENSES/tracing-0.1.44/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/tracing-attributes-0.1.31/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/tracing-core-0.1.36/LICENSE +0 -25
- data/THIRD_PARTY_LICENSES/triomphe-0.1.15/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/triomphe-0.1.15/LICENSE-MIT +0 -27
- data/THIRD_PARTY_LICENSES/unicode-width-0.1.14/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/unicode-width-0.1.14/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/uuid-1.19.0/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/uuid-1.19.0/LICENSE-MIT +0 -26
- data/THIRD_PARTY_LICENSES/vergen-9.0.6/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/vergen-9.0.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/vergen-lib-0.1.6/LICENSE-APACHE +0 -201
- data/THIRD_PARTY_LICENSES/vergen-lib-0.1.6/LICENSE-MIT +0 -25
- data/THIRD_PARTY_LICENSES/wyz-0.5.1/LICENSE.txt +0 -21
- data/vendor/cfsolve/src/deobfuscate/analysis/globals.rs +0 -33
- data/vendor/cfsolve/src/deobfuscate/analysis/names.rs +0 -52
- data/vendor/cfsolve/src/listing/normalize.rs +0 -264
- data/vendor/cfsolve/src/stage2/analysis/outputs.rs +0 -327
- data/vendor/cfsolve/src/stage2/probes/stylesheets.rs +0 -249
- data/vendor/cfsolve/src/stage2/reference-expanded.json +0 -42
- data/vendor/cfsolve/src/stage2/session_names.rs +0 -470
- /data/THIRD_PARTY_LICENSES/{derive_builder-0.20.2 → cobs-0.3.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{compact_str-0.7.1 → compact_str-0.10.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{ahash-0.8.12 → embedded-io-0.4.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{arrayvec-0.7.6 → embedded-io-0.6.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{normpath-0.2.0 → escape-simd-0.1.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{bstr-1.12.1 → itertools-0.15.0}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{petgraph-0.7.1 → itertools-0.15.0}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{itoa-1.0.17 → itoa-1.0.19}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{camino-1.2.2 → itoa-1.0.19}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{globset-0.4.18 → memchr-2.8.3}/COPYING +0 -0
- /data/THIRD_PARTY_LICENSES/{globset-0.4.18 → memchr-2.8.3}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{camino-1.2.2 → num-bigint-0.5.1}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{swc_sourcemap-9.3.4 → oxc_sourcemap-9.0.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf-0.11.3 → phf-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_generator-0.11.3 → phf_generator-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_macros-0.11.3 → phf_macros-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{phf_shared-0.11.3 → phf_shared-0.14.0}/LICENSE +0 -0
- /data/THIRD_PARTY_LICENSES/{fixedbitset-0.5.7 → postcard-1.1.3}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{hashbrown-0.14.5 → smallvec-1.16.5}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{smallvec-1.15.1 → smallvec-1.16.5}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{unicode-width-0.1.14 → unicode-segmentation-1.13.3}/COPYRIGHT +0 -0
- /data/THIRD_PARTY_LICENSES/{hashbrown-0.16.1 → unicode-segmentation-1.13.3}/LICENSE-APACHE +0 -0
- /data/THIRD_PARTY_LICENSES/{heck-0.5.0 → unicode-segmentation-1.13.3}/LICENSE-MIT +0 -0
- /data/THIRD_PARTY_LICENSES/{cargo-platform-0.1.9 → zmij_ecma-1.0.23}/LICENSE-MIT +0 -0
|
@@ -11,7 +11,7 @@ use url::Url;
|
|
|
11
11
|
use wreq::ws::message::Message;
|
|
12
12
|
|
|
13
13
|
use super::channel::Submission;
|
|
14
|
-
use super::timing::{self, Schedule, Timer};
|
|
14
|
+
use super::timing::{self, Schedule, Timeline, Timer};
|
|
15
15
|
use super::widget::{Embedding, WidgetSession};
|
|
16
16
|
use crate::browser::{Profile, Solve};
|
|
17
17
|
use crate::challenge::payload;
|
|
@@ -59,8 +59,14 @@ pub(crate) async fn prepare(session: &WidgetSession<'_>, solve: &Solve) -> Resul
|
|
|
59
59
|
let engine = session.client.engine();
|
|
60
60
|
let plan = session.analysis.plan();
|
|
61
61
|
let mut options = session.request.options.clone();
|
|
62
|
-
let
|
|
62
|
+
let mut observed = observe(session, plan, profile).await?;
|
|
63
63
|
observed.page_signals = Some(merged.page_signals.clone());
|
|
64
|
+
let replay = answers.map(|answers| Replay::new(answers, plan));
|
|
65
|
+
let planned = durations(plan, &profile.durations, &observed, replay.as_ref());
|
|
66
|
+
// The stack is needed only for the records, so rebuild it while the probes run.
|
|
67
|
+
let probes = run_probes(session, plan, &options, profile, &mut observed, &planned);
|
|
68
|
+
let ((schedule, fetches), stack) = tokio::try_join!(probes, probe_stack(session, plan))?;
|
|
69
|
+
observed.stack = stack;
|
|
64
70
|
// Resource timings now include the first POST and probe requests.
|
|
65
71
|
if let Some(timing) = &merged.state.timing {
|
|
66
72
|
let mut resources = merged.resources.clone();
|
|
@@ -82,17 +88,6 @@ pub(crate) async fn prepare(session: &WidgetSession<'_>, solve: &Solve) -> Resul
|
|
|
82
88
|
}
|
|
83
89
|
window.extend(profile.window.clone());
|
|
84
90
|
|
|
85
|
-
let replay = answers
|
|
86
|
-
.map(|answers| Replay::new(answers, plan, &session.fetched.source, &session.installed))
|
|
87
|
-
.transpose()?;
|
|
88
|
-
let pending_ms = i64::from(profile.pending_ms);
|
|
89
|
-
let schedule = timing::schedule(
|
|
90
|
-
&durations(plan, &profile.durations, &observed, replay.as_ref()),
|
|
91
|
-
profile.startup_ms.into(),
|
|
92
|
-
pending_ms,
|
|
93
|
-
session.arrived_ms,
|
|
94
|
-
performance_clock::epoch_ms(),
|
|
95
|
-
);
|
|
96
91
|
if let Some((probe, Operation::PerformanceEntries { fields })) =
|
|
97
92
|
plan.operation(Kind::PerformanceEntries)
|
|
98
93
|
{
|
|
@@ -107,15 +102,19 @@ pub(crate) async fn prepare(session: &WidgetSession<'_>, solve: &Solve) -> Resul
|
|
|
107
102
|
engine,
|
|
108
103
|
));
|
|
109
104
|
}
|
|
105
|
+
let mut globals = merged.audit_globals.0.clone();
|
|
106
|
+
globals.extend(replay::Globals::recover(&session.fetched.source).0);
|
|
107
|
+
let globals = replay::Globals(globals);
|
|
110
108
|
let stored = replay::Session {
|
|
111
|
-
iframe_url: session.fetched.iframe.url.as_str(),
|
|
112
109
|
iframe_html: &session.fetched.iframe.html,
|
|
110
|
+
iframe_url: session.fetched.iframe.url.as_str(),
|
|
113
111
|
modified: Local::now().format("%m/%d/%Y %H:%M:%S").to_string(),
|
|
114
112
|
referrer: session.fetched.referrer.as_deref().unwrap_or_default(),
|
|
115
113
|
navigation: &session.fetched.iframe.navigation,
|
|
116
114
|
options: &options,
|
|
117
115
|
trace: Trace::recover(&session.fetched.source),
|
|
118
116
|
controller: plan.controller_trace.as_deref(),
|
|
117
|
+
globals: &globals,
|
|
119
118
|
};
|
|
120
119
|
let records = records(
|
|
121
120
|
plan,
|
|
@@ -133,14 +132,14 @@ pub(crate) async fn prepare(session: &WidgetSession<'_>, solve: &Solve) -> Resul
|
|
|
133
132
|
},
|
|
134
133
|
records,
|
|
135
134
|
&profile.document,
|
|
136
|
-
pending_ms,
|
|
135
|
+
profile.pending_ms.into(),
|
|
137
136
|
)?;
|
|
138
137
|
ensure!(
|
|
139
138
|
plaintext.len() > plan.probes().len(),
|
|
140
139
|
"the assembled payload holds nothing besides records"
|
|
141
140
|
);
|
|
142
141
|
payload::append_send_time_at(&mut plaintext, &merged.state, &options, schedule.send_at);
|
|
143
|
-
let geometry = window_geometry(replay.as_ref(), &plaintext);
|
|
142
|
+
let geometry = window_geometry(plan, replay.as_ref(), &plaintext);
|
|
144
143
|
Ok(ProbeSubmission {
|
|
145
144
|
payload: Submission {
|
|
146
145
|
plaintext,
|
|
@@ -152,33 +151,28 @@ pub(crate) async fn prepare(session: &WidgetSession<'_>, solve: &Solve) -> Resul
|
|
|
152
151
|
})
|
|
153
152
|
}
|
|
154
153
|
|
|
155
|
-
/// Collects
|
|
156
|
-
///
|
|
154
|
+
/// Collects the measurements that make no requests, except the stack. Probes with requests make
|
|
155
|
+
/// them as they run; see [`run_probes`].
|
|
157
156
|
async fn observe(
|
|
158
157
|
session: &WidgetSession<'_>,
|
|
159
158
|
plan: &ProbePlan,
|
|
160
|
-
options: &Options,
|
|
161
159
|
profile: &Profile,
|
|
162
|
-
) -> Result<
|
|
160
|
+
) -> Result<Observed> {
|
|
163
161
|
let mut observed = Observed::default();
|
|
164
|
-
let requests = requests(session, plan, options, profile, &mut observed);
|
|
165
|
-
let stack = probe_stack(session, plan);
|
|
166
|
-
let (fetches, stack) = tokio::try_join!(requests, stack)?;
|
|
167
|
-
observed.stack = stack;
|
|
168
162
|
let facts = &profile.facts;
|
|
169
163
|
let resolution = session.clock_resolution();
|
|
170
|
-
if let Some((probe, Operation::Benchmark { fields })) = plan.operation(Kind::Benchmark) {
|
|
171
|
-
let measured = fields
|
|
172
|
-
.measure(&facts.benchmark_worker, resolution)
|
|
173
|
-
.with_context(|| format!("running probe {}'s benchmark", probe.index))?;
|
|
174
|
-
observed.benchmark = Some(measured);
|
|
175
|
-
}
|
|
176
164
|
if let (Some((probe, _)), Some(previous)) = (plan.operation(Kind::Media), &facts.media) {
|
|
177
165
|
let media = ice::refresh(previous.clone())
|
|
178
166
|
.with_context(|| format!("refreshing probe {}'s media", probe.index))?;
|
|
179
167
|
session.sink.json("media-measurement.json", &media)?;
|
|
180
168
|
observed.media = Some(media);
|
|
181
169
|
}
|
|
170
|
+
if let Some((probe, Operation::Benchmark { fields })) = plan.operation(Kind::Benchmark) {
|
|
171
|
+
let measured = fields
|
|
172
|
+
.measure(&facts.benchmark_worker, resolution)
|
|
173
|
+
.with_context(|| format!("running probe {}'s benchmark", probe.index))?;
|
|
174
|
+
observed.benchmark = Some(measured);
|
|
175
|
+
}
|
|
182
176
|
// The worker compares 5000 consecutive clock-reading pairs. Chrome's call overhead usually
|
|
183
177
|
// crosses a 100 µs boundary; faster native reads may miss all boundaries. Retry until a
|
|
184
178
|
// pair crosses one.
|
|
@@ -190,7 +184,7 @@ async fn observe(
|
|
|
190
184
|
.unwrap_or_else(|| worker.back_to_back(clock::PAIRS));
|
|
191
185
|
observed.clock = Some(readings);
|
|
192
186
|
}
|
|
193
|
-
Ok(
|
|
187
|
+
Ok(observed)
|
|
194
188
|
}
|
|
195
189
|
|
|
196
190
|
/// Runs the WebSocket echo exchange. After opening, sends `String(performance.now())` and sends a
|
|
@@ -278,7 +272,8 @@ async fn probe_stack(session: &WidgetSession<'_>, plan: &ProbePlan) -> Result<Op
|
|
|
278
272
|
let origin = fetched.script_position()?;
|
|
279
273
|
let engine = session.client.engine();
|
|
280
274
|
let stack = task::spawn_blocking(move || {
|
|
281
|
-
let
|
|
275
|
+
let resumed = call_stack::Resumption::WorkerMessage;
|
|
276
|
+
let geometry = call_stack::recover_probe(&javascript, &cases, calls, resumed)?;
|
|
282
277
|
anyhow::Ok(geometry.format(&origin, engine))
|
|
283
278
|
})
|
|
284
279
|
.await
|
|
@@ -310,109 +305,145 @@ fn durations(
|
|
|
310
305
|
plan.probes().iter().map(duration).collect()
|
|
311
306
|
}
|
|
312
307
|
|
|
313
|
-
///
|
|
314
|
-
|
|
308
|
+
/// Runs the probes in order from the end of startup, or now if later. A probe that makes
|
|
309
|
+
/// requests waits for its start and lasts at least until they end. Returns the probes' marks
|
|
310
|
+
/// and the loads resource timing lists.
|
|
311
|
+
async fn run_probes(
|
|
315
312
|
session: &WidgetSession<'_>,
|
|
316
313
|
plan: &ProbePlan,
|
|
317
314
|
options: &Options,
|
|
318
315
|
profile: &Profile,
|
|
319
316
|
observed: &mut Observed,
|
|
320
|
-
|
|
321
|
-
|
|
317
|
+
planned: &[i64],
|
|
318
|
+
) -> Result<(Schedule, Vec<LoadTiming>)> {
|
|
319
|
+
let startup_end = session.arrived_ms + i64::from(profile.startup_ms);
|
|
320
|
+
let mut timeline = Timeline::starting(performance_clock::epoch_ms().max(startup_end));
|
|
322
321
|
let mut fetches = Vec::new();
|
|
323
|
-
for probe in plan.probes() {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
_ => host_reachability::Outcome::Rejected,
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
observed.host_reachability = Some(outcomes);
|
|
378
|
-
}
|
|
379
|
-
Some(Operation::WebSocketEcho { fields }) => {
|
|
380
|
-
observed.websocket_echo = Some(echo_websocket(session, fields, options).await?);
|
|
322
|
+
for (probe, &planned_ms) in plan.probes().iter().zip(planned) {
|
|
323
|
+
let requests = matches!(
|
|
324
|
+
probe.operation,
|
|
325
|
+
Some(
|
|
326
|
+
Operation::PrivateToken { .. }
|
|
327
|
+
| Operation::WorkerFetch { .. }
|
|
328
|
+
| Operation::HostReachability { .. }
|
|
329
|
+
| Operation::WebSocketEcho { .. }
|
|
330
|
+
| Operation::Image { .. }
|
|
331
|
+
)
|
|
332
|
+
);
|
|
333
|
+
let finished = if requests {
|
|
334
|
+
timing::sleep_until(timeline.next_start).await;
|
|
335
|
+
request(session, probe, options, profile, observed, &mut fetches).await?;
|
|
336
|
+
Some(performance_clock::epoch_ms())
|
|
337
|
+
} else {
|
|
338
|
+
None
|
|
339
|
+
};
|
|
340
|
+
timeline.finish(planned_ms, finished);
|
|
341
|
+
}
|
|
342
|
+
Ok((timeline.schedule(profile.pending_ms.into()), fetches))
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/// Makes `probe`'s requests as the iframe would. Records its measurement in `observed` and the
|
|
346
|
+
/// loads resource timing lists in `fetches`.
|
|
347
|
+
async fn request(
|
|
348
|
+
session: &WidgetSession<'_>,
|
|
349
|
+
probe: &Probe,
|
|
350
|
+
options: &Options,
|
|
351
|
+
profile: &Profile,
|
|
352
|
+
observed: &mut Observed,
|
|
353
|
+
fetches: &mut Vec<LoadTiming>,
|
|
354
|
+
) -> Result<()> {
|
|
355
|
+
let (client, iframe) = (session.client, &session.fetched.iframe);
|
|
356
|
+
match &probe.operation {
|
|
357
|
+
Some(Operation::PrivateToken { fields }) => {
|
|
358
|
+
let url = fields.url(options, &probe.input, &iframe.url)?;
|
|
359
|
+
let started_ms = performance_clock::epoch_ms();
|
|
360
|
+
// The worker calls `r.text()` before posting results. Treat body-read failures
|
|
361
|
+
// like fetch failures because both reject the promise chain.
|
|
362
|
+
let fetched = http::fetch_from_worker(client, iframe, &url, FetchOptions::NoCache);
|
|
363
|
+
let outcome = async {
|
|
364
|
+
let response = fetched.await?;
|
|
365
|
+
let status = response.status();
|
|
366
|
+
anyhow::Ok(private_token::WorkerOutcome::Response {
|
|
367
|
+
ok: status.is_success(),
|
|
368
|
+
status: status.as_u16(),
|
|
369
|
+
text: response.text().await?,
|
|
370
|
+
})
|
|
381
371
|
}
|
|
382
|
-
|
|
383
|
-
|
|
372
|
+
.await
|
|
373
|
+
.unwrap_or_else(|error| private_token::WorkerOutcome::Rejected {
|
|
374
|
+
worker_error: error.to_string(),
|
|
375
|
+
});
|
|
376
|
+
observed.private_token = Some(private_token::Measurement {
|
|
377
|
+
outcome,
|
|
378
|
+
started_ms,
|
|
379
|
+
finished_ms: performance_clock::epoch_ms(),
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
Some(Operation::WorkerFetch { .. }) if profile.facts.worker_fetch_rejected => {
|
|
383
|
+
observed.worker_fetch = Some(worker_fetch::Measurement::Rejected);
|
|
384
|
+
}
|
|
385
|
+
Some(Operation::HostReachability { fields }) => {
|
|
386
|
+
// CORS rejects a response that does not allow the iframe's origin.
|
|
387
|
+
let origin = iframe.url.origin().ascii_serialization();
|
|
388
|
+
let mut outcomes = Vec::new();
|
|
389
|
+
for url in &fields.urls {
|
|
390
|
+
let url = Url::parse(url).context("parsing a host reachability URL")?;
|
|
391
|
+
let timer = Timer::start();
|
|
384
392
|
let options = FetchOptions::NoStoreWithoutCredentials;
|
|
385
|
-
let fetched = http::fetch_from_worker(client, iframe, &url, options)
|
|
386
|
-
|
|
387
|
-
Ok(response)
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
.
|
|
391
|
-
.
|
|
392
|
-
|
|
393
|
-
|
|
393
|
+
let fetched = http::fetch_from_worker(client, iframe, &url, options);
|
|
394
|
+
outcomes.push(match time::timeout(REACHABILITY_TIMEOUT, fetched).await {
|
|
395
|
+
Ok(Ok(response))
|
|
396
|
+
if response
|
|
397
|
+
.headers()
|
|
398
|
+
.get("access-control-allow-origin")
|
|
399
|
+
.and_then(|allowed| allowed.to_str().ok())
|
|
400
|
+
.is_some_and(|allowed| allowed == "*" || allowed == origin) =>
|
|
401
|
+
{
|
|
402
|
+
host_reachability::Outcome::Answered {
|
|
403
|
+
elapsed_ms: timer.elapsed_ms() as i64,
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
_ => host_reachability::Outcome::Rejected,
|
|
394
407
|
});
|
|
395
408
|
}
|
|
396
|
-
Some(
|
|
397
|
-
let url = fields.url(options, &probe.input, &iframe.url)?;
|
|
398
|
-
let timer = Timer::start();
|
|
399
|
-
let response = http::fetch_image(client, iframe, &url).await?;
|
|
400
|
-
let waiting_ms = timer.elapsed_ms();
|
|
401
|
-
let ok = response.status().is_success();
|
|
402
|
-
let (body, network) = http::read_encoded(response)
|
|
403
|
-
.await
|
|
404
|
-
.context("reading a challenge image")?;
|
|
405
|
-
fetches.push(timer.phased(url.as_str(), waiting_ms, network.encoded_bytes));
|
|
406
|
-
observed.image = Some(image::Measurement::loaded(
|
|
407
|
-
ok.then_some(&body[..]),
|
|
408
|
-
&profile.image.effective_type,
|
|
409
|
-
profile.image.online,
|
|
410
|
-
));
|
|
411
|
-
}
|
|
412
|
-
_ => {}
|
|
409
|
+
observed.host_reachability = Some(outcomes);
|
|
413
410
|
}
|
|
411
|
+
Some(Operation::WebSocketEcho { fields }) => {
|
|
412
|
+
observed.websocket_echo = Some(echo_websocket(session, fields, options).await?);
|
|
413
|
+
}
|
|
414
|
+
Some(Operation::WorkerFetch { fields }) => {
|
|
415
|
+
let url = fields.url(options)?;
|
|
416
|
+
let options = FetchOptions::NoStoreWithoutCredentials;
|
|
417
|
+
let fetched = http::fetch_from_worker(client, iframe, &url, options).await;
|
|
418
|
+
observed.worker_fetch = Some(match fetched {
|
|
419
|
+
Ok(response) => worker_fetch::Measurement::Response {
|
|
420
|
+
status: response.status().as_u16(),
|
|
421
|
+
headers: http::text_headers(response.headers())
|
|
422
|
+
.map(|(name, value)| (name.to_owned(), value))
|
|
423
|
+
.collect(),
|
|
424
|
+
},
|
|
425
|
+
Err(_) => worker_fetch::Measurement::Rejected,
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
Some(Operation::Image { fields }) => {
|
|
429
|
+
let url = fields.url(options, &probe.input, &iframe.url)?;
|
|
430
|
+
let timer = Timer::start();
|
|
431
|
+
let response = http::fetch_image(client, iframe, &url).await?;
|
|
432
|
+
let waiting_ms = timer.elapsed_ms();
|
|
433
|
+
let ok = response.status().is_success();
|
|
434
|
+
let (body, network) = http::read_encoded(response)
|
|
435
|
+
.await
|
|
436
|
+
.context("reading a challenge image")?;
|
|
437
|
+
fetches.push(timer.phased(url.as_str(), waiting_ms, network.encoded_bytes));
|
|
438
|
+
observed.image = Some(image::Measurement::loaded(
|
|
439
|
+
ok.then_some(&body[..]),
|
|
440
|
+
&profile.image.effective_type,
|
|
441
|
+
profile.image.online,
|
|
442
|
+
));
|
|
443
|
+
}
|
|
444
|
+
_ => {}
|
|
414
445
|
}
|
|
415
|
-
Ok(
|
|
446
|
+
Ok(())
|
|
416
447
|
}
|
|
417
448
|
|
|
418
449
|
/// Builds probe records with scheduled timestamps. Stored answers use `stored` and preserve the
|
|
@@ -464,9 +495,13 @@ fn records(
|
|
|
464
495
|
}
|
|
465
496
|
|
|
466
497
|
/// Window dimensions and position already reported by the environment audit.
|
|
467
|
-
fn window_geometry(
|
|
498
|
+
fn window_geometry(
|
|
499
|
+
plan: &ProbePlan,
|
|
500
|
+
replay: Option<&Replay<'_>>,
|
|
501
|
+
payload: &Payload,
|
|
502
|
+
) -> BTreeMap<String, f64> {
|
|
468
503
|
let groups = replay
|
|
469
|
-
.and_then(|replay| replay.audit_groups(payload))
|
|
504
|
+
.and_then(|replay| replay.audit_groups(plan, payload))
|
|
470
505
|
.into_iter()
|
|
471
506
|
.flatten();
|
|
472
507
|
let mut geometry = BTreeMap::new();
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
//! Session artifact storage and progress reporting.
|
|
2
2
|
|
|
3
|
+
use std::fmt;
|
|
4
|
+
|
|
3
5
|
use anyhow::{Context, Result};
|
|
4
6
|
use serde::Serialize;
|
|
5
7
|
|
|
@@ -21,11 +23,34 @@ impl Sink for Discard {
|
|
|
21
23
|
fn progress(&self, _: &str) {}
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
/// Marks a failure as the sink's own, so it is not mistaken for a challenge the solver cannot
|
|
27
|
+
/// handle.
|
|
28
|
+
#[derive(Debug)]
|
|
29
|
+
pub(crate) struct SinkFailed {
|
|
30
|
+
name: String,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
impl fmt::Display for SinkFailed {
|
|
34
|
+
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
35
|
+
write!(formatter, "saving artifact {}", self.name)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
24
39
|
impl dyn Sink + '_ {
|
|
40
|
+
/// Saves `contents` under artifact `name` with [`Sink::artifact`], marking a failure with
|
|
41
|
+
/// [`SinkFailed`].
|
|
42
|
+
pub(crate) fn save(&self, name: &str, contents: &[u8]) -> Result<()> {
|
|
43
|
+
self.artifact(name, contents).map_err(|error| {
|
|
44
|
+
error.context(SinkFailed {
|
|
45
|
+
name: name.to_owned(),
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
25
50
|
/// Saves `value` as pretty-printed JSON under artifact `name`.
|
|
26
51
|
pub(crate) fn json(&self, name: &str, value: &impl Serialize) -> Result<()> {
|
|
27
52
|
let json =
|
|
28
53
|
serde_json::to_vec_pretty(value).with_context(|| format!("serializing {name}"))?;
|
|
29
|
-
self.
|
|
54
|
+
self.save(name, &json)
|
|
30
55
|
}
|
|
31
56
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
//! Regression tests for a challenge-page session.
|
|
2
2
|
|
|
3
|
+
use wreq::StatusCode;
|
|
4
|
+
|
|
5
|
+
use crate::Error;
|
|
3
6
|
use crate::challenge::reduced_timing::{Measure, ResourceTiming};
|
|
4
7
|
use crate::js::json;
|
|
5
8
|
use crate::resource_timing::{LoadTiming, Phases};
|
|
6
|
-
use crate::session::challenge_page;
|
|
9
|
+
use crate::session::{Stage, challenge_page};
|
|
7
10
|
|
|
8
11
|
/// A load measured only as a whole.
|
|
9
12
|
fn fetch(url: &str, started_ms: i64, duration_ms: f64) -> LoadTiming {
|
|
@@ -61,3 +64,35 @@ fn the_pages_resource_timing_lists_both_of_the_widget_programs_reads() {
|
|
|
61
64
|
]
|
|
62
65
|
);
|
|
63
66
|
}
|
|
67
|
+
|
|
68
|
+
/// Whether a clearance form response refuses the answers, as a caller sees it.
|
|
69
|
+
fn refused(status: StatusCode, challenged: bool, clearance: Option<&str>) -> bool {
|
|
70
|
+
let error = challenge_page::accept_clearance(status, challenged, clearance.map(str::to_owned))
|
|
71
|
+
.expect_err("the response should not pass");
|
|
72
|
+
matches!(
|
|
73
|
+
Error::classify(error),
|
|
74
|
+
Error::Rejected {
|
|
75
|
+
stage: Stage::Clearance,
|
|
76
|
+
..
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/// A `cf_clearance` cookie is a pass whatever the status of the page behind the challenge,
|
|
82
|
+
/// such as a waiting room's HTTP 429. Another challenge page, or an error status without the
|
|
83
|
+
/// cookie, is a refusal. A success without the cookie is a failure the solver can't explain.
|
|
84
|
+
#[test]
|
|
85
|
+
fn the_clearance_form_passes_when_it_sets_the_cookie_whatever_the_pages_status() {
|
|
86
|
+
for status in [
|
|
87
|
+
StatusCode::OK,
|
|
88
|
+
StatusCode::TOO_MANY_REQUESTS,
|
|
89
|
+
StatusCode::NOT_FOUND,
|
|
90
|
+
] {
|
|
91
|
+
let clearance = challenge_page::accept_clearance(status, false, Some("token".into()));
|
|
92
|
+
assert_eq!(clearance.unwrap(), "token", "HTTP {status}");
|
|
93
|
+
}
|
|
94
|
+
assert!(refused(StatusCode::OK, true, Some("token")));
|
|
95
|
+
assert!(refused(StatusCode::FORBIDDEN, true, Some("token")));
|
|
96
|
+
assert!(refused(StatusCode::TOO_MANY_REQUESTS, false, None));
|
|
97
|
+
assert!(!refused(StatusCode::OK, false, None));
|
|
98
|
+
}
|
|
@@ -79,32 +79,43 @@ pub(crate) struct Schedule {
|
|
|
79
79
|
pub send_at: i64,
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
///
|
|
83
|
-
///
|
|
84
|
-
|
|
85
|
-
///
|
|
86
|
-
pub
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
) ->
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
let
|
|
104
|
-
|
|
105
|
-
start
|
|
82
|
+
/// Probe marks laid out as the probes run: in order, one millisecond apart. A probe lasts its
|
|
83
|
+
/// planned duration, or until the work it waits for, such as a request, ends.
|
|
84
|
+
pub(crate) struct Timeline {
|
|
85
|
+
/// When the next probe starts, in epoch milliseconds.
|
|
86
|
+
pub next_start: i64,
|
|
87
|
+
marks: Vec<ProbeMarks>,
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
impl Timeline {
|
|
91
|
+
#[must_use]
|
|
92
|
+
pub(crate) fn starting(next_start: i64) -> Self {
|
|
93
|
+
Self {
|
|
94
|
+
next_start,
|
|
95
|
+
marks: Vec::new(),
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/// Ends the next probe `planned_ms` after it starts, or at `finished_ms` if its work ended
|
|
100
|
+
/// later.
|
|
101
|
+
pub(crate) fn finish(&mut self, planned_ms: i64, finished_ms: Option<i64>) {
|
|
102
|
+
let start = self.next_start;
|
|
103
|
+
let planned_end = start + planned_ms;
|
|
104
|
+
let end = finished_ms.map_or(planned_end, |finished| finished.max(planned_end));
|
|
105
|
+
self.marks.push(ProbeMarks { start, end });
|
|
106
|
+
self.next_start = end + 1;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/// Sends `pending_ms` after the last probe's next mark. Programs without probes send when
|
|
110
|
+
/// they start.
|
|
111
|
+
#[must_use]
|
|
112
|
+
pub(crate) fn schedule(self, pending_ms: i64) -> Schedule {
|
|
113
|
+
let pending_ms = if self.marks.is_empty() { 0 } else { pending_ms };
|
|
114
|
+
Schedule {
|
|
115
|
+
marks: self.marks,
|
|
116
|
+
send_at: self.next_start + pending_ms,
|
|
117
|
+
}
|
|
106
118
|
}
|
|
107
|
-
Schedule { marks, send_at }
|
|
108
119
|
}
|
|
109
120
|
|
|
110
121
|
#[cfg(test)]
|
|
@@ -112,13 +123,14 @@ mod tests {
|
|
|
112
123
|
use super::*;
|
|
113
124
|
|
|
114
125
|
#[test]
|
|
115
|
-
fn
|
|
116
|
-
let
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
);
|
|
126
|
+
fn probes_run_in_order_and_last_until_their_requests_end() {
|
|
127
|
+
let mut timeline = Timeline::starting(1_400);
|
|
128
|
+
timeline.finish(3, None);
|
|
129
|
+
// The request took longer than planned.
|
|
130
|
+
timeline.finish(5, Some(1_430));
|
|
131
|
+
// The request ended before the planned duration ran out.
|
|
132
|
+
timeline.finish(10, Some(1_433));
|
|
133
|
+
let schedule = timeline.schedule(15);
|
|
122
134
|
assert_eq!(
|
|
123
135
|
schedule.marks,
|
|
124
136
|
[
|
|
@@ -128,35 +140,28 @@ mod tests {
|
|
|
128
140
|
},
|
|
129
141
|
ProbeMarks {
|
|
130
142
|
start: 1_404,
|
|
131
|
-
end:
|
|
143
|
+
end: 1_430
|
|
132
144
|
},
|
|
133
|
-
|
|
134
|
-
|
|
145
|
+
ProbeMarks {
|
|
146
|
+
start: 1_431,
|
|
147
|
+
end: 1_441
|
|
148
|
+
},
|
|
149
|
+
]
|
|
135
150
|
);
|
|
136
|
-
|
|
137
|
-
let late = super::schedule(&[3, 5], 400, 15, 1_000, 2_000);
|
|
138
|
-
assert_eq!(late.send_at, 2_000);
|
|
139
151
|
assert_eq!(
|
|
140
|
-
|
|
141
|
-
"
|
|
152
|
+
schedule.send_at, 1_457,
|
|
153
|
+
"the last probe's next mark is exactly `pending_ms` before sending"
|
|
142
154
|
);
|
|
155
|
+
assert_eq!(Timeline::starting(900).schedule(15).send_at, 900);
|
|
143
156
|
}
|
|
144
157
|
|
|
145
158
|
#[test]
|
|
146
|
-
fn
|
|
147
|
-
let
|
|
159
|
+
fn signed_durations_are_kept() {
|
|
160
|
+
let mut timeline = Timeline::starting(0);
|
|
161
|
+
timeline.finish(-2, None);
|
|
148
162
|
assert_eq!(
|
|
149
|
-
schedule,
|
|
150
|
-
|
|
151
|
-
marks: Vec::new(),
|
|
152
|
-
send_at: 1_400
|
|
153
|
-
}
|
|
163
|
+
timeline.schedule(0).marks,
|
|
164
|
+
[ProbeMarks { start: 0, end: -2 }]
|
|
154
165
|
);
|
|
155
166
|
}
|
|
156
|
-
|
|
157
|
-
#[test]
|
|
158
|
-
fn signed_durations_are_kept() {
|
|
159
|
-
let schedule = schedule(&[-2, 4], 0, 0, 0, 0);
|
|
160
|
-
assert_eq!(schedule.marks[0].end - schedule.marks[0].start, -2);
|
|
161
|
-
}
|
|
162
167
|
}
|