Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@
# the order in which firewalls are defined is very important, as the
# request will be handled by the first firewall whose pattern matches
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
pattern: ^/_profiler|_wdt|assets|build/ # `assets` is for AssetMapper; `build` is for Webpack Encore
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pattern: ^/_profiler|_wdt|assets|build/ # `assets` is for AssetMapper; `build` is for Webpack Encore
pattern: ^/(_profiler|_wdt|assets|build)/ # `assets` is for AssetMapper; `build` is for Webpack Encore
security: false
# a firewall with no pattern should be defined last because it will match all requests
main:
Expand All @@ -509,7 +509,7 @@
# https://symfony.com/doc/current/security.html#firewalls-authentication

# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true

Check failure on line 512 in security.rst

View workflow job for this annotation

GitHub Actions / Code Blocks

[Cache Warmup] In SecurityExtension.php line 399: Invalid firewall "main": user provider "app_user_provider" not found. 2025-03-23T10:22:38+00:00 [info] User Deprecated: Method "Symfony\Component\HttpKernel\Bundle\Bundle::build()" might add "void" as a native return type declaration in the future. Do the same in child class "Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle" now to avoid errors or add an explicit @return annotation to suppress this message.

.. code-block:: xml

Expand All @@ -529,8 +529,8 @@
<!-- the order in which firewalls are defined is very important, as the
request will be handled by the first firewall whose pattern matches -->
<firewall name="dev"
pattern="^/(_(profiler|wdt)|css|images|js)/"
security="false"/>
pattern="^/_profiler|_wdt|assets|build/"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pattern="^/_profiler|_wdt|assets|build/"
pattern="^/(_profiler|_wdt|assets|build)/"
security="false"/> <!-- `assets` is for AssetMapper; `build` is for Webpack Encore -->

<!-- a firewall with no pattern should be defined last because it will match all requests -->
<firewall name="main"
Expand All @@ -555,7 +555,7 @@
// the order in which firewalls are defined is very important, as the
// request will be handled by the first firewall whose pattern matches
$security->firewall('dev')
->pattern('^/(_(profiler|wdt)|css|images|js)/')
->pattern('^/_profiler|_wdt|assets|build/') // `assets` is for AssetMapper; `build` is for Webpack Encore
->security(false)
;

Expand Down Expand Up @@ -598,9 +598,7 @@
pattern:
- ^/_profiler/
- ^/_wdt/
- ^/css/
- ^/images/
- ^/js/
- ^/assets/
# ...

.. code-block:: php
Expand All @@ -614,9 +612,7 @@
->pattern([
'^/_profiler/',
'^/_wdt/',
'^/css/',
'^/images/',
'^/js/',
'^/assets/',
])
->security(false)
;
Expand Down
Loading