Stirling-PDF/app/core/src/main/resources
Anthony Stirling 7d6b70871b
url fixes for access issues (#4013)
# Description of Changes


This pull request introduces a new SSRF (Server-Side Request Forgery)
protection mechanism for URL handling in the application. Key changes
include adding a dedicated `SsrfProtectionService`, integrating
SSRF-safe policies into HTML sanitization, and extending application
settings to support configurable URL security options.

### SSRF Protection Implementation:
* **`SsrfProtectionService`**: Added a new service to handle SSRF
protection with configurable levels (`OFF`, `MEDIUM`, `MAX`) and checks
for private networks, localhost, link-local addresses, and cloud
metadata endpoints
(`app/common/src/main/java/stirling/software/common/service/SsrfProtectionService.java`).

### Application Configuration Enhancements:
* **`ApplicationProperties`**: Introduced a new `Html` configuration
class with nested `UrlSecurity` settings, allowing fine-grained control
over URL security, including allowed/blocked domains and internal TLDs
(`app/common/src/main/java/stirling/software/common/model/ApplicationProperties.java`).
[[1]](diffhunk://#diff-1c357db0a3e88cf5bedd4a5852415fadad83b8b3b9eb56e67059d8b9d8b10702R293)
[[2]](diffhunk://#diff-1c357db0a3e88cf5bedd4a5852415fadad83b8b3b9eb56e67059d8b9d8b10702R346-R364)
* **`settings.yml.template`**: Updated the configuration template to
include the new `html.urlSecurity` settings, enabling users to customize
SSRF protection behavior
(`app/core/src/main/resources/settings.yml.template`).

### HTML Sanitization Updates:
* **`CustomHtmlSanitizer`**: Integrated SSRF-safe URL validation into
the HTML sanitizer by using the `SsrfProtectionService`. Added a custom
policy for validating `img` tags' `src` attributes
(`app/common/src/main/java/stirling/software/common/util/CustomHtmlSanitizer.java`).

---

## Checklist

### General

- [ ] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [ ] I have performed a self-review of my own code
- [ ] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing)
for more details.

---------

Co-authored-by: a <a>
Co-authored-by: pixeebot[bot] <104101892+pixeebot[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-24 13:53:21 +01:00
..
icc refactor: move modules under app/ directory and update file paths (#3938) 2025-07-14 20:53:11 +01:00
static Fix search scroll bar issue on navbar (#3998) 2025-07-21 13:06:21 +01:00
templates Fix search scroll bar issue on navbar (#3998) 2025-07-21 13:06:21 +01:00
application.properties refactor: move modules under app/ directory and update file paths (#3938) 2025-07-14 20:53:11 +01:00
banner.txt refactor: move modules under app/ directory and update file paths (#3938) 2025-07-14 20:53:11 +01:00
certdata.txt refactor: move modules under app/ directory and update file paths (#3938) 2025-07-14 20:53:11 +01:00
logback.xml Fix for #3951 invalid auth.log (#3952) 2025-07-15 14:01:11 +01:00
messages_ar_AR.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_az_AZ.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_bg_BG.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_bo_CN.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_ca_CA.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_cs_CZ.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_da_DK.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_de_DE.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_el_GR.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_en_GB.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_en_US.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_es_ES.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_eu_ES.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_fa_IR.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_fr_FR.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_ga_IE.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_hi_IN.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_hr_HR.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_hu_HU.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_id_ID.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_it_IT.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_ja_JP.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_ko_KR.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_ml_IN.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_nl_NL.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_no_NB.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_pl_PL.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_pt_BR.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_pt_PT.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_ro_RO.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_ru_RU.properties 🌐 Sync Translations + Update README Progress Table (#3994) 2025-07-20 22:00:51 +01:00
messages_sk_SK.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_sl_SI.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_sr_LATN_RS.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_sv_SE.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_th_TH.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_tr_TR.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_uk_UA.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_vi_VN.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_zh_CN.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages_zh_TW.properties fake scan to scanner effect (#3954) 2025-07-16 14:33:04 +01:00
messages.properties refactor: move modules under app/ directory and update file paths (#3938) 2025-07-14 20:53:11 +01:00
settings.yml.template url fixes for access issues (#4013) 2025-07-24 13:53:21 +01:00