Commit Graph

45034 Commits

Author SHA1 Message Date
Kévin Dunglas
3b11a76686
feature #34151 [DomCrawler] normalizeWhitespace should be true by default (dunglas)
This PR was squashed before being merged into the 4.4 branch (closes #34151).

Discussion
----------

[DomCrawler] normalizeWhitespace should be true by default

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

According to the [DOM](https://www.w3.org/TR/DOM-Level-3-Core/core.html#Text3-isElementContentWhitespace) and [WebDriver](https://www.w3.org/TR/webdriver/#get-element-text) specs, browsers always return the normalized text. In Panther, because of WebDriver, it's not even possible without dirty hacks to retrieve the "non normalized" text.

For compatibility with Panther it's mandatory to set this new parameter (introduced in 4.4) to `true` by default.

 I propose to change the default value to true in 5.0, it has the benefit of:

* being spec-compliant (in 5.0, text will be normalized by default)
* being cleaner when using Panther (`$node->text()` instead of `$node->text(null, true)`, passing true is mandatory because Panther doesn't support retrieving the non-normalized text)

For backward compatible with 4.x versions, if no argument is passed and the returned text isn't the same than the normalized one, a notice is triggered.

Commits
-------

54d46eef67 [DomCrawler] normalizeWhitespace should be true by default
2019-10-29 12:38:43 +01:00
Kévin Dunglas
54d46eef67
[DomCrawler] normalizeWhitespace should be true by default 2019-10-29 12:38:30 +01:00
Thomas Calvet
ad2ce276c7 [Serializer] Improve messages for unexpected resources values 2019-10-29 12:09:57 +01:00
Nicolas Grekas
452c863639 [Cache] add DeflateMarshaller - remove phpredis compression 2019-10-29 11:36:36 +01:00
Kévin Dunglas
42be5f8132
Merge branch '4.3' into 4.4
* 4.3:
  [DoctrineBridge] Auto-validation must work if no regex are passed
2019-10-29 11:04:46 +01:00
Kévin Dunglas
ee4b99f227
bug #33828 [DoctrineBridge] Auto-validation must work if no regex are passed (dunglas)
This PR was squashed before being merged into the 4.3 branch (closes #33828).

Discussion
----------

[DoctrineBridge] Auto-validation must work if no regex are passed

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

Backport of https://github.com/symfony/symfony/pull/32107/files#r295762928.
This behavior if faulty, if no regex are passed, autvalidation must be triggered, [as done in `PropertyInfoLoader`](https://github.com/symfony/symfony/blob/4.3/src/Symfony/Component/Validator/Mapping/Loader/PropertyInfoLoader.php#L50).

Commits
-------

5ed7d6c759 [DoctrineBridge] Auto-validation must work if no regex are passed
2019-10-29 11:03:42 +01:00
Kévin Dunglas
5ed7d6c759
[DoctrineBridge] Auto-validation must work if no regex are passed 2019-10-29 11:03:05 +01:00
Robin Chalas
662b35e30e Merge branch '4.3' into 4.4
* 4.3:
  remove outdated workflow test
  drop wrong test (fix merge)
2019-10-29 04:34:23 +01:00
Robin Chalas
f233259c68 remove outdated workflow test 2019-10-29 03:10:02 +01:00
Robin Chalas
6c2253415f drop wrong test (fix merge) 2019-10-29 02:54:26 +01:00
Yonel Ceruto
cc2858f7d0 bug #34158 [ErrorRenderer] Security fix: hide sensitive error messages (dunglas)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorRenderer] Security fix: hide sensitive error messages

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

This PR fixes a security issue. Exception messages must not be displayed except when debugging, because they can contain sensitive data including credentials.
For instance, PDO and Doctrine throw exception with message such as `The details are: SQLSTATE[HY000] [1045] Access denied for user 'root'@'db.example.com' (using password: NO)` revealing internal details about the infrastructure usful for an attacker.

Also, I still think that ErrorRenderer should be removed in favor of using the Serializer directly (see https://github.com/symfony/symfony/pull/33650#issuecomment-534441889). I'll try to open some PRs to do that in tomorrow.

Commits
-------

d7d7f22 [ErrorRenderer] Security fix: hide sensitive error messages
2019-10-28 19:43:36 -04:00
Kévin Dunglas
d7d7f22dbe [ErrorRenderer] Security fix: hide sensitive error messages 2019-10-28 19:37:55 -04:00
Robin Chalas
913c485efd minor #34159 [Security] Fix merge (chalasr)
This PR was merged into the 4.4 branch.

Discussion
----------

[Security] Fix merge

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

fd0ed42adb [Security] Fix merge
2019-10-28 23:51:27 +01:00
Robin Chalas
fd0ed42adb [Security] Fix merge 2019-10-28 23:18:08 +01:00
Nicolas Grekas
0f5a7b8b41 Merge branch '4.3' into 4.4
* 4.3:
  Fix an error message to be more accurate
2019-10-28 22:57:16 +01:00
Nicolas Grekas
7b3d5cd615 minor #34157 [OptionsResolver] Fix an error message to be more accurate (yceruto)
This PR was merged into the 4.3 branch.

Discussion
----------

[OptionsResolver] Fix an error message to be more accurate

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #30432
| License       | MIT
| Doc PR        | -

Follow-up https://github.com/symfony/symfony/pull/30442 for 4.3

Commits
-------

1be68a752a Fix an error message to be more accurate
2019-10-28 22:53:11 +01:00
Yonel Ceruto
1be68a752a Fix an error message to be more accurate 2019-10-28 16:59:01 -04:00
Nicolas Grekas
05f7f4e147 Merge branch '4.3' into 4.4
* 4.3:
  [OptionsResolve] Revert change in tests for a not-merged change in code
  [HttpClient] fix handling of 3xx with no Location header - ignore Content-Length when no body is expected
  [Workflow] Made the configuration more robust for the 'property' key
  [Security/Core] make NativePasswordEncoder use sodium to validate passwords when possible
  #30432 fix an error message
  fix paths to detect code owners
  [HttpClient] ignore the body of responses to HEAD requests
  [Validator] Ensure numeric subpaths do not cause errors on PHP 7.4
  [SecurityBundle] Fix wrong assertion
  Remove unused local variables in tests
  [Yaml][Parser] Remove the getLastLineNumberBeforeDeprecation() internal unused method
  Make sure to collect child forms created on *_SET_DATA events
  [WebProfilerBundle] Improve display in Email panel for dark theme
  do not render errors for checkboxes twice
2019-10-28 21:30:34 +01:00
Robin Chalas
2ecd7936b1 bug #34080 [SecurityBundle] correct types for default arguments for firewall configs (shieldo)
This PR was merged into the 3.4 branch.

Discussion
----------

[SecurityBundle] correct types for default arguments for firewall configs

| Q             | A
| ------------- | ---
| Branch?       | 3.4 (and forward)
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

Up until now, the default template arguments in the `security.firewall.config` abstract service definition have been each defined (aside from the argument for `$listeners` which is given a `collection` type) in the XML as

```xml
<argument />
```

which resolves to an empty string, despite that some of the arguments are typed to being either `bool` or `array|null` on the `Symfony\Bundle\SecurityBundle\Security\FirewallConfig` class itself.

This wouldn't be so much of a problem if the child definitions that use this as a template overrode all the arguments every time, but in the case of firewall configs that mark security as _not_ being enabled, [only the first few arguments are overwritten](https://github.com/symfony/symfony/blob/3.4/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L349-L352), so firewall config objects that do not have security enabled are instantiated by the DI container with parameters with some of the wrong types.

In general this wouldn't be an issue, as firewalls with security not enabled would not usually be consumed in a context where further security-related config were needed, but there is a case in `Symfony\Bundle\SecurityBundle\DataCollector\SecurityDataCollector` where the method `getSwitchUser()` on the firewall config object [can be called](https://github.com/symfony/symfony/blob/3.4/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php#L181) without checking first whether the firewall has security enabled, which leads to an exception being thrown:

```
Symfony\Component\Debug\Exception\ContextErrorException
Warning: Illegal string offset 'parameter'
in vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php (line 184)
```

which is down to the firewall config being set with an empty string rather than `null` (in which case the logic here would function as expected).

It seemed most appropriate as a fix (especially given possible introduction of scalar type hints in the future) to apply types to the default arguments so that it was no longer possible to instantiate a firewall config object with parameters of unexpected types.

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Always add tests and ensure they pass.
 - Never break backward compatibility (see https://symfony.com/bc).
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too.)
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

Commits
-------

6b7044fc01 [SecurityBundle] correct types for default arguments for firewall configs
2019-10-28 18:20:44 +01:00
Ryan Weaver
01a9fefe77 Adding ConsumedByWorkerStamp as way to mark a message in a "worker context" 2019-10-28 13:18:09 -04:00
Nicolas Grekas
15f08553be [OptionsResolve] Revert change in tests for a not-merged change in code 2019-10-28 18:16:45 +01:00
Nicolas Grekas
6d5c91bb47 Merge branch '3.4' into 4.3
* 3.4:
  #30432 fix an error message
  fix paths to detect code owners
  [Validator] Ensure numeric subpaths do not cause errors on PHP 7.4
  Remove unused local variables in tests
  Make sure to collect child forms created on *_SET_DATA events
  do not render errors for checkboxes twice
2019-10-28 18:07:32 +01:00
Nicolas Grekas
48533ff3f1 bug #34152 [Workflow] Made the configuration more robust for the 'property' key (lyrixx)
This PR was merged into the 4.3 branch.

Discussion
----------

[Workflow] Made the configuration more robust for the 'property' key

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34092
| License       | MIT
| Doc PR        |

Commits
-------

0c31ff007e [Workflow] Made the configuration more robust for the 'property' key
2019-10-28 17:55:19 +01:00
Nicolas Grekas
fd5b8def49 bug #34154 [HttpClient] fix handling of 3xx with no Location header - ignore Content-Length when no body is expected (nicolas-grekas)
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] fix handling of 3xx with no Location header - ignore Content-Length when no body is expected

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

A `304` is the final response code.
This PR implements the same logic as curl.

Commits
-------

50a88c59f6 [HttpClient] fix handling of 3xx with no Location header - ignore Content-Length when no body is expected
2019-10-28 17:53:30 +01:00
Nicolas Grekas
50a88c59f6 [HttpClient] fix handling of 3xx with no Location header - ignore Content-Length when no body is expected 2019-10-28 16:45:56 +01:00
Ryan Weaver
38f19a960c Revert "[Messenger] Removing "sync" transport and replacing it with much nicer config trick"
This reverts commit 3d4e59a10b.
2019-10-28 11:14:08 -04:00
Grégoire Pineau
0c31ff007e [Workflow] Made the configuration more robust for the 'property' key 2019-10-28 15:45:57 +01:00
Robin Chalas
3be177a93f bug #34140 [Security/Core] make NativePasswordEncoder use sodium to validate passwords when possible (nicolas-grekas)
This PR was merged into the 4.3 branch.

Discussion
----------

[Security/Core] make NativePasswordEncoder use sodium to validate passwords when possible

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

sodium implementations are always faster, let's use them when possible. This also allows validating argon2 passwords when bcrypt is configured as the main one, making migrations possible.

Commits
-------

799a2eae2d [Security/Core] make NativePasswordEncoder use sodium to validate passwords when possible
2019-10-28 10:35:50 +01:00
Nicolas Grekas
799a2eae2d [Security/Core] make NativePasswordEncoder use sodium to validate passwords when possible 2019-10-28 10:20:18 +01:00
Mathias Arlaud
f167c77eaf Handle non existent decorated services 2019-10-28 09:31:16 +01:00
Fabien Potencier
0472dbfccb bug #34145 [FrameworkBundle] make SodiumVault report bad decryption key accurately (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] make SodiumVault report bad decryption key accurately

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

d9d16d2ce7 [FrameworkBundle] make SodiumVault report bad decryption key accurately
2019-10-27 18:49:11 +01:00
Nicolas Grekas
d9d16d2ce7 [FrameworkBundle] make SodiumVault report bad decryption key accurately 2019-10-27 17:21:30 +01:00
Jérémy Derussé
474daf976e
Allows URL DSN in Lock and Cache 2019-10-27 15:23:49 +01:00
Nicolas Grekas
0a1de38a5b cs fix 2019-10-27 13:36:05 +01:00
Nicolas Grekas
b5a47df0b9 feature #34020 [Security] Allow to stick to a specific password hashing algorithm (chalasr)
This PR was merged into the 4.4 branch.

Discussion
----------

[Security] Allow to stick to a specific password hashing algorithm

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #33054
| License       | MIT
| Doc PR        | todo

Allows using `argon2i`, `argon2id` and `bcrypt`.

Commits
-------

6712d1e504 [Security] Allow to set a fixed algorithm
2019-10-27 13:33:51 +01:00
Robin Chalas
6712d1e504 [Security] Allow to set a fixed algorithm 2019-10-27 13:32:13 +01:00
Nicolas Grekas
60a4d8dc7a [Security/Core] make encodedLength computation more generic 2019-10-27 11:16:45 +01:00
Robin Chalas
32b227d004 minor #34138 [Security/Core] add fast path when encoded password cannot match anything (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[Security/Core] add fast path when encoded password cannot match anything

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Only `MessageDigestPasswordEncoder` and `Pbkdf2PasswordEncoder` need this fast path: the sodium and the native encoders already implement it natively.

When a migrating encoder is used, a failed password validation fallbacks to all encoders. This makes the process slower than needed currently.

Commits
-------

c57f8f7f93 [Security/Core] add fast path when encoded password cannot match anything
2019-10-27 11:11:28 +01:00
Nicolas Grekas
c57f8f7f93 [Security/Core] add fast path when encoded password cannot match anything 2019-10-27 10:41:22 +01:00
Fabien Potencier
22230f7b8e feature #34131 [FrameworkBundle] Remove suffix convention when using env vars to override secrets from the vault (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] Remove suffix convention when using env vars to override secrets from the vault

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Right now, env vars that override encrypted secrets must en up with `_SECRET`.
This PR removes this convention. It also enforces that only vars defined in the vault can be overriden locally. This means one cannot set a local-only secret.

Commits
-------

2ec9647e75 [FrameworkBundle] Remove suffix convention when using env vars to override secrets from the vault
2019-10-27 09:05:59 +01:00
Robin Chalas
54e1d12f92 minor #34137 [Messenger] Fix redis test (chalasr)
This PR was merged into the 4.4 branch.

Discussion
----------

[Messenger] Fix redis test

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Always add tests and ensure they pass.
 - Never break backward compatibility (see https://symfony.com/bc).
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too.)
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

Commits
-------

3fdaf970c3 [Messenger] Fix redis test
2019-10-27 08:01:46 +01:00
Robin Chalas
3fdaf970c3 [Messenger] Fix redis test 2019-10-27 07:53:30 +01:00
Fabien Potencier
8920672b2e minor #34127 fix paths to detect code owners (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

fix paths to detect code owners

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

I was wondering why sometimes I didn't receive any notifications for PRs where I thought a file for which I claimed code ownership was modified. Turns out according to https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax the `dir/*` pattern does not include nested directories.

Commits
-------

cb7523d595 fix paths to detect code owners
2019-10-26 21:54:01 +02:00
Fabien Potencier
b54997d1df bug #34126 [VarDumper] fix infinite recursion (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[VarDumper] fix infinite recursion

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

56d9f47857 [VarDumper] fix infinite recursion
2019-10-26 21:52:16 +02:00
Nicolas Grekas
2ec9647e75 [FrameworkBundle] Remove suffix convention when using env vars to override secrets from the vault 2019-10-26 15:06:32 +02:00
Yonel Ceruto
fb70e0af8d minor #30442 [OptionsResolver] Fix an error message to be more accurate (dimabory)
This PR was merged into the 3.4 branch.

Discussion
----------

[OptionsResolver] Fix an error message to be more accurate

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #30432
| License       | MIT
| Doc PR        |

See #30432 for more details:
> **Symfony version(s) affected**: 3.4, maybe other versions too (not tested)
>
> **Description**
> Error message when allowedTypes is an array contains `[]` but should not:
> `The option "testme" with value array is expected to be of type "string[]", but one of the elements is of type "integer[]".`
> It should be:
> `The option "testme" with value array is expected to be of type "string[]", but one of the elements is of type "integer".`
>
> **How to reproduce**
>
> ```
> $resolver = (new OptionsResolver())
>     ->setDefault('testme', [])
>     ->setAllowedTypes('testme', ['string[]'])
>     ->resolve(['testme' => ['test', 12]]);
> ```

In addition I changed an error message to be more
accurate if provided more than one incorrect value:
> [...] is expected to be of type "integer[][]", but is of type "integer|boolean|string".

Commits
-------

7fa2fc2 #30432 fix an error message
2019-10-26 07:18:38 -04:00
Dmytro
7fa2fc2b96 #30432 fix an error message 2019-10-26 07:02:01 -04:00
Yonel Ceruto
2a5c75582e bug #33999 [Form] Make sure to collect child forms created on *_SET_DATA events (yceruto)
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] Make sure to collect child forms created on *_SET_DATA events

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #29291
| License       | MIT
| Doc PR        | -

See reproducer provided by @WubbleWobble https://github.com/WubbleWobble/symfony-issue-29291.

Commits
-------

50efc1a Make sure to collect child forms created on *_SET_DATA events
2019-10-26 06:32:38 -04:00
Fabien Potencier
8eb17aa203 bug #34076 [HttpKernel] Avoid nested exceptions if errors occur when generating file links (yceruto)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpKernel] Avoid nested exceptions if errors occur when generating file links

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Multiple exceptions are fired until the fallback error page is rendered without the FileLinkFormatter:
48282ce80f/src/Symfony/Component/HttpKernel/Debug/FileLinkFormatter.php (L79-L86)

**Before** (the reproducer is highlighted inside the picture or simply adds an undefined option to the `@Route()` annotation)
![error-page-before](https://user-images.githubusercontent.com/2028198/67356903-c8a17700-f529-11e9-9384-12a29e17b682.png)

**After** (I couldn't find a better solution to display this exception once)
![error-page-after](https://user-images.githubusercontent.com/2028198/67356941-db1bb080-f529-11e9-8808-d7f72dadc4d6.png)

Commits
-------

d91a5a067d Avoid nested exceptions if errors occur when generating file links
2019-10-26 10:25:48 +02:00
Christian Flothmann
cb7523d595 fix paths to detect code owners 2019-10-26 10:25:32 +02:00