mirror of
https://github.com/0xMassi/webclaw.git
synced 2026-06-06 22:05:13 +02:00
fix(security): harden local fetch surfaces
This commit is contained in:
parent
af96628dc9
commit
a611ae26f3
5 changed files with 94 additions and 15 deletions
|
|
@ -849,11 +849,18 @@ async fn enrich_html_with_stylesheets(html: &str, base_url: &str) -> String {
|
|||
|
||||
let client = reqwest::Client::builder()
|
||||
.timeout(std::time::Duration::from_secs(5))
|
||||
.redirect(reqwest::redirect::Policy::none())
|
||||
.build()
|
||||
.unwrap_or_default();
|
||||
|
||||
let mut extra_css = String::new();
|
||||
for href in &hrefs {
|
||||
if webclaw_fetch::url_security::validate_public_http_url(href)
|
||||
.await
|
||||
.is_err()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if let Ok(resp) = client.get(href).send().await
|
||||
&& resp.status().is_success()
|
||||
&& let Ok(body) = resp.text().await
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue