[Security] Remove mandatory ai-cloudscraper dependency - #193
Draft
SakenW wants to merge 1 commit into
Draft
Conversation
Restore the standard cloudscraper package for synchronous translation and move aiohttp behind an async extra. Lazy-load async APIs, replace Reverso's ai-cloudscraper session with the existing aiohttp/httpx clients, and guard session/client compatibility. Add regression coverage for import isolation, proxy handling, and cached client switches.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cloudscraper>=1.2.71dependency used by synchronous translationai-cloudscraper -> js2pydependency chainaiohttpbehind a newtranslators[async]extra and lazy-load async APIscreate_async_scraper()Why
translators==6.0.4currently requiresai-cloudscraper>=3.7.6, which requiresjs2py>=0.74. Js2Py 0.74 is affected by CVE-2024-28397 / GHSA-h95x-26f3-88hr.This change removes that vulnerable transitive dependency from both the normal and async installation graphs. It does not claim that a remotely exploitable path was proven in
translators; it removes a publicly documented vulnerable package that is currently mandatory for every 6.0.4 installation.Fixes #192.
Compatibility
translatorsnormallytranslators[async]translate_text_with_async,translate_html_with_async,preaccelerate_and_speedtest_with_async, andclose_with_asyncremain available as coroutine functionsThe package version remains unchanged in this source PR. A merged release should be published as a new version such as 6.0.5; the existing PyPI 6.0.4 artifact must not be overwritten.
Validation
twine checkpassed for bothcloudscraper, do not containai-cloudscraper, Js2Py, or aiohttp, and expose aiohttp only throughextra == "async"pip checkpassed, andpip-auditreported no known vulnerabilitieshello->bonjour)git diff --checkpassedThe repository still emits its pre-existing invalid-regex-escape
SyntaxWarning; this patch does not introduce or modify that warning.