Repository navigation
fix(scraper): prevent SSRF and local file disclosure (CWE-918, CWE-22) and ensure Playwright browser cleanup (CWE-404) - #755
Closed
thinhnx128 wants to merge 1 commit into
Conversation
…) and close Playwright browsers in finally (CWE-404)
Author
|
I have read the Arakoo CLA Document and I hereby sign the CLA |
Author
|
Closing this to reduce review load — it wasn't requested by the maintainers. Thanks for your time; happy to reopen if it's useful. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Hardens the
@arakoodev/edgechainsscraper module (Cheerio,AutoPlayWriteWebPageScrapper,Playwright, andgoToLink) against Server-Side Request Forgery (CWE-918), local protocol disclosure (CWE-22), and orphaned Chromium browser processes (CWE-404):src/utils/url-validator.ts):assertSafeScraperUrl(url, options)andisBlockedScraperHost(hostname).http:andhttps:protocols (blockingfile://,javascript:,data:,ftp:).127.0.0.0/8,::1,localhost), RFC1918 private networks (10.0.0.0/8,172.16.0.0/12,192.168.0.0/16), carrier-grade NAT (100.64.0.0/10), IPv6 link-local/unique-local (fe80::/10,fc00::/7, IPv4-mapped::ffff:), and cloud metadata endpoints (169.254.169.254,100.100.100.200,metadata.google.internal) by default.{ allowPrivateNetworks: true }for trusted local testing environments.CWE-404):chromium.launch()inAutoPlayWriteWebPageScrapper.getContent()andPlaywright.call().try { ... } finally { await browser.close(); }so headless Chromium instances are never leaked on navigation timeouts or DOM errors.src/tests/cheerio.test.ts):file:///etc/passwd,http://169.254.169.254/latest/meta-data/, andhttp://127.0.0.1:8080are deterministically blocked.