Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security] Allow an array of pattern in firewall configuration #18617

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

alexandre-daubois
Copy link
Contributor

@carsonbot carsonbot added this to the 6.4 milestone Jul 27, 2023
@carsonbot carsonbot changed the title [WCM][SecurityBundle] Allow an array of pattern in firewall configuration [WCM] Allow an array of pattern in firewall configuration Jul 27, 2023
@OskarStark OskarStark added the Waiting Code Merge Docs for features pending to be merged label Jul 27, 2023
@carsonbot carsonbot modified the milestones: 6.4, next Jul 27, 2023
chalasr added a commit to symfony/symfony that referenced this pull request Jul 29, 2023
…ll configuration (lyrixx, chalasr)

This PR was merged into the 6.4 branch.

Discussion
----------

[SecurityBundle] Allow an array of `pattern` in firewall configuration

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        | symfony/symfony-docs#18617

allow this :
```diff
 security:
     firewalls:
         no_security:
-            pattern: "^/(register|documentation)$"
+            pattern:
+                - "^/register$"
+                - "^/documentation$"
```

---

```php
/**
 * `@Revs`(100)
 * `@Iterations`(100)
 */
class RegexBench
{
    public function benchOneBigString()
    {
        preg_match("{^/(register|documentation)$}", "/register");
        preg_match("{^/(register|documentation)$}", "/foo");
    }

    public function benchArrayConcat()
    {
        preg_match("{(?:^/register$|^/documentation$)}", "/register");
        preg_match("{(?:^/register$|^/documentation$)}", "/foo");
    }
}
```

=>

```
PHPBench (dev-master) running benchmarks... #standwithukraine
with configuration file: /home/gregoire/dev/github.com/lyrixx/php-bench/phpbench.json
with PHP version 8.2.8, xdebug ❌, opcache ✔

\RegexBench

    benchOneBigString.......................I99 - Mo0.670μs (±17.85%)
    benchArrayConcat........................I99 - Mo0.664μs (±12.49%)

Subjects: 2, Assertions: 0, Failures: 0, Errors: 0
+-------------------+---------+-----------+
| subject           | mean    | mem_peak  |
+-------------------+---------+-----------+
| benchOneBigString | 0.716μs | 995.920kb |
| benchArrayConcat  | 0.707μs | 995.920kb |
+-------------------+---------+-----------+
```

Commits
-------

46344de [SecurityBundle] Allow an array of `pattern` in firewall configuration
@javiereguiluz javiereguiluz added Status: Reviewed and removed Status: Needs Review Waiting Code Merge Docs for features pending to be merged labels Jul 31, 2023
@javiereguiluz javiereguiluz changed the title [WCM] Allow an array of pattern in firewall configuration Allow an array of pattern in firewall configuration Jul 31, 2023
@carsonbot carsonbot changed the title Allow an array of pattern in firewall configuration [Security] Allow an array of pattern in firewall configuration Jul 31, 2023
javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this pull request Jul 31, 2023
…configuration (alexandre-daubois)

This PR was merged into the 6.4 branch.

Discussion
----------

[Security] Allow an array of pattern in firewall configuration

Related to symfony/symfony#51128

Commits
-------

66a7330 [SecurityBundle] Allow an array of pattern in firewall configuration
@javiereguiluz
Copy link
Member

Thanks a lot Alex!

@javiereguiluz
Copy link
Member

There's been an error here while merging. I can't see this merged in symfony/symfony-docs, only in my own fork: javiereguiluz@53b234e

@alexandre-daubois please, don't delete your original branch until we find out what happened here. Thanks!

@OskarStark
Copy link
Contributor

Thank you Alexandre.

@OskarStark OskarStark merged commit 393823c into symfony:6.4 Aug 1, 2023
@OskarStark
Copy link
Contributor

It worked @javiereguiluz

@alexandre-daubois alexandre-daubois deleted the security-regex-pattern branch August 1, 2023 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants