Skip to content

v1.3.1

Latest

Choose a tag to compare

@binary-person binary-person released this 27 Oct 23:28

cloudflare

  • fix GET forms (google search and other search boxes) with a deployment secret: the cache tag ended up in the middle of the url
  • fix the cache tag showing in a page's own address after a redirect (google.com → /?gws_rd=ssl!v…), which sites then got back
  • free users pass cloudflare challenges without the "verify you are human" checkbox (with the anti-bot fixes below)
  • with a solver, let cloudflare's own widget try first and only pay when it fails, asks for the checkbox, or hangs
  • remember a failed free try per session and site for freeRetryAfter (default 30 minutes) and go straight to the solver
  • show a message while the solver works, and add rhHookCloudflareFreeFailed for pages to react to a failed free try
  • fix zstd responses skipping rewriting (chrome offers zstd, cloudflare uses it)
  • fix cloudflare turnstile: postMessage(msg, { transfer }) dropping ports, "Cannot redefine property: __call$", and the challenge page reloading itself every 6 seconds without a solver
  • move the 2captcha cloudflare solver to 2captcha's json api (solves in ~5s instead of ~13s)
  • fix solved cloudflare cookies never being cached (every visit paid for a new solve)
  • fix other users hanging on a cloudflare page for up to a minute after it was solved or checked
  • fix the first 2captcha token always being rejected (switch to the solver's user-agent before solving, one paid solve instead of two)
  • fix workers not using a cloudflare clearance solved by another worker or before a restart
  • switch to the solver's user-agent per session and site, not for everyone on that site (others' free tries kept failing)
  • fix paying for cloudflare solves forever when a site keeps rejecting tokens: after maxFailedSolves (3) failed solves in failedSolveWindow (30 minutes), pages get cloudflare's own widget back
  • add takeStats() to cloudflare solvers: free tries, free fails, cache hits, paid solves and failed solves
  • fix cloudflare solver api calls (with the session id) being forwarded to sites when no solver is attached
  • add apiUrl to RammerheadCloudflare2Captcha, and cloudflare solver tests against a fake cloudflare and 2captcha
  • fix cloudflare challenges without a solver: turnstile.render was replaced and returned a promise

anti-bot (what cloudflare's checks caught, applies to every site)

  • fix google recaptcha (sites' captchas through the proxy pass again)
  • fix preload links showing the proxy url to the page: getAttribute('href') after rel/as changes (google search)
  • fix about:blank frames syncing localStorage through the proxy when the page handles it itself (rammerheadDisableLocalStorageImplementation)
  • fix random failed requests (502 in front of the proxy) when a site closes an idle keep-alive connection as it's reused: GET/HEAD/OPTIONS are sent again (youtube)
  • service workers are off: register() rejects like a browser without them, and existing ones are removed (they sat at the proxy's root, one site's worker in front of every page; youtube's loaded from the root and sent requests there)
  • fix workers under a trusted types csp running without the engine (their requests went out unproxied)
  • hide hammerhead's overridden functions and getters from anti-bot checks (length, prototype, source code)
  • hide proxy urls and rammerhead's own requests from performance.getEntries()
  • hide hammerhead's globals and element properties from Object.keys/getOwnPropertyNames
  • hide hammerhead's frames from stack traces, and show sites' own urls and line:column
  • report sites' own script sizes in resource timing
  • remove hammerhead's injected <script>/<meta> tags once they've run
  • pass content security policies through, rewritten for the proxy (eval, inline scripts, data: scripts and trusted types were all allowed)
  • report sites' own policies and urls in csp violation events
  • keep running scripts a page adds that its policy allows by hash (spotify), and trusted script text set through textContent/innerText (youtube)
  • apply sites' referrer policies (the full url leaked cross-site)
  • pass cross-origin-embedder-policy through (pages can be cross-origin isolated)
  • fix messages sent with the native postMessage being dropped or getting origin undefined
  • fix frameElement being visible to cross-site iframes (it's null in browsers), and hammerhead tripping getters pages put on it
  • show sites' original source from toString() of functions the rewriting changed
  • stop adding allow-scripts to sandboxed iframes (sites' script-less frames ran scripts)
  • fix script-less sandboxed iframes (youtube): html written into them threw, listeners the page added there never fired, and chrome logged "Blocked script execution" up to 100 times a second
  • keep :hover in stylesheets (hammerhead swapped it for an attribute)
  • give blob: urls the site's origin
  • proxy srcset set as a property, constructed stylesheets (replace/replaceSync) and css in blob:s
  • show sites' own urls in css rules' cssText
  • hide hammerhead's keys from Object.keys and similar when its names are renamed at build time
  • keep hammerhead's ui root out of the dom (pages saw an extra <div>, and query results became arrays)
  • stop overriding query methods on <body>/<head> (they bypassed page hooks on Element.prototype)
  • keep full stack depth under Error.stackTraceLimit, and map inline scripts' line:column
  • report pages' own sizes in navigation timing
  • make hammerhead's wrappers real functions instead of Proxies (prototype cycles and stack frames gave them away)
  • fix pushState/replaceState accepting cross-origin urls, and move them to History.prototype
  • fix stack positions of rewritten obj[key](...) calls
  • run pages' own frameElement getters
  • share hammerhead's native-function registry across frames (a frame's toString showed another frame's wrappers)
  • fix <style> innerText adding <br>s, and getElementsByTagName returning a wrapper object
  • send sites the right sec-fetch-site (it was always same-origin)
  • stop adding an origin header to navigations and plain script/image loads
  • run rammerhead.js in about:blank iframes too (its fixes were missing there, and anti-bot scripts take natives from them)
  • hide cross-origin resource sizes and timings without timing-allow-origin, and report rewritten resources' own sizes
  • keep long animation frame entries (hide hammerhead's scripts in them instead)
  • fix document.domain for other frames' documents and about:blank
  • deny the permissions browsers deny to cross-origin iframes (camera, geolocation, built-in ai, ...) unless delegated with allow, also in document.featurePolicy
  • report webgl powerPreference as low-power in cross-origin iframes, like chrome
  • move registerProtocolHandler and service worker overrides to their prototypes

other

  • fix sites that refuse framed visits (instagram, facebook) showing an error page when an embedder frames the proxy: top-level pages are fetched with sec-fetch-dest: document
  • fix sites routing with the navigation api (instagram) seeing the proxy's url
  • fix selectors on url attributes (*=, $=, ~=, |=, and matches/closest) missing elements, which broke onetrust cookie banners on many sites
  • fix scripts added from about:blank frames (cloudflare's bot check) being requested on port 80
  • cache big bundles with imports once, filling in each session's urls, instead of rewriting them on every visit
  • fix scripts that name a class field, label, catch parameter or destructured variable parent, top or frameElement failing to parse (brave search)
  • expose rhTrusted on the hammerhead object, for embedders adding their own scripts under sites' trusted types policies
  • renumber from v1.2.70 (was mislabeled v1.2.7, which sorts below v1.2.64)
  • fix discord.com (workers crashing on shuffled urls)
  • fix discord.com/login (a?.b[key] evaluating key after short-circuiting)
  • fix memory leak: websocket connections to sites never closing (tiktok, spotify, twitch)
  • fix memory leak: requests on dropped http2 connections never finishing
  • fix requests hanging under load (one http2 connection per site shared by every user, mostly tiktok)
  • fix scripts set via script.textContent/innerText not being rewritten (newer chrome shadows hammerhead's override)
  • fix module workers (importScripts isn't allowed in modules)
  • fix ssl option never listening on a port
  • fix t?.a[k].b throwing after short-circuiting
  • fix iframes inside a framed page seeing frameElement as null
  • fix hammerhead's connection reset guard crashing on its first unexpected error
  • fix crash on cookie segments without key= (e.g. a=1; flag)
  • fix crash on hosts http2 can't parse (e.g. a|b.example.com)
  • fix crash on header values with control or non-latin characters
  • fix crash on huge response bodies from hammerhead's debug logger
  • fix the js cache taking down every worker when a worker cached an empty script
  • fix "The session has been destroyed" errors under load
  • fix RammerheadJSMemCache never returning cached scripts
  • fix old cached rewrites surviving updates
  • fix RammerheadProxy.close() throwing without a session store
  • cache rewritten and recompressed scripts
  • cache public suffix lookups for cookies (~14% cpu)
  • skip debug logging every response body (~5% cpu)
  • answer 504 and log requests stuck longer than stuckRequestTimeout (default 3 minutes)
  • log stack, origin, and request for crashes
  • add npm test (fixture pages through the proxy in headless chromium)
  • add test/perf load profiling and RH_PERF_STATS=1 cache stats
  • add RH_CONFIG to load a different config override file
  • tested on node 18 to 26