Repository navigation
py-0.15.4 - 2026-12-02
Bug Fixes
-
Follow RFC 6265 domain and path rules in the custom cookie jar (#636)
- The custom cookie jar in the Python bindings stored every
Set-Cookieas it came in. It now follows the RFC 6265 domain rules: a cookie with aDomainis only stored when that domain matches the host that sent it, an emptyDomainis ignored, and a cookie withoutDomainis only sent back to the host that set it, not to its subdomains. ADomainmade only of dots is ignored too. Public suffixes (com,co.uk,github.io) are handled the way browsers do it, using both sections of the Public Suffix List through thepslcrate: such a cookie is dropped, unless it comes from the host of that exact name, where it is stored as host-only. Cookie paths were compared as a plain string prefix, so a cookie for/foowas also sent to/foobar. They now have to match up to a segment boundary.test_complex_cookiesusedDomain=.127.0.0.1against httpbin, which is no longer stored, so it uses the httpbin host now. A cookie with aDomainis stored with a leading dot, likehttp.cookiejardoes it. File cookie jars such asMozillaCookieJaronly keepdomain_specifiedfor those, so without the dot the cookie became host-only after a save and load.
- The custom cookie jar in the Python bindings stored every
-
Honor Max-Age and apply the Secure and prefix rules when storing cookies (#633)
- Brings the custom cookie jar of the Python bindings closer to RFC 6265 and its current draft update when storing cookies: -
Max-Agewas ignored, so such cookies never expired andMax-Age=0did not remove a cookie. It now takes precedence overExpires, and an already expired cookie removes the stored one, the same wayCookieJar.extract_cookiesdoes. - ASet-Cookieheader that fails to parse was stored as a<cookie-name>placeholder cookie. It is skipped now. - ASecurecookie is only stored from HTTPS or a loopback host, and a response from anywhere else can't replace an existing one. - The__Secure-and__Host-name prefixes are checked.
- Brings the custom cookie jar of the Python bindings closer to RFC 6265 and its current draft update when storing cookies: -
Features
- Add chrome155, chrome156 and chrome157 browser fingerprints (#616)
Security
-
Update dependency soupsieve to v4 [security] (#621)
- This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | soupsieve |
2.10→4.0||
| --- > [!WARNING] > Some dependencies could not be looked up. Check the warning logs for more information. --- ### Soup Sieve: Polynomial-time denial of service in the descendant combinator CVE-2026-126190 / GHSA-mmhr-3c5m-f64f
--- ### Release NotesMore information
#### Details ##### Summary Matching a selector that uses the descendant combinator (a b) takes time that grows polynomially with how deeply the document is nested, and each extra descendant combinator in the selector raises the degree by one. A selector withkdescendant combinators takesO(n^(k+1))time on a chain ofnnested elements. An attacker who controls the HTML or XML that an application passes to Soup Sieve (directly, or through Beautiful Soup'sselect(),select_one(),css.select(), etc.) can send a very small, deeply nested document that keeps a CPU busy for seconds to minutes against an ordinary selector such assection div div. ##### Details To matcha b, Soup Sieve checks each element againstband then walks up through its ancestors looking for one that matchesa. When the selector has more descendant combinators, the rest of the selector is tried again from each ancestor on that walk, and so on for every combinator. Nothing was reused between walks, so the same ancestors were matched against the same part of the selector over and over. The worst case is when the leftmost part of the selector never matches, as insection div divagainst a document of nested<div>with no<section>: every walk goes all the way to the root and no search can stop early. ##### Timings Example timings withhtml.parseron Soup Sieve 3.0.4 and 4.0, using a document of nested<div>(5 bytes each) and no matches: | Nesting depth | Input size | Selector | 3.0.4 | 4.0 | | --- | --- | --- | --- | --- | | 2,000 | 10 KB |section div| 1.6 s | 0.05 s | | 4,000 | 20 KB |section div| 5.1 s | 0.01 s | | 400 | 2 KB |section div div| 6.7 s | < 0.01 s | | 800 | 4 KB |section div div| 53.0 s | < 0.01 s | | 100 | 0.5 KB |section div div div| 2.5 s | < 0.01 s | | 200 | 1 KB |section div div div| 40.9 s | < 0.01 s | None of these selectors use unusual syntax. ##### Proof of conceptpy import time import bs4 import soupsieve as sv soup = bs4.BeautifulSoup('<div>' * 200, 'html.parser') t = time.process_time() sv.select('section div div div', soup) print(time.process_time() - t)On affected versions, doubling the nesting depth multiplies the time by about 2^(k+1), wherekis the number of descendant combinators: about 4x forsection div, 8x forsection div div, and 16x forsection div div div. ##### Impact Applications are affected if they run selectors with descendant combinators against documents that untrusted users can influence, such as scrapers, HTML sanitizers or filters, and services that process uploaded or fetched markup. Descendant combinators are among the most common parts of CSS selectors, and a document of about 1 KB is enough to tie up a worker for close to a minute. Applications that only run selectors against trusted documents are not affected. ##### Patches Fixed in 4.0 by facelessuser/soupsieve#351. Whether an element is, or has an ancestor that is, a match for part of a selector depends only on its parent, so Soup Sieve now caches that result per element and relation for every element visited on the walk. Each descendant combinator is then linear in the size of the document. Results are unchanged, and ordinary documents are no slower. Caching is enabled by default, so no changes are needed beyond upgrading. TheNOCACHEflag is a temporary fallback for users who run into problems with caching, and it is planned for removal. It uses the old uncached matching, so selectors compiled withNOCACHEare still subject to polynomial time and shouldn't be used with descendant combinators on untrusted input. ##### Workarounds If users can't upgrade: - Use as few descendant combinators as they can in selectors that run on untrusted documents. Where the structure of the document is known, the child combinator (a > b) only looks at the parent and is not affected. - Limit the size and nesting depth of untrusted documents before selecting on them. - Run selection on untrusted input with a time limit, for example in a worker process that can be stopped. #### Severity - CVSS Score: 7.5 / 10 (High) - Vector String:CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H#### References - https://github.com/facelessuser/soupsieve/security/advisories/GHSA-mmhr-3c5m-f64f - https://nvd.nist.gov/vuln/detail/CVE-2026-126190 - https://github.com/facelessuser/soupsieve/pull/351 - https://github.com/facelessuser/soupsieve/commit/ff1a5ce7e5addc31626d7b6053511fecdb4f6320 - https://github.com/facelessuser/soupsieve/releases/tag/4.0 - https://github.com/advisories/GHSA-mmhr-3c5m-f64f This data is provided by the GitHub Advisory Database (CC-BY 4.0).--- ### Configuration 📅 Schedule: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied. ♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 Ignore: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by Mend Renovate. View the repository job log. ---------facelessuser/soupsieve (soupsieve)
###v4.0Compare Source #### 4.0 - BREAK: The contents of an HTMLtemplateare no longer treated as part of the document. Selectors do not descend into atemplate, and elements inside one can't see beyond it, which also applies to pseudo-classes such as:lang(),:disabled, and:default.selectandfilterwill still reach the contents of atemplatewhen they are called on thetemplateitself, for examplesoup.template.select('p'). See the FAQ for more information. - BREAK: The contents of aniframeare no longer treated as a separate document, as they are not one in a browser. Elements in aniframeare normal children, so:rootdoes not match them, and:default,:indeterminate,:checked,:dir(),:lang(), and:read-writetreat them like any other element. Recent versions ofhtml.parser,lxml, andhtml5liball escape the contents of aniframelike a browser does, so this mostly affects XHTML, Python versions that still don't escape such content in their specifichtml.parser, and elements added to aniframeby hand.:-soup-contains()now also includes the escaped text in aniframe. See the FAQ for more information. - NEW: Update:disabledand:enabledto treatoptionandoptgroupelements inside a disabledselectas disabled, following a recent HTML specification update. - FIX: Fix the subsequent-sibling combinator and:has(~ ...)never matching top level elements of a fragment that has no root element, unless caching was disabled. - FIX::indeterminatenow treats a radio button group without a form as extending across the whole document instead of the top level element that contains it, and it no longer ignores radio buttons at the top level. - FIX: Fix:defaultto treat abuttonwith a missing or invalidtype, and aninputwithtype="image", as submit buttons. - FIX: Fix:in-rangeand:out-of-rangeraisingTypeErrorwhen the document contains aninputwithout atypeattribute. - FIX::read-write(and:read-only) now treatcontenteditable="plaintext-only"elements as editing hosts and match the editable elements inside an editing host, following the nearestcontenteditablestate. - FIX::read-write(and:read-only) now ignorecontenteditableon non-HTML elements, such as an SVGforeignObject, as the attribute only applies to HTML elements. Such elements inherit the state of their parent. - FIX::checkednow only matches the last radio button with acheckedattribute in a radio button group, as in a browser, where a group is the radio buttons with the samenameand form, including theformattribute.:defaultstill matches all of them, and the contents of atemplateare unaffected as they are not connected. - FIX::dir()and:definedno longer affect the rest of the selector list they are in. Previously, a selector list that used either of them could not have its combinators cross aniframe, ignored the specified namespaces, and matched nothing in XML, not even the parts that didn't use them. They still do not match in XML, but:not(:dir(ltr))and:not(:defined)now do. - FIX::defaultand:indeterminatenow honor theformattribute, which can associate a submit button or radio button with a form it is not in, or leave it without a form. It is ignored in atemplate, as in the HTML specification. Submit buttons outside of a form can now be its default button. - FIX::default,:checked, and:indeterminatenow handle a form inside a form like a browser. In HTML, a browser ignores the nested form and takes its end tag for that of the parent, which matters for parsers that keep the nested form, such ashtml.parser. In XHTML and in atemplate, nested forms are real forms. - FIX::checkednow matches theoptionthat a browser would select. Withoutmultiple, that is only the lastoptionwith aselectedattribute in aselect, and if there are none and theselectshows a single option, the firstoptionthat is not disabled.:defaultstill only considers theselectedattribute. - FIX: Fix[attribute!=value]excluding values that only start with the specified value, and in XML documents,typevalues that contain a newline. - FIX: Match the values of every attribute that the HTML specification lists as ASCII case insensitive (rel,method,lang,dir, ...) without ASCII case sensitivity on HTML elements in HTML documents, not justtype. Non-HTML elements are matched case sensitively. - FIX::dir()now matches non-HTML elements, such as SVG and MathML, by the direction they inherit from their parent (thedirattribute only applies to HTML elements), and HTML elements inside them, such as in an SVGforeignObject, by the direction of their ancestors. - FIX: Fix:dir()ignoring the value of aninputwithdir="auto"and a missing or emptytype. - FIX::dir()now uses a table generated from Unicode 18 instead ofunicodedata, so results no longer depend on the Unicode version of the Python in use, and unassigned code points use their default direction. - FIX::dir()now uses the value of aninputwithdir="auto"whentypeishidden,password,submit,reset, orbutton, as the HTML specification does. - FIX:dir="auto"andbdinow analyze the text of non-HTML elements, such as SVG and MathML, and only ignore HTML elements such asscript,style, andbdi. The text directly in aniframeis analyzed as well, and the contents of atemplate, which are not part of the document, are not. - FIX::dir()no longer lets the contents of atemplateinherit direction from thetemplateor its ancestors, as they are not part of the document. They are left to right unless they specify otherwise. - FIX::dir()now matches abdielement that is the root by its text instead of assuming left to right. - FIX::dir()now treats any element without a parent element as left to right, not just the root. Before, all but the first top level element of a fragment parsed withhtml.parsernever matched. - FIX::dir()now accepts any identifier, as CSS requires, including escaped ones. Values other thanltrandrtldo not match anything. - FIX: Respect namespaces provided by the parser when the root is not an HTML element, such as ansvgelement extracted from anhtml5libdocument. Previously every element in such a tree was treated as an HTML element, which affected namespace selectors, namespaced attributes, and HTML specific pseudo-classes. - FIX: Fix:lang()treating an element with an emptylangorxml:langattribute as having the language of a tagged ancestor. - FIX: Cache forms without a default button when matching:defaultto avoid quadratic time on forms with many non-default submit candidates. - FIX: Fix:in-rangeand:out-of-rangematching elements whose value,min, ormaxhas a trailing newline; per HTML, such values are not valid, so they are treated like a missing value and cannot be out of range. - FIX: Fix:in-rangeand:out-of-rangeraisingValueErrorwhen a date, month, week, or local date and timeinputhas a year with more digits than Python will convert; such a year is now treated as invalid. - FIX: Fix:in-rangeand:out-of-rangenot recognizing adatetime-localvalue,min, ormaxthat uses a single space instead ofTto separate the date and time. - FIX: Search a form only once for checked radio buttons when matching:indeterminateto avoid quadratic time on forms with many radio button groups. - FIX::lang()now uses thelangattribute of SVG elements, as the HTML specification does (withxml:langtaking precedence). Previously onlyxml:langwas considered for elements outside the HTML namespace. - FIX::definedno longer matches HTML elements with anisattribute (customized built-in elements), which, like custom elements, are undefined until they are registered. - FIX: Cache the index of each child when matching the general sibling combinator (a ~ band:has(~ b)) to avoid quadratic time when the first matching sibling is far into a long list of siblings. - FIX: Match attribute values with theimodifier using ASCII case insensitivity. - FIX: Treat aninputwith an unknowntype, such astype="foo", as a text input in:placeholder-shown,:read-write,:read-onlyand:dir(), as an invalidtypeis in the Text state in the HTML specification. - FIX: Fix:enabledand:disablednever matchinginputelements withtype="hidden". - FIX::requiredno longer matchesinputelements of types therequiredattribute does not apply to (hidden,range,color,submit,image,resetandbutton). Like in browsers, they match:optional. - FIX: Cache whether an element is or has a matching ancestor when matching the descendant combinator (a b) to avoid time that grows with the depth of the document to the power of the number of combinators. ###v3.0.4Compare Source #### 3.0.4 - FIX: Keep own and descendant text separate when combining:-soup-contains()and:-soup-contains-own(). - FIX: Cache resolved directionality when matching:dir()to avoid quadratic time on deeply nesteddir="auto"elements. - FIX: Fixautohandling in regard to:dir()selector. When an element withdir="auto"(or a<bdi>) contains no strong direction characters, it should be assumed as left-to-right and not assume the direction of the parent. - FIX: Match numeric input ranges correctly when values or bounds use scientific notation. - FIX: Fix:in-rangeand:out-of-rangeraisingValueErrorforweekinputs whose week-year is 10000 or greater. - FIX: Fix:nth-last-child(an+b of S)matching the wrong elements when the first sibling tested does not matchS. - FIX:escape()now only leaves non-ASCII identifier code points unescaped, as defined by the CSS specification. All other non-ASCII characters are escaped. - FIX: Allow unescaped U+0080 - U+009F characters in identifiers to match browser behavior. - FIX: Fix:in-rangeand:out-of-rangetreatingtimeanddatetime-localvalues with seconds as invalid. ###v3.0.3Compare Source #### 3.0.3 - FIX: When matching with>, theBeautifulSoupobject should not count as a parent. - FIX: Fix case where relative sibling matching under:has(~)would incorrectly match a sibling that came before the target element. ###v3.0.2Compare Source #### 3.0.2 - FIX: Python versions less than 3.11.5 have broken possessive quantifiers, so require at least 3.11.5 for Soup Sieve 3.0+. 3.0 and 3.0.1 will be yanked from PyPI to avoid having the 3.0 series installed on Python < 3.11.5 which will cause the library to be broken. ###v3.0.1Compare Source #### 3.0.1 - FIX: Fix regression related to[attribute!=value]where previously it would match if the attribute was not present and recent changes broke that. Essentially,[attribute!=value]should be the same as:not([attribute=value]). ###v3.0Compare Source #### 3.0 - BREAK::has(), by default, now behaves according to CSS more strictly, disallowing complex selectors that use combinators and prevents nesting:has()within:has(). This gives a safer, more performant default for Soup Sieve. If in a safe environment, these restrictions can be lifted by passing the newNOSTRICTflag restoring behavior to before 3.0. - BREAK: Custom selectors must be provided in order. If one custom selector depends on another custom selector, the custom selector dependency must be defined first in the dictionary. This eliminates recursive processing of custom selectors. Users are encouraged to pre-compile custom selectors viamy_selectors = soupsive.CustomSelectors({custm: selector, ...}). - NEW: Drop Python 3.10. - NEW: Aggressively use possessive quantifiers and atomic groups in CSS pattern parsing to reduce backtracking. - NEW: Eliminate recursion within the parser and the matcher. - NEW: Expose new parametermax_selectorsthat can be used to control the maximum allowed selectors in a given input. - FIX: A CSS escape that is a surrogate, or past the Unicode range, isU+FFFD. (#307)
- This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | soupsieve |
-
Dependency sweep (#624)
-
Summary Dependency sweep — in-range freshening (no security floor reached a clean in-range fix this run; see flags below): -
tough-cookie6.0.2 → 6.1.0 (impit-node) -es-toolkit1.53.1 → 1.53.2 (impit-node, transitive) -coverage,mypy,mypy-extensions,pytest,pytest-asyncio,ruff— dev/docs-group bumps (impit-python) ## ✅ Dismissed (don't apply to our usage) -soupsieve(high) — not_used: transitive viafuro'sdocsdependency group. Every test job runsuv sync --no-group docs, so this group is never installed there; the one job that does install it (docs.yaml→ Sphinx build) usesactions/setup-pythonwithpython-version: 3.x, which resolves to the newest CPython (≥3.11.5) — so it always gets the already-patchedsoupsieve4.0.1, never the locked2.10copy. (alert #140) -soupsieve(medium) — same rationale as above. (alert #139) -soupsieve(high) — same rationale as above. (alert #138) ## 🚩 Flagged — needs review -minimatch10.2.6 → 11.0.1 (medium) — CAPPED bytypedoc@0.28.20(its latest published release), which still declaresminimatch: ^10.2.5. No newertypedocexists yet with aminimatch@11dependency, and forcing an override would cross a majortypedocitself hasn't adopted. Dev-only (typedoc/typedoc-plugin-mdn-linksdoc generation), but the docs workflow runs on every PR (including forks) with no path filter, so a malicious PR touching typedoc's include/exclude globs is a plausible (if narrow) reach. No tracking PR found. (alert #137) -rustls< 0.23.46 (low) — not actually reached by the automated floor check:Cargo.lockpinsrustlsto agitsource (github.com/apify/rustls, rev2b5779e2…), not a crates.io version, so the registry-based floor comparison silently reportedlocked=(not,in,lockfile). Manually confirmed the pinned rev is apify's fork ofrustlsv0.23.45 (git logon the fork shows noPrepare 0.23.46commit and doesn't contain upstream's fix commits8fa0dc5d…/f04804fa…), so the vulnerable code is still present. Both advisories are client-reachable here:impit/Cargo.tomlbuildsrustlswith a customimpitfeature (features=["impit"]→aws_lc_rs, ring, brotli, zlib), i.e. Brotli certificate decompression is compiled in and impit is an HTTP client that talks to arbitrary/untrusted servers. Fixing this needs a new commit in theapify/rustlsfork that merges upstreamv0.23.46+ on top ofimpit-main, then bumping therev=in this repo'sCargo.toml/Cargo.lock— out of scope for this repo-only sweep. (alert #135) -rustls< 0.23.46 (low) — same root cause and same fix as above (Brotli cert-decompression memory-exhaustion advisory). (alert #133) 🤖 Generated with Claude Code
-
-
Lower the dependency cooldown back to 1 day (#626)
- Puts the dependency cooldown back to 1 day, for both pnpm and Renovate. With 7 days here and 1 day in the repos that publish our shared packages, a fresh
@apify/*release can require a dependency version this repo isn't allowed to install yet. That's what broke the docs deploy in apify-cli: the theme asked foralgoliasearch@^5.64.0when no version in that range was a week old. A week also eats most of the time we have to ship security bumps.
- Puts the dependency cooldown back to 1 day, for both pnpm and Renovate. With 7 days here and 1 day in the repos that publish our shared packages, a fresh