bb-plane-fork/apps/api/plane/bgtasks
sriram veeraghanta 63fac3b8c4
fix: validate redirects in favicon fetching to prevent SSRF (#8858)
* fix: validate redirects in favicon fetching to prevent SSRF

The previous SSRF fix (GHSA-jcc6-f9v6-f7jw) only validated redirects for
the main page URL but not for the favicon fetch path. An attacker could
craft an HTML page with a favicon link that redirects to a private IP,
bypassing the IP validation and leaking internal network data as base64.

Extract a reusable `safe_get()` function that validates every redirect hop
against private/internal IPs and use it for both page and favicon fetches.

Resolves: GHSA-9fr2-pprw-pp9j

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: address PR review feedback for SSRF favicon fix

- Fix off-by-one in redirect limit: only raise RuntimeError when the
  response is still a redirect after MAX_REDIRECTS hops, not when the
  final response is a successful 200
- Return final URL from safe_get() so favicon href resolution uses the
  correct origin after redirects instead of the original URL
- Add unit tests for validate_url_ip and safe_get covering private IP
  blocking, redirect-following, and redirect limit enforcement

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 16:04:43 +05:30
..
__init__.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
analytic_plot_export.py [WEB-5917] fix: generate clean plain text from HTML email template #8535 2026-02-17 00:44:52 +05:30
apps.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
cleanup_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
copy_s3_object.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
deletion_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
dummy_data_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
email_notification_task.py [WEB-5917] fix: generate clean plain text from HTML email template #8535 2026-02-17 00:44:52 +05:30
event_tracking_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
export_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
exporter_expired_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
file_asset_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
forgot_password_task.py [WEB-5917] fix: generate clean plain text from HTML email template #8535 2026-02-17 00:44:52 +05:30
issue_activities_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
issue_automation_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
issue_description_version_sync.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
issue_description_version_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
issue_version_sync.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
logger_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
magic_link_code_task.py [WEB-5917] fix: generate clean plain text from HTML email template #8535 2026-02-17 00:44:52 +05:30
notification_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
page_transaction_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
page_version_task.py [WIKI-852] chore: update page version save logic (#8440) 2026-03-03 19:10:42 +05:30
project_add_user_email_task.py [WEB-5917] fix: generate clean plain text from HTML email template #8535 2026-02-17 00:44:52 +05:30
project_invitation_task.py [WEB-6420] chore: self-host social icons in project invitation email (#8718) 2026-03-05 18:17:42 +05:30
recent_visited_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
storage_metadata_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30
user_activation_email_task.py [WEB-5917] fix: generate clean plain text from HTML email template #8535 2026-02-17 00:44:52 +05:30
user_deactivation_email_task.py [WEB-5917] fix: generate clean plain text from HTML email template #8535 2026-02-17 00:44:52 +05:30
user_email_update_task.py [WEB-5917] fix: generate clean plain text from HTML email template #8535 2026-02-17 00:44:52 +05:30
webhook_task.py [WEB-5917] fix: generate clean plain text from HTML email template #8535 2026-02-17 00:44:52 +05:30
work_item_link_task.py fix: validate redirects in favicon fetching to prevent SSRF (#8858) 2026-04-06 16:04:43 +05:30
workspace_invitation_task.py [WEB-5917] fix: generate clean plain text from HTML email template #8535 2026-02-17 00:44:52 +05:30
workspace_seed_task.py chore: add copyright (#8584) 2026-01-27 13:54:22 +05:30