Commit Graph

7523 Commits

Author SHA1 Message Date
Fabien Potencier 4e58cb22e5 Fix CS 2026-06-01 09:00:03 +02:00
Fabien Potencier dc1db9ef63 Bump version 2026-05-30 19:09:51 +02:00
Fabien Potencier ae2071bffb Prepare the 3.27.1 release v3.27.1 2026-05-30 19:09:26 +02:00
Fabien Potencier 79884dee1c bug #4822 Fix inconsistent array access with a Stringable key (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix inconsistent array access with a Stringable key

Closes #4804

Commits
-------

8ec9530732 Fix inconsistent array access with a Stringable key
2026-05-29 11:45:30 +02:00
Fabien Potencier 8ec9530732 Fix inconsistent array access with a Stringable key 2026-05-29 10:06:57 +02:00
Fabien Potencier dfb5232d51 bug #4821 Preserve IteratorAggregate identity in sandbox __toString walker (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Preserve IteratorAggregate identity in sandbox __toString walker

Fixes #4820

It's not a full fix, but a quick one just that for the specific use case described in the issue. This is the simple case as IteratorAggregate instances can be iterated more than once (I suppose most such iterators don't have side effects).

Commits
-------

d25f98f45b Preserve IteratorAggregate identity in sandbox __toString walker
2026-05-29 09:34:05 +02:00
Fabien Potencier d25f98f45b Preserve IteratorAggregate identity in sandbox __toString walker 2026-05-29 09:31:03 +02:00
Fabien Potencier 118938b191 Fix tests 2026-05-29 09:30:54 +02:00
Fabien Potencier 86f3b3a1f2 Bump version 2026-05-27 15:06:12 +02:00
Fabien Potencier 04ae1bfe94 Prepare the 3.27.0 release v3.27.0 2026-05-27 15:05:51 +02:00
Fabien Potencier 99a10384ff security #558 Fix sandbox filter/tag/function allow-list bypass when sandbox state changes between renders (fabpot)
This PR was merged into the twig-3.x branch.

Discussion
----------

Fix sandbox filter/tag/function allow-list bypass when sandbox state changes between renders

Fixes #555

Commits
-------

23eb6eb126 Fix sandbox filter/tag/function allow-list bypass when sandbox state changes between renders
2026-05-27 14:59:52 +02:00
Fabien Potencier 23eb6eb126 Fix sandbox filter/tag/function allow-list bypass when sandbox state changes between renders 2026-05-27 14:59:42 +02:00
Fabien Potencier 7d55aa838c security #cve-2026-48805 Fix sandbox bypass in deprecated internal wrappers (fabpot)
This PR was merged into the twig-3.x branch.
2026-05-27 14:55:54 +02:00
Fabien Potencier 9fcf6906d7 security #552 Fix sandbox __toString policy bypass via dynamic mapping keys (fabpot)
This PR was squashed before being merged into the twig-3.x branch.

Discussion
----------

Fix sandbox __toString policy bypass via dynamic mapping keys

Fixes #548

Fixing this one introduces a new feature that I've decided to "keep" and document :)

Commits
-------

635cea4789 Document new support for any expression as a dynamic mapping key
9ff4101463 Fix sandbox __toString policy bypass via dynamic mapping keys
2026-05-27 14:55:08 +02:00
Fabien Potencier 635cea4789 Document new support for any expression as a dynamic mapping key 2026-05-27 14:54:58 +02:00
Fabien Potencier 9ff4101463 Fix sandbox __toString policy bypass via dynamic mapping keys 2026-05-27 14:54:34 +02:00
Fabien Potencier baebc46b67 security #535 Fix sandbox __toString bypasses via Traversable in join/replace filters and the in/not in operators (fabpot)
This PR was squashed before being merged into the twig-3.x branch.

Discussion
----------

Fix sandbox `__toString` bypasses via `Traversable` in `join`/`replace` filters and the `in`/`not in` operators

Fixes #512

Commits
-------

e3f66654b8 Fix deprecation notices in tests
475fb690ac Guard sandbox `__toString` walker against self-referencing iterables
e9e818cbfc Fix sandbox `__toString` bypass via `Stringable` + `Traversable` containers
8d6af0707b Fix sandbox `__toString` bypass via the `in` and `not in` operators
cc1e21a2a2 Fix sandbox __toString bypass via Traversable in join/replace filters
2026-05-27 14:53:15 +02:00
Fabien Potencier e3f66654b8 Fix deprecation notices in tests 2026-05-27 14:53:02 +02:00
Fabien Potencier 475fb690ac Guard sandbox __toString walker against self-referencing iterables 2026-05-27 14:53:02 +02:00
Fabien Potencier e9e818cbfc Fix sandbox __toString bypass via Stringable + Traversable containers 2026-05-27 14:53:01 +02:00
Fabien Potencier 8d6af0707b Fix sandbox __toString bypass via the in and not in operators 2026-05-27 14:52:32 +02:00
Fabien Potencier cc1e21a2a2 Fix sandbox __toString bypass via Traversable in join/replace filters 2026-05-27 14:52:30 +02:00
Fabien Potencier d9a6abc84f security #534 Fix sandbox bypass in the "column" filter under SourcePolicyInterface (fabpot)
This PR was squashed before being merged into the twig-3.x branch.

Discussion
----------

Fix sandbox bypass in the "column" filter under SourcePolicyInterface

Fixes #514

Commits
-------

afbaa2a9da Mark new SourcePolicyInterface column filter tests as `@group` legacy
09c6706407 Fix sandbox bypass in the "column" filter under SourcePolicyInterface
2026-05-27 14:50:29 +02:00
Fabien Potencier afbaa2a9da Mark new SourcePolicyInterface column filter tests as @group legacy
These tests pass a SourcePolicyInterface instance to SandboxExtension, which
triggers the 3.27 deprecation. Mark them legacy and assert the deprecation
to silence the PHPUnit "unhandled deprecation" report.
2026-05-27 14:49:53 +02:00
Fabien Potencier 09c6706407 Fix sandbox bypass in the "column" filter under SourcePolicyInterface 2026-05-27 14:49:52 +02:00
Fabien Potencier 3feda8a850 feature #4817 Add a strict mode to SecurityPolicy to opt-in to the 4.0 sandbox behavior for the extends/use tags and the parent/block/attribute functions (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Add a strict mode to SecurityPolicy to opt-in to the 4.0 sandbox behavior for the extends/use tags and the parent/block/attribute functions

#4813 follow-up

As `@stof` mentioned on Slack, there is currently no way to avoid the deprecation if you want to forbid those tags.

Commits
-------

af7bf5e181 Add a strict mode to SecurityPolicy to opt-in to the 4.0 sandbox behavior for the extends/use tags and the parent/block/attribute functions
2026-05-25 14:07:18 +02:00
Fabien Potencier af7bf5e181 Add a strict mode to SecurityPolicy to opt-in to the 4.0 sandbox behavior for the extends/use tags and the parent/block/attribute functions 2026-05-25 13:40:27 +02:00
Fabien Potencier 4dde307c32 minor #4815 Document transitive behavior of allowed sandbox operations (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Document transitive behavior of allowed sandbox operations

Commits
-------

461143d700 Document transitive behavior of allowed sandbox operations
2026-05-25 08:37:54 +02:00
Fabien Potencier 461143d700 Document transitive behavior of allowed sandbox operations 2026-05-25 08:36:20 +02:00
Fabien Potencier 3b0808f455 minor #4814 Remove obsolete PHP 8.0 workaround for Closure::__invoke attribute access (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Remove obsolete PHP 8.0 workaround for Closure::__invoke attribute access

The removed code was needed for `isset($closure->__invoke)` to work with PHP pre-8.0 (to avoid a fatal error):

 * 7.4: Fatal error: Uncaught Error: Closure object cannot have properties
 * 8.0: Fatal error: Uncaught Error: Closure object cannot have properties
 * 8.1+: bool(false) clean, no error

Commits
-------

42ccc472a2 Remove obsolete PHP 8.0 workaround for Closure::__invoke attribute access
2026-05-25 08:28:24 +02:00
Fabien Potencier 42ccc472a2 Remove obsolete PHP 8.0 workaround for Closure::__invoke attribute access 2026-05-25 08:28:10 +02:00
Fabien Potencier 89e79c28f1 feature #4813 Deprecate the fact that the parent, block, and attribute functions are always allowed in a sandboxed template (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Deprecate the fact that the `parent`, `block`, and `attribute` functions are always allowed in a sandboxed template

Commits
-------

cfaa2fd030 Deprecate the fact that the `parent`, `block`, and `attribute` functions are always allowed in a sandboxed template
2026-05-24 21:22:25 +02:00
Fabien Potencier cfaa2fd030 Deprecate the fact that the parent, block, and attribute functions are always allowed in a sandboxed template 2026-05-24 21:19:56 +02:00
Fabien Potencier d0a5017fd5 bug #4812 Fix PHP 8.1+ implicit float-to-int deprecation in sandboxed array access (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Fix PHP 8.1+ implicit float-to-int deprecation in sandboxed array access

Commits
-------

33690a4a28 Fix PHP 8.1+ implicit float-to-int deprecation in sandboxed array access
2026-05-24 19:40:38 +02:00
Fabien Potencier 33690a4a28 Fix PHP 8.1+ implicit float-to-int deprecation in sandboxed array access 2026-05-24 17:39:37 +02:00
Fabien Potencier e235cae3a1 Fix sandbox bypass in deprecated internal wrappers 2026-05-24 11:10:36 +02:00
Fabien Potencier 12f0dc2a1e minor #4811 Set LANG=en_US.UTF-8 for the extra packages tests (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Set LANG=en_US.UTF-8 for the extra packages tests

Commits
-------

d016d2439f Set LANG=en_US.UTF-8 for the extra packages tests
2026-05-24 11:06:21 +02:00
Fabien Potencier d016d2439f Set LANG=en_US.UTF-8 for the extra packages tests 2026-05-24 11:00:21 +02:00
Fabien Potencier ee8e1b8651 minor #4810 Use modern PHPUnit for extra packages (fabpot)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Use modern PHPUnit for extra packages

Commits
-------

25d7eb60d7 Use per-extension PHPUnit bridge and force PHPUnit 11 on PHP 8.2+
54420847f0 Install a custom exception handler before bootstrapping KernelTestCase
2026-05-24 10:52:50 +02:00
Fabien Potencier 25d7eb60d7 Use per-extension PHPUnit bridge and force PHPUnit 11 on PHP 8.2+ 2026-05-24 10:42:56 +02:00
Fabien Potencier 54420847f0 Install a custom exception handler before bootstrapping KernelTestCase 2026-05-24 10:42:35 +02:00
Fabien Potencier 85013f01b3 minor #4809 Simplify code (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Simplify code

Commits
-------

49e59e4612 Simplify code
2026-05-24 10:00:35 +02:00
Fabien Potencier 49e59e4612 Simplify code 2026-05-24 09:57:49 +02:00
Fabien Potencier fe6cbf9fcb bug #4807 Escape root profile name in HtmlDumper (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Escape root profile name in HtmlDumper

Commits
-------

f6aca309d8 Escape root profile name in HtmlDumper
2026-05-23 09:39:33 +02:00
Fabien Potencier f6aca309d8 Escape root profile name in HtmlDumper 2026-05-23 09:39:26 +02:00
Fabien Potencier ead63cc824 bug #4808 Restrict allowed classes in Profile::unserialize() (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Restrict allowed classes in Profile::unserialize()

Commits
-------

4c1dae5e71 Restrict allowed classes in Profile::unserialize()
2026-05-23 09:38:46 +02:00
Fabien Potencier 4c1dae5e71 Restrict allowed classes in Profile::unserialize() 2026-05-23 09:09:19 +02:00
Fabien Potencier c6bbae295b Fix typo 2026-05-23 09:03:34 +02:00
Fabien Potencier 4fc0210084 Bump version 2026-05-23 08:32:22 +02:00
Fabien Potencier 3ef56b7284 feature #4803 Deprecate the "Twig\Sandbox\SourcePolicyInterface" interface (fabpot)
This PR was merged into the 3.x branch.

Discussion
----------

Deprecate the "Twig\Sandbox\SourcePolicyInterface" interface

I'm deprecating this feature for the following main reasons:

* AFAICS, no open-source projects is using this feature and the only repository using it has 0 stars and 0 downloads on Packagist - if nobody find value in this feature, it's better to remove it
* As much as possible, a better strategy is to render templates written by untrusted users via a specific loader that restrict what the sandbox environment can "see".

Commits
-------

bd924d5d33 Deprecate the "Twig\Sandbox\SourcePolicyInterface" interface
2026-05-23 08:30:15 +02:00