8000 Merge branch '2.8' into 3.4 · symfony/symfony@143bdfc · GitHub
[go: up one dir, main page]

Skip to content

Commit 143bdfc

Browse files
Merge branch '2.8' into 3.4
* 2.8: [HttpKernel] Fix restoring trusted proxies in tests CODEOWNERS: some more rules
2 parents 1356fe7 + efe9beb commit 143bdfc

File tree

10 files changed

+58
-20
lines changed

10 files changed

+58
-20
lines changed

.github/CODEOWNERS

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1+
# Console
2+
/src/Symfony/Component/Console/Logger/ConsoleLogger.php @dunglas
3+
# DependencyInjection
4+
/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @dunglas
5+
# HttpKernel
6+
/src/Symfony/Component/HttpKernel/Log/Logger.php @dunglas
17
# LDAP
28
/src/Symfony/Component/Ldap/* @csarrazi
39
# Lock
410
/src/Symfony/Component/Lock/* @jderusse
511
# Messenger
612
/src/Symfony/Bridge/Doctrine/Messenger/* @sroze
713
/src/Symfony/Component/Messenger/* @sroze
14+
# PropertyInfo
15+
/src/Symfony/Component/PropertyInfo/* @dunglas
16+
/src/Symfony/Bridge/Doctrine/PropertyInfo/* @dunglas
17+
# Serializer
18+
/src/Symfony/Component/Serializer/* @dunglas
19+
# WebLink
20+
/src/Symfony/Component/WebLink/* @dunglas
821
# Workflow
922
/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php @lyrixx
1023
/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php @lyrixx

UPGRADE-3.4.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ Security
344344

345345
* The `GuardAuthenticatorInterface` has been deprecated and will be removed in 4.0.
346346
Use `AuthenticatorInterface` instead.
347-
347+
348348
* When extending `AbstractGuardAuthenticator` it's deprecated to return `null` from `getCredentials()`.
349349
Return `false` from `supports()` if no credentials available.
350350

@@ -413,13 +413,13 @@ TwigBridge
413413

414414
* deprecated the `Symfony\Bridge\Twig\Form\TwigRenderer` class, use the `FormRenderer`
415415
class from the Form component instead
416-
417-
* the service `twig.form.renderer` is now an instance of `FormRenderer`.
418-
So you might have to adjust your type-hints to `FormRendererInterface` if you are still relying on
416+
417+
* the service `twig.form.renderer` is now an instance of `FormRenderer`.
418+
So you might have to adjust your type-hints to `FormRendererInterface` if you are still relying on
419419
the `TwigRendererInterface` which was deprecated in Symfony 3.2
420-
421-
* retrieving the Renderer runtime from the twig environment via
422-
`$twig->getRuntime('Symfony\Bridge\Twig\Form\TwigRenderer')` is not working anymore
420+
421+
* retrieving the Renderer runtime from the twig environment via
422+
`$twig->getRuntime('Symfony\Bridge\Twig\Form\TwigRenderer')` is not working anymore
423423
and should be replaced with `$twig->getRuntime('Symfony\Component\Form\FormRenderer')` instead
424424

425425
* deprecated `Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironment` and the ability

UPGRADE-4.0.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,8 @@ Security
758758

759759
* The `GuardAuthenticatorInterface` interface has been removed.
760760
Use `AuthenticatorInterface` instead.
761-
762-
* When extending `AbstractGuardAuthenticator` getCredentials() cannot return
761+
762+
* When extending `AbstractGuardAuthenticator` getCredentials() cannot return
763763
`null` anymore, return false from `supports()` if no credentials available instead.
764764

765765
SecurityBundle

src/Symfony/Bridge/Monolog/Tests/Processor/WebProcessorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public function testUseRequestClientIp()
4949
$this->assertEquals($server['REQUEST_METHOD'], $record['extra']['http_method']);
5050
$this->assertEquals($server['SERVER_NAME'], $record['extra']['server']);
5151
$this->assertEquals($server['HTTP_REFERER'], $record['extra']['referrer']);
52+
53+
Request::setTrustedProxies(array(), -1);
5254
}
5355

5456
public function testCanBeConstructedWithExtraFields()

src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class RequestTest extends TestCase
2121
{
2222
protected function tearDown()
2323
{
24-
// reset
2524
Request::setTrustedProxies(array(), -1);
2625
Request::setTrustedHosts(array());
2726
}

src/Symfony/Component/HttpKernel/Tests/EventListener/ValidateRequestListenerTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121

2222
class ValidateRequestListenerTest extends TestCase
2323
{
24+
protected function tearDown()
25+
{
26+
Request::setTrustedProxies(array(), -1);
27+
}
28+
2429
/**
2530
* @expectedException \Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException
2631
*/

src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public function testRenderWithObjectsAsAttributes()
4747
$subRequest->attributes->replace(array('object' => $object, '_format' => 'html', '_controller' => 'main_controller', '_locale' => 'en'));
4848
$subRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
4949
$subRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
50-
$subRequest->server->set('REMOTE_ADDR', '1.1.1.1');
5150

5251
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($subRequest));
5352

@@ -100,7 +99,7 @@ public function testRenderWithTrustedHeaderDisabled()
10099
{
101100
Request::setTrustedProxies(array(), 0);
102101

103-
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest(Request::create('/', 'GET', array(), array(), array(), array('REMOTE_ADDR' => '1.1.1.1'))));
102+
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest(Request::create('/')));
104103
$this->assertSame('foo', $strategy->render('/', Request::create('/'))->getContent());
105104

106105
Request::setTrustedProxies(array(), -1);
@@ -188,7 +187,6 @@ public function testESIHeaderIsKeptInSubrequest()
188187
{
189188
$expectedSubRequest = Request::create('/');
190189
$expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"');
191-
$expectedSubRequest->server->set('REMOTE_ADDR', '1.1.1.1');
192190

193191
if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) {
194192
$expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
@@ -213,17 +211,34 @@ public function testESIHeaderIsKeptInSubrequestWithTrustedHeaderDisabled()
213211

214212
public function testHeadersPossiblyResultingIn304AreNotAssignedToSubrequest()
215213
{
216-
$expectedSubRequest = Request::create('/', 'GET', array(), array(), array(), array('REMOTE_ADDR' => '1.1.1.1'));
217-
if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) {
218-
$expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
219-
$expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
220-
}
214+
$expectedSubRequest = Request::create('/');
215+
$expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
216+
$expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
221217

222218
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest));
223219
$request = Request::create('/', 'GET', array(), array(), array(), array('HTTP_IF_MODIFIED_SINCE' => 'Fri, 01 Jan 2016 00:00:00 GMT', 'HTTP_IF_NONE_MATCH' => '*'));
224220
$strategy->render('/', $request);
225221
}
226222

223+
public function testFirstTrustedProxyIsSetAsRemote()
224+
{
225+
Request::setTrustedProxies(array('1.1.1.1'), -1);
226+
227+
$expectedSubRequest = Request::create('/');
228+
$expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"');
229+
$expectedSubRequest->server->set('REMOTE_ADDR', '1.1.1.1');
230+
$expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1'));
231+
$expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1');
232+
233+
$strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest));
234+
235+
$request = Request::create('/');
236+
$request->headers->set('Surrogate-Capability', 'abc="ESI/1.0"');
237+
$strategy->render('/', $request);
238+
239+
Request::setTrustedProxies(array(), -1);
240+
}
241+
227242
/**
228243
* Creates a Kernel expecting a request equals to $request
229244
* Allows delta in comparison in case REQUEST_TIME changed by 1 second.

src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,8 @@ public function testHttpCacheIsSetAsATrustedProxy(array $existing, array $expect
13501350
$this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1'));
13511351

13521352
$this->assertEquals($expected, Request::getTrustedProxies());
1353+
1354+
Request::setTrustedProxies(array(), -1);
13531355
}
13541356

13551357
public function getTrustedProxyData()

src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ public function testInconsistentClientIpsOnMasterRequests()
349349

350350
$kernel = $this->getHttpKernel($dispatcher);
351351
$kernel->handle($request, $kernel::MASTER_REQUEST, false);
352+
353+
Request::setTrustedProxies(array(), -1);
352354
}
353355

354356
private function getHttpKernel(EventDispatcherInterface $eventDispatcher, $controller = null, RequestStack $requestStack = null, array $arguments = array())

src/Symfony/Component/Security/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CHANGELOG
66

77
* Added `getUser`, `getToken` and `isGranted` methods to `Security`.
88
* added a `setToken()` method to the `SwitchUserEvent` class to allow to replace the created token while switching users
9-
when custom token generation is required by application.
9+
when custom token generation is required by application.
1010
* Using voters that do not implement the `VoterInterface`is now deprecated in
1111
the `AccessDecisionManager` and this functionality will be removed in 4.0.
1212
* Using the `ContextListener` without setting the `logoutOnUserChange`
@@ -16,7 +16,7 @@ CHANGELOG
1616
* deprecated HTTP digest authentication
1717
* Added a new password encoder for the Argon2i hashing algorithm
1818
* deprecated `GuardAuthenticatorInterface` in favor of `AuthenticatorInterface`
19-
* deprecated to return `null` from `getCredentials()` in classes that extend
19+
* deprecated to return `null` from `getCredentials()` in classes that extend
2020
`AbstractGuardAuthenticator`. Return `false` from `supports()` instead.
2121

2222
3.3.0

0 commit comments

Comments
 (0)
0