diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 01:29:57 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 01:29:57 +0100 |
| commit | 4b2b4af606237def78273a42e881ae9f971cb505 (patch) | |
| tree | 47735062971b7dcddfbe3ad385ccbf2570fa6245 /src/tasks | |
| parent | docker: install ImageMagick for image compress/convert (diff) | |
| download | senator-sperma-4b2b4af606237def78273a42e881ae9f971cb505.tar.gz senator-sperma-4b2b4af606237def78273a42e881ae9f971cb505.zip | |
net: block private and link-local URLs
Diffstat (limited to 'src/tasks')
| -rw-r--r-- | src/tasks/mod.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tasks/mod.rs b/src/tasks/mod.rs index 362db80..c895a1b 100644 --- a/src/tasks/mod.rs +++ b/src/tasks/mod.rs | |||
| @@ -122,6 +122,12 @@ async fn execute_audio_job(ctx: &CronContext, job: &crate::database::CronJob) { | |||
| 122 | // job may point at an arbitrary third-party URL and must never receive | 122 | // job may point at an arbitrary third-party URL and must never receive |
| 123 | // the password. | 123 | // the password. |
| 124 | let url = ctx.copyparty.build_url_for(audio_url); | 124 | let url = ctx.copyparty.build_url_for(audio_url); |
| 125 | if !ctx.copyparty.is_own_url(&url) | ||
| 126 | && let Err(e) = crate::net::ensure_public_http_url(&url).await | ||
| 127 | { | ||
| 128 | error!("Cron audio job {} refused URL: {e}", job.id); | ||
| 129 | return; | ||
| 130 | } | ||
| 125 | info!( | 131 | info!( |
| 126 | "Cron audio job {} playing: {}", | 132 | "Cron audio job {} playing: {}", |
| 127 | job.id, | 133 | job.id, |
