cfsolve 0.1.2 → 0.1.4
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 +22 -0
- data/README.md +8 -3
- 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 +14 -6
- 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/chrome-157-macos/answers.json +4777 -0
- data/lib/cfsolve/profiles/chrome-157-macos.json +613 -0
- data/lib/cfsolve/profiles/safari-26-ios/answers.json +266 -265
- data/lib/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +312 -312
- data/lib/cfsolve/profiles/safari-26-ios.json +106 -152
- data/lib/cfsolve/version.rb +2 -2
- data/lib/cfsolve.rb +1 -1
- data/vendor/cfsolve/Cargo.lock +561 -1729
- data/vendor/cfsolve/Cargo.toml +26 -8
- data/vendor/cfsolve/README.md +57 -5
- data/vendor/cfsolve/examples/check_answers.rs +2 -2
- data/vendor/cfsolve/examples/compare_session.rs +1 -2
- 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 +2 -2
- data/vendor/cfsolve/examples/tls_echo.rs +3 -3
- data/vendor/cfsolve/examples/turnstile_smoke.rs +58 -0
- data/vendor/cfsolve/examples/vm_snapshot.rs +32 -33
- data/vendor/cfsolve/profiles/chrome-157-macos/answers.json +4777 -0
- data/vendor/cfsolve/profiles/chrome-157-macos.json +613 -0
- data/vendor/cfsolve/profiles/safari-26-ios/answers.json +266 -265
- data/vendor/cfsolve/profiles/safari-26-ios/challenge-page-answers.json +312 -312
- data/vendor/cfsolve/profiles/safari-26-ios.json +106 -152
- 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/proxy/tests.rs +1 -1
- data/vendor/cfsolve/src/capture/proxy.rs +44 -13
- 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 +11 -10
- data/vendor/cfsolve/src/challenge/installed.rs +13 -6
- 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 +69 -31
- 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 +180 -148
- 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 +198 -203
- data/vendor/cfsolve/src/deobfuscate/function_lengths.rs +32 -38
- data/vendor/cfsolve/src/deobfuscate/helper_objects.rs +338 -513
- 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 +353 -327
- 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 +132 -24
- data/vendor/cfsolve/src/embedding_page/page.rs +41 -1
- 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 +7 -10
- data/vendor/cfsolve/src/http/requests.rs +2 -2
- data/vendor/cfsolve/src/js/ast.rs +479 -263
- data/vendor/cfsolve/src/lib.rs +1 -0
- data/vendor/cfsolve/src/listing/fold.rs +19 -9
- data/vendor/cfsolve/src/listing/query.rs +1 -47
- 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 +12 -11
- data/vendor/cfsolve/src/session/probes.rs +1 -0
- 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.rs +1 -1
- data/vendor/cfsolve/src/solver.rs +3 -1
- data/vendor/cfsolve/src/stage2/analysis/analyze.rs +33 -4
- data/vendor/cfsolve/src/stage2/analysis/audit.rs +4 -2
- data/vendor/cfsolve/src/stage2/analysis/discovery.rs +13 -2
- data/vendor/cfsolve/src/stage2/analysis/envelope.rs +2 -1
- data/vendor/cfsolve/src/stage2/audit_globals.rs +142 -74
- data/vendor/cfsolve/src/stage2/benchmark.rs +113 -41
- data/vendor/cfsolve/src/stage2/call_stack.rs +1564 -1041
- data/vendor/cfsolve/src/stage2/challenge_page.rs +3 -2
- data/vendor/cfsolve/src/stage2/fixtures/encoded_benchmark_worker.js +1 -0
- 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/plan.rs +5 -4
- data/vendor/cfsolve/src/stage2/payload/recover.rs +2 -2
- data/vendor/cfsolve/src/stage2/probes/clock.rs +1 -3
- data/vendor/cfsolve/src/stage2/probes/dates.rs +44 -0
- data/vendor/cfsolve/src/stage2/probes/parent_info_array.rs +326 -0
- data/vendor/cfsolve/src/stage2/probes/performance.rs +12 -8
- data/vendor/cfsolve/src/stage2/probes/stack.rs +117 -4
- data/vendor/cfsolve/src/stage2/probes/websocket_echo.rs +80 -2
- data/vendor/cfsolve/src/stage2/probes.rs +1 -0
- data/vendor/cfsolve/src/stage2/queries.rs +50 -0
- data/vendor/cfsolve/src/stage2/reference.rs +5 -0
- data/vendor/cfsolve/src/stage2/registry.rs +8 -2
- data/vendor/cfsolve/src/stage2/replay.rs +34 -3
- data/vendor/cfsolve/src/stage2/stylesheets.rs +35 -0
- data/vendor/cfsolve/src/stage2/syntax.rs +88 -0
- data/vendor/cfsolve/src/stage2/trace.rs +134 -108
- data/vendor/cfsolve/src/stage2/value_labels.rs +185 -0
- data/vendor/cfsolve/src/stage2/vocabulary.rs +112 -17
- data/vendor/cfsolve/src/stage2.rs +3 -0
- data/vendor/cfsolve/src/vm/disassemble.rs +75 -7
- data/vendor/cfsolve/src/vm/dispatch.rs +93 -65
- data/vendor/cfsolve/src/vm/encoded_names.rs +635 -0
- data/vendor/cfsolve/src/vm/extract.rs +550 -250
- data/vendor/cfsolve/src/vm/fixtures/free_functions/README.md +9 -0
- data/vendor/cfsolve/src/vm/fixtures/free_functions/machine.js +7438 -0
- data/vendor/cfsolve/src/vm/fixtures/free_functions/program.base64 +1 -0
- data/vendor/cfsolve/src/vm/interpret/access.rs +71 -50
- data/vendor/cfsolve/src/vm/interpret/builtin.rs +10 -10
- data/vendor/cfsolve/src/vm/interpret/call.rs +116 -52
- data/vendor/cfsolve/src/vm/interpret/compile.rs +79 -62
- data/vendor/cfsolve/src/vm/interpret/copies.rs +2 -2
- data/vendor/cfsolve/src/vm/interpret/evaluate/tests.rs +63 -42
- data/vendor/cfsolve/src/vm/interpret/evaluate.rs +65 -575
- data/vendor/cfsolve/src/vm/interpret/explore.rs +7 -10
- data/vendor/cfsolve/src/vm/interpret/formula.rs +131 -0
- data/vendor/cfsolve/src/vm/interpret/frozen.rs +3 -5
- data/vendor/cfsolve/src/vm/interpret/intrinsic.rs +160 -58
- 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 +1765 -0
- data/vendor/cfsolve/src/vm/interpret/plan.rs +586 -338
- data/vendor/cfsolve/src/vm/interpret/register_helpers.rs +392 -0
- data/vendor/cfsolve/src/vm/interpret/run.rs +120 -45
- 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 +9 -1
- data/vendor/cfsolve/src/vm/machine.rs +116 -51
- data/vendor/cfsolve/src/vm/output.rs +19 -6
- data/vendor/cfsolve/src/vm/packed_names.rs +11 -7
- data/vendor/cfsolve/src/vm/registers.rs +35 -21
- data/vendor/cfsolve/src/vm/session.rs +189 -121
- data/vendor/cfsolve/src/vm/value.rs +22 -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
- metadata +106 -178
- 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/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
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
//! Builds the `extraParams` reply `api.js` sends to the iframe's `requestExtraParams`: widget
|
|
2
2
|
//! configuration, elapsed times, loader resource timing, and the page summary.
|
|
3
3
|
|
|
4
|
-
use anyhow::{Context, Result};
|
|
4
|
+
use anyhow::{Context, Result, ensure};
|
|
5
|
+
use oxc::ast::AstKind;
|
|
6
|
+
use oxc::ast::ast::{CallExpression, Expression, ObjectPropertyKind};
|
|
7
|
+
use oxc::ast_visit::{Visit, walk};
|
|
5
8
|
use serde::{Deserialize, Serialize};
|
|
6
|
-
use swc_core::ecma::ast::{CallExpr, Expr, KeyValueProp};
|
|
7
|
-
use swc_core::ecma::visit::{Visit, VisitWith};
|
|
8
9
|
use url::Url;
|
|
9
10
|
|
|
10
11
|
use crate::challenge::reduced_timing::{Entry, ResourceTiming};
|
|
11
|
-
use crate::embedding_page::page::{
|
|
12
|
+
use crate::embedding_page::page::{PageSignals, RenderedPage};
|
|
12
13
|
use crate::embedding_page::render_sample::RenderSample;
|
|
13
14
|
use crate::engine::Engine;
|
|
14
|
-
use crate::js::{
|
|
15
|
+
use crate::js::ast::{self, ParsedScript, Script};
|
|
16
|
+
use crate::js::{JsValue, json};
|
|
15
17
|
use crate::resource_timing::{NEXT_HOP_PROTOCOL, Phases, ResourceMeasurement};
|
|
16
18
|
use crate::{candidates, random_id};
|
|
17
19
|
|
|
@@ -54,6 +56,7 @@ pub(crate) struct ApiScript {
|
|
|
54
56
|
pub render_sample: RenderSample,
|
|
55
57
|
/// The loader's source, for [`RenderSample::explicit`] once a render's caller is known.
|
|
56
58
|
pub source: String,
|
|
59
|
+
positional_signals: bool,
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
/// Resource timing information for the loader response.
|
|
@@ -95,16 +98,18 @@ impl ApiScript {
|
|
|
95
98
|
timeline: &Timeline,
|
|
96
99
|
engine: Engine,
|
|
97
100
|
) -> Result<Self> {
|
|
98
|
-
let parsed =
|
|
101
|
+
let parsed = ParsedScript::parse("the Turnstile loader", source)?;
|
|
102
|
+
let script = parsed.script();
|
|
99
103
|
let mut literals = Literals::default();
|
|
100
|
-
|
|
104
|
+
literals.visit_program(script.program);
|
|
101
105
|
let build = candidates::at_most_one_distinct(literals.builds, "build hash")?
|
|
102
106
|
.context("loader script has no api.js build hash; is this really api.js?")?;
|
|
103
107
|
let variant =
|
|
104
108
|
candidates::at_most_one_distinct(literals.routes, "challenge-platform route")?
|
|
105
109
|
.context("loader script names no challenge-platform route")?;
|
|
106
110
|
let render_sample =
|
|
107
|
-
RenderSample::
|
|
111
|
+
RenderSample::from_script(script, stack_url(&url, &response, engine), engine)?;
|
|
112
|
+
let positional_signals = positional_signals(script)?;
|
|
108
113
|
Ok(Self {
|
|
109
114
|
url,
|
|
110
115
|
build,
|
|
@@ -113,9 +118,18 @@ impl ApiScript {
|
|
|
113
118
|
response,
|
|
114
119
|
render_sample,
|
|
115
120
|
source: source.to_owned(),
|
|
121
|
+
positional_signals,
|
|
116
122
|
})
|
|
117
123
|
}
|
|
118
124
|
|
|
125
|
+
fn signals(&self, signals: &PageSignals) -> JsValue {
|
|
126
|
+
if self.positional_signals {
|
|
127
|
+
signals.positional()
|
|
128
|
+
} else {
|
|
129
|
+
json!(signals)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
119
133
|
/// The loader's URL as `engine` names it in stacks.
|
|
120
134
|
#[must_use]
|
|
121
135
|
pub(crate) fn stack_url(&self, engine: Engine) -> &Url {
|
|
@@ -199,6 +213,70 @@ impl ApiScript {
|
|
|
199
213
|
}
|
|
200
214
|
}
|
|
201
215
|
|
|
216
|
+
/// Identify the value actually sent as `wPr`, following its declaration by semantic binding.
|
|
217
|
+
/// Reject unknown array layouts rather than silently submitting an incorrectly ordered record.
|
|
218
|
+
fn positional_signals(script: Script<'_>) -> Result<bool> {
|
|
219
|
+
for node in script.nodes.iter() {
|
|
220
|
+
let AstKind::ObjectProperty(property) = node.kind() else {
|
|
221
|
+
continue;
|
|
222
|
+
};
|
|
223
|
+
if ast::key_str(&property.key, property.computed) != Some("wPr") {
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
let mut value = property.value.without_parentheses();
|
|
227
|
+
if let Expression::Identifier(reference) = value
|
|
228
|
+
&& let Some(symbol) = script.symbol(reference)
|
|
229
|
+
{
|
|
230
|
+
value = script
|
|
231
|
+
.nodes
|
|
232
|
+
.iter()
|
|
233
|
+
.find_map(|node| {
|
|
234
|
+
let AstKind::VariableDeclarator(declaration) = node.kind() else {
|
|
235
|
+
return None;
|
|
236
|
+
};
|
|
237
|
+
let oxc::ast::ast::BindingPattern::BindingIdentifier(identifier) =
|
|
238
|
+
&declaration.id
|
|
239
|
+
else {
|
|
240
|
+
return None;
|
|
241
|
+
};
|
|
242
|
+
(identifier.symbol_id.get() == Some(symbol))
|
|
243
|
+
.then_some(declaration.init.as_ref())
|
|
244
|
+
.flatten()
|
|
245
|
+
})
|
|
246
|
+
.context("the loader's wPr value has no initializer")?
|
|
247
|
+
.without_parentheses();
|
|
248
|
+
}
|
|
249
|
+
if let Expression::ArrayExpression(array) = value {
|
|
250
|
+
let property_at = |index: usize, name: &str| {
|
|
251
|
+
array
|
|
252
|
+
.elements
|
|
253
|
+
.get(index)
|
|
254
|
+
.and_then(|element| element.as_expression())
|
|
255
|
+
.and_then(Expression::as_member_expression)
|
|
256
|
+
.and_then(ast::member_str)
|
|
257
|
+
== Some(name)
|
|
258
|
+
};
|
|
259
|
+
ensure!(
|
|
260
|
+
array.elements.len() == 30
|
|
261
|
+
&& property_at(2, "referrer")
|
|
262
|
+
&& property_at(5, "href")
|
|
263
|
+
&& property_at(23, "unexpectedHidden")
|
|
264
|
+
&& property_at(25, "visibilityState")
|
|
265
|
+
&& property_at(29, "innerWidth"),
|
|
266
|
+
"the loader uses an unsupported positional page-signals layout"
|
|
267
|
+
);
|
|
268
|
+
return Ok(true);
|
|
269
|
+
}
|
|
270
|
+
ensure!(
|
|
271
|
+
matches!(value, Expression::ObjectExpression(_)),
|
|
272
|
+
"the loader's page-signals format is unknown"
|
|
273
|
+
);
|
|
274
|
+
return Ok(false);
|
|
275
|
+
}
|
|
276
|
+
// Older test loaders omit page signals entirely.
|
|
277
|
+
Ok(false)
|
|
278
|
+
}
|
|
279
|
+
|
|
202
280
|
/// V8 names the loader in stacks by the URL requested, JavaScriptCore by the final response URL.
|
|
203
281
|
fn stack_url<'u>(requested: &'u Url, response: &'u LoaderResponse, engine: Engine) -> &'u Url {
|
|
204
282
|
match engine {
|
|
@@ -214,11 +292,12 @@ struct Literals {
|
|
|
214
292
|
routes: Vec<String>,
|
|
215
293
|
}
|
|
216
294
|
|
|
217
|
-
impl Visit for Literals {
|
|
295
|
+
impl<'a> Visit<'a> for Literals {
|
|
218
296
|
/// `ch: "e694063b5082"`: the twelve-digit hexadecimal build hash, which the iframe compares
|
|
219
297
|
/// with its compiled-in build.
|
|
220
|
-
fn
|
|
221
|
-
if
|
|
298
|
+
fn visit_object_property_kind(&mut self, property: &ObjectPropertyKind<'a>) {
|
|
299
|
+
if let Some(property) = ast::key_value(property)
|
|
300
|
+
&& ast::key_str(&property.key, property.computed) == Some("ch")
|
|
222
301
|
&& let Some(value) = ast::static_str(&property.value)
|
|
223
302
|
&& value.len() == 12
|
|
224
303
|
&& value
|
|
@@ -227,23 +306,25 @@ impl Visit for Literals {
|
|
|
227
306
|
{
|
|
228
307
|
self.builds.push(value.to_owned());
|
|
229
308
|
}
|
|
230
|
-
|
|
309
|
+
walk::walk_object_property_kind(self, property);
|
|
231
310
|
}
|
|
232
311
|
|
|
233
312
|
/// `f(..., "b", Reason.New, ...)`: the one-letter route beside the render reason when the
|
|
234
313
|
/// loader builds a widget's first iframe URL.
|
|
235
|
-
fn
|
|
236
|
-
for pair in call.
|
|
237
|
-
if let
|
|
238
|
-
|
|
239
|
-
|
|
314
|
+
fn visit_call_expression(&mut self, call: &CallExpression<'a>) {
|
|
315
|
+
for pair in call.arguments.windows(2) {
|
|
316
|
+
if let Some(reason) = pair[1]
|
|
317
|
+
.as_expression()
|
|
318
|
+
.and_then(Expression::as_member_expression)
|
|
319
|
+
&& ast::member_str(reason) == Some("New")
|
|
320
|
+
&& let Some(route) = pair[0].as_expression().and_then(ast::static_str)
|
|
240
321
|
&& route.len() == 1
|
|
241
322
|
&& route.bytes().all(|byte| byte.is_ascii_lowercase())
|
|
242
323
|
{
|
|
243
324
|
self.routes.push(route.to_owned());
|
|
244
325
|
}
|
|
245
326
|
}
|
|
246
|
-
|
|
327
|
+
walk::walk_call_expression(self, call);
|
|
247
328
|
}
|
|
248
329
|
}
|
|
249
330
|
|
|
@@ -290,7 +371,7 @@ pub(crate) struct ExtraParams<'page> {
|
|
|
290
371
|
pub upgrade_completed_count: u32,
|
|
291
372
|
pub url: &'page str,
|
|
292
373
|
#[serde(rename = "wPr")]
|
|
293
|
-
pub signals:
|
|
374
|
+
pub signals: JsValue,
|
|
294
375
|
pub widget_id: &'page str,
|
|
295
376
|
#[serde(flatten)]
|
|
296
377
|
pub times: ElapsedTimes,
|
|
@@ -354,10 +435,9 @@ impl Timeline {
|
|
|
354
435
|
#[must_use]
|
|
355
436
|
pub(crate) fn collect<'page>(
|
|
356
437
|
page: &'page RenderedPage,
|
|
357
|
-
|
|
438
|
+
signals: &PageSignals,
|
|
358
439
|
timeline: &Timeline,
|
|
359
440
|
script: &'page ApiScript,
|
|
360
|
-
mode: Option<&str>,
|
|
361
441
|
) -> ExtraParams<'page> {
|
|
362
442
|
let params = &page.params;
|
|
363
443
|
ExtraParams {
|
|
@@ -389,7 +469,7 @@ pub(crate) fn collect<'page>(
|
|
|
389
469
|
upgrade_attempts: 0,
|
|
390
470
|
upgrade_completed_count: 0,
|
|
391
471
|
url: page.url.as_str(),
|
|
392
|
-
signals:
|
|
472
|
+
signals: script.signals(signals),
|
|
393
473
|
widget_id: &page.widget_id,
|
|
394
474
|
times: timeline.times(),
|
|
395
475
|
}
|
|
@@ -435,12 +515,40 @@ pub(crate) fn widget_id() -> String {
|
|
|
435
515
|
mod tests {
|
|
436
516
|
use super::*;
|
|
437
517
|
|
|
518
|
+
#[test]
|
|
519
|
+
fn page_signals_follow_the_sent_binding_and_reject_unknown_array_layouts() {
|
|
520
|
+
let source = |fields: &[String]| {
|
|
521
|
+
format!(
|
|
522
|
+
"function collect() {{ let data=[{}]; function unrelated() {{ let data={{}}; }}; send({{wPr:data}}); }}",
|
|
523
|
+
fields.join(",")
|
|
524
|
+
)
|
|
525
|
+
};
|
|
526
|
+
let mut fields = vec!["null".to_owned(); 30];
|
|
527
|
+
for (index, value) in [
|
|
528
|
+
(2, "document.referrer"),
|
|
529
|
+
(5, "window.location.href"),
|
|
530
|
+
(23, "state.unexpectedHidden"),
|
|
531
|
+
(25, "state.viewport.visibilityState"),
|
|
532
|
+
(29, "window.innerWidth"),
|
|
533
|
+
] {
|
|
534
|
+
fields[index] = value.to_owned();
|
|
535
|
+
}
|
|
536
|
+
let parsed = ParsedScript::parse("loader", &source(&fields)).unwrap();
|
|
537
|
+
assert!(positional_signals(parsed.script()).unwrap());
|
|
538
|
+
fields.swap(23, 24);
|
|
539
|
+
let parsed = ParsedScript::parse("loader", &source(&fields)).unwrap();
|
|
540
|
+
assert!(positional_signals(parsed.script()).is_err());
|
|
541
|
+
let parsed =
|
|
542
|
+
ParsedScript::parse("legacy", "let data = {pi:{}}; send({wPr:data});").unwrap();
|
|
543
|
+
assert!(!positional_signals(parsed.script()).unwrap());
|
|
544
|
+
}
|
|
545
|
+
|
|
438
546
|
#[test]
|
|
439
547
|
fn finds_build_hashes_and_routes_only_where_the_loader_keeps_them() {
|
|
440
548
|
let literals = |source: &str| {
|
|
441
549
|
let mut literals = Literals::default();
|
|
442
|
-
let parsed =
|
|
443
|
-
parsed.script
|
|
550
|
+
let parsed = ParsedScript::parse("t", source).unwrap();
|
|
551
|
+
literals.visit_program(parsed.script().program);
|
|
444
552
|
literals
|
|
445
553
|
};
|
|
446
554
|
let hash = "e694063b5082";
|
|
@@ -12,7 +12,7 @@ use scraper::{ElementRef, Html, Node, Selector};
|
|
|
12
12
|
use serde::{Deserialize, Serialize};
|
|
13
13
|
use url::Url;
|
|
14
14
|
|
|
15
|
-
use crate::js::JsObject;
|
|
15
|
+
use crate::js::{JsObject, JsValue, json};
|
|
16
16
|
|
|
17
17
|
/// Implicit render collects containers with this class.
|
|
18
18
|
const CONTAINER_CLASS: &str = "cf-turnstile";
|
|
@@ -210,6 +210,46 @@ pub(crate) struct PageSignals {
|
|
|
210
210
|
pub inner_width: u32,
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
impl PageSignals {
|
|
214
|
+
/// The positional `wPr` format used by newer loaders. Keep absent optional properties as
|
|
215
|
+
/// null array entries, as JSON.stringify does for JavaScript's `undefined`.
|
|
216
|
+
pub(crate) fn positional(&self) -> JsValue {
|
|
217
|
+
let parent = &self.parent;
|
|
218
|
+
json!([
|
|
219
|
+
self.custom_element_tags,
|
|
220
|
+
self.root_attributes,
|
|
221
|
+
self.referrer,
|
|
222
|
+
parent.form,
|
|
223
|
+
parent.in_iframe,
|
|
224
|
+
parent.location,
|
|
225
|
+
parent.meta,
|
|
226
|
+
parent.pac,
|
|
227
|
+
parent.pad,
|
|
228
|
+
parent.fingerprint,
|
|
229
|
+
parent.scripts,
|
|
230
|
+
parent.same_realm,
|
|
231
|
+
parent.stylesheets,
|
|
232
|
+
parent.title,
|
|
233
|
+
parent.elements,
|
|
234
|
+
parent.appearance,
|
|
235
|
+
parent.error_handled,
|
|
236
|
+
parent.host,
|
|
237
|
+
parent.hidden_reason,
|
|
238
|
+
parent.implicit,
|
|
239
|
+
parent.mode,
|
|
240
|
+
parent.mount,
|
|
241
|
+
parent.reasons,
|
|
242
|
+
parent.user_hidden,
|
|
243
|
+
parent.viewport.height,
|
|
244
|
+
parent.viewport.visibility_state,
|
|
245
|
+
parent.viewport.width,
|
|
246
|
+
parent.widget_position,
|
|
247
|
+
parent.xpath,
|
|
248
|
+
self.inner_width,
|
|
249
|
+
])
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
213
253
|
/// `pi`: the widget's place in the page. The parent info probe copies these properties by
|
|
214
254
|
/// their `api.js` names.
|
|
215
255
|
#[derive(Clone, Debug, Serialize)]
|