Skip to content

feat: Define option URI.AllowedSymbols#447

Merged
ezyang merged 2 commits intoezyang:masterfrom
totten:master-uri-allow-symbols
Jun 6, 2025
Merged

feat: Define option URI.AllowedSymbols#447
ezyang merged 2 commits intoezyang:masterfrom
totten:master-uri-allow-symbols

Conversation

@totten
Copy link
Copy Markdown
Contributor

@totten totten commented May 2, 2025

When a user composes an HTML blob, they may include URLs. In some systems, URLs can have template expressions, such as:

<a href="https://example.com/contact?id={contact.id}">View My Records</a>

The URL includes a subexpression delimited by {}. Under pure URL rules, the {} should escaped. But if we're actually handling an URL-template, then the {} is meaningful (and distinct from %7B or %7D).

This adds an option URI.AllowedSymbols which can be used to approve {}, as in:

$config->set('URI.AllowedSymbols', '!$&\'()*+,;={}');

Copy link
Copy Markdown
Owner

@ezyang ezyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Templates that are substituted after HTML Purifier constitute XSS risk. Compose your system in this way at your own risk.

@ezyang ezyang merged commit 77ebd08 into ezyang:master Jun 6, 2025
15 checks passed
@totten totten deleted the master-uri-allow-symbols branch June 12, 2025 22:56
github-actions bot pushed a commit that referenced this pull request Oct 17, 2025
# [4.19.0](v4.18.0...v4.19.0) (2025-10-17)

### Bug Fixes

* add warning for misleading option ([#433](#433)) ([b21a591](b21a591))
* catastrophic backtracking in Core.AggressivelyFixLt ([#440](#440)) ([418eeb7](418eeb7))
* Deprecated: preg_replace(): Passing null to parameter [#3](#3) ($subject) o… ([#421](#421)) ([5d154a2](5d154a2))
* non-substantive typos ([#434](#434)) ([c2bc354](c2bc354))

### Features

* Add CSS direction support ([#429](#429)) ([63e631e](63e631e))
* Add option for safe iframe hosts using array lookup ([#423](#423)) ([b5cbf0c](b5cbf0c))
* Allow more image widths by default ([#430](#430)) ([00a0748](00a0748))
* Define option URI.AllowedSymbols ([#447](#447)) ([77ebd08](77ebd08))
* PHP 8.4 support ([#441](#441)) ([ff005f6](ff005f6))
* Support PHP 8.5 versions ([#453](#453)) ([1eb05d9](1eb05d9))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 4.19.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants