docs: Add guide secure-scraping#1908
Open
Mantisus wants to merge 2 commits into
Open
Conversation
vdusek
reviewed
May 27, 2026
| Because the target decides what your crawler receives, a malicious or compromised site can try to: | ||
|
|
||
| - **Steer your crawler to URLs you never intended to visit** - other hosts, or internal services that are not reachable from the public internet. | ||
| - **Reach non-HTTP destinations** through schemes like `file://`, `gopher://`, `ftp://`, or `dict://`, to read local files or talk to services such as Redis. |
Collaborator
There was a problem hiding this comment.
it seems weird to me to specify just Redis and nothing else without any further context 🙂
|
|
||
| - **Steer your crawler to URLs you never intended to visit** - other hosts, or internal services that are not reachable from the public internet. | ||
| - **Reach non-HTTP destinations** through schemes like `file://`, `gopher://`, `ftp://`, or `dict://`, to read local files or talk to services such as Redis. | ||
| - **Exhaust your resources** with a crawler trap, an oversized response, or a decompression bomb. |
Collaborator
There was a problem hiding this comment.
we should either explain the individual "traps" or provide external links
|
|
||
| :::info | ||
|
|
||
| Crawlee for Python had this SSRF gap in its sitemap and `robots.txt` handling before version 1.7.0, fixed in [#1862](https://github.com/apify/crawlee-python/pull/1862) and [#1864](https://github.com/apify/crawlee-python/pull/1864). See the advisory [GHSA-3r75-xc34-5f44](https://github.com/apify/crawlee-python/security/advisories/GHSA-3r75-xc34-5f44). |
Collaborator
There was a problem hiding this comment.
Not sure we wanna mention this - @B4nan, could you tell us your opinion please?
|
|
||
| When following links from a page, <ApiLink to="class/EnqueueLinksFunction">`enqueue_links`</ApiLink> keeps only those on the same hostname by default and filters out links to any other host. Crawlee also re-checks the host a request finally lands on, so a redirect that ends on a different host is rejected. The client still walks the whole chain to get there, though, so an intermediate hop to an internal address is fetched along the way. Note that `same-hostname` does **not** include subdomains - `example.com` will not match `api.example.com`. | ||
|
|
||
| ```python |
Collaborator
There was a problem hiding this comment.
I know it is a small code example, but for maintainability, could you please implement it as a dedicated Python script, as we do for others? (applies to all examples)
|
|
||
| Isolation also changes the calculus for the application-level controls: inside a dedicated, egress-restricted environment the blast radius of an SSRF is contained, so widening the scope with `strategy='all'` or accepting arbitrary URLs is far less risky than it would be on a shared host. | ||
|
|
||
| ## Running on the Apify platform |
Collaborator
There was a problem hiding this comment.
maybe this could be a subsection of isolation? 🙂
| @@ -0,0 +1,123 @@ | |||
| --- | |||
| id: secure-scraping | |||
| title: Secure scraping | |||
Collaborator
There was a problem hiding this comment.
maybe "Security of web scraping" would be better?
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.
Description
Issues