Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Form] Added a cause on when a Csrf Error has occurred on CsrfValidationListener #28564

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

Merged
merged 1 commit into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 28 additions & 17 deletions 45 UPGRADE-4.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ Finder
Form
----

* The `scale` option of the `IntegerType` is deprecated.
* The `$scale` argument of the `IntegerToLocalizedStringTransformer` is deprecated.

* Deprecated calling `FormRenderer::searchAndRenderBlock` for fields which were already rendered.
Instead of expecting such calls to return empty strings, check if the field has already been rendered.

Expand All @@ -72,24 +75,12 @@ Form
{% endfor %}
```

Process
-------

* Deprecated the `Process::setCommandline()` and the `PhpProcess::setPhpBinary()` methods.
* Deprecated passing commands as strings when creating a `Process` instance.

Before:
```php
$process = new Process('ls -l');
```

After:
```php
$process = new Process(array('ls', '-l'));
HttpFoundation
--------------

// alternatively, when a shell wrapper is required
$process = Process::fromShellCommandline('ls -l');
```
* The default value of the "$secure" and "$samesite" arguments of Cookie's constructor
will respectively change from "false" to "null" and from "null" to "lax" in Symfony
5.0, you should define their values explicitly or use "Cookie::create()" instead.

FrameworkBundle
---------------
Expand Down Expand Up @@ -164,6 +155,25 @@ Monolog

* The methods `DebugProcessor::getLogs()`, `DebugProcessor::countErrors()`, `Logger::getLogs()` and `Logger::countErrors()` will have a new `$request` argument in version 5.0, not defining it is deprecated.

Process
-------

* Deprecated the `Process::setCommandline()` and the `PhpProcess::setPhpBinary()` methods.
* Deprecated passing commands as strings when creating a `Process` instance.

Before:
```php
$process = new Process('ls -l');
```

After:
```php
$process = new Process(array('ls', '-l'));

// alternatively, when a shell wrapper is required
$process = Process::fromShellCommandline('ls -l');
```

Security
--------

Expand Down Expand Up @@ -206,3 +216,4 @@ Validator
* The component is now decoupled from `symfony/translation` and uses `Symfony\Contracts\Translation\TranslatorInterface` instead
* The `ValidatorBuilderInterface` has been deprecated and `ValidatorBuilder` made final
* Deprecated validating instances of `\DateTimeInterface` in `DateTimeValidator`, `DateValidator` and `TimeValidator`. Use `Type` instead or remove the constraint if the underlying model is type hinted to `\DateTimeInterface` already.
* Using the `Bic` constraint without `symfony/intl` is deprecated
9 changes: 9 additions & 0 deletions 9 UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ Finder

* The `Finder::sortByName()` method has a new `$useNaturalSort` argument.

Form
----

* The `scale` option was removed from the `IntegerType`.
* The `$scale` argument of the `IntegerToLocalizedStringTransformer` was removed.

FrameworkBundle
---------------

Expand Down Expand Up @@ -117,6 +123,8 @@ HttpFoundation
* The `$size` argument of the `UploadedFile` constructor has been removed.
* The `getClientSize()` method of the `UploadedFile` class has been removed.
* The `getSession()` method of the `Request` class throws an exception when session is null.
* The default value of the "$secure" and "$samesite" arguments of Cookie's constructor
changed respectively from "false" to "null" and from "null" to "lax".

Monolog
-------
Expand Down Expand Up @@ -191,6 +199,7 @@ Validator
* The component is now decoupled from `symfony/translation` and uses `Symfony\Contracts\Translation\TranslatorInterface` instead
* The `ValidatorBuilderInterface` has been removed and `ValidatorBuilder` is now final
* Removed support for validating instances of `\DateTimeInterface` in `DateTimeValidator`, `DateValidator` and `TimeValidator`. Use `Type` instead or remove the constraint if the underlying model is type hinted to `\DateTimeInterface` already.
* The `symfony/intl` component is now required for using the `Bic` constraint

Workflow
--------
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Bridge/Monolog/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CHANGELOG
* added `ProcessorInterface`: an optional interface to allow autoconfiguration of Monolog processors
* The methods `DebugProcessor::getLogs()`, `DebugProcessor::countErrors()`, `Logger::getLogs()`
and `Logger::countErrors()` will have a new `$request` argument in version 5.0, not defining
it is deprecated since Symfony 4.2.
it is deprecated

4.1.0
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;

Expand Down Expand Up @@ -144,7 +145,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
$options['show_hidden'] = $input->getOption('show-hidden');
$options['raw_text'] = $input->getOption('raw');
$options['output'] = $io;
$helper->describe($io, $object, $options);

try {
$helper->describe($io, $object, $options);
} catch (ServiceNotFoundException $e) {
if ('' !== $e->getId() && '@' === $e->getId()[0]) {
throw new ServiceNotFoundException($e->getId(), $e->getSourceId(), null, array(substr($e->getId(), 1)));
}

throw $e;
}

if (!$input->getArgument('name') && !$input->getOption('tag') && !$input->getOption('parameter') && $input->isInteractive()) {
if ($input->getOption('tags')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public static function getServiceProvider(ContainerBuilder $container, $name)
{
$container->resolveEnvPlaceholders($name, null, $usedEnvs);

if ($usedEnvs || preg_match('#^[a-z]++://#', $name)) {
if ($usedEnvs || preg_match('#^[a-z]++:#', $name)) {
$dsn = $name;

if (!$container->hasDefinition($name = '.cache_connection.'.ContainerBuilder::hash($dsn))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ public function load(array $configs, ContainerBuilder $container)
if ($this->isConfigEnabled($container, $config['session'])) {
$this->sessionConfigEnabled = true;
$this->registerSessionConfiguration($config['session'], $container, $loader);
if (!empty($config['test'])) {
$container->getDefinition('test.session.listener')->setArgument(1, '%session.storage.options%');
}
}

if ($this->isConfigEnabled($container, $config['request'])) {
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class WebTestCase extends KernelTestCase
/**
* Creates a Client.
*
* @param array $options An array of options to pass to the createKernel class
* @param array $options An array of options to pass to the createKernel method
* @param array $server An array of server parameters
*
* @return Client A Client instance
Expand Down
6 changes: 4 additions & 2 deletions 6 src/Symfony/Bundle/SecurityBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ CHANGELOG

* Using the `security.authentication.trust_resolver.anonymous_class` and
`security.authentication.trust_resolver.rememberme_class` parameters to define
the token classes is deprecated. To use
custom tokens extend the existing `Symfony\Component\Security\Core\Authentication\Token\AnonymousToken`
the token classes is deprecated. To use custom tokens extend the existing
`Symfony\Component\Security\Core\Authentication\Token\AnonymousToken`.
or `Symfony\Component\Security\Core\Authentication\Token\RememberMeToken`.
* Added `Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\AddExpressionLanguageProvidersPass`
* Added `json_login_ldap` authentication provider to use LDAP authentication with a REST API.
* Made remember-me cookies inherit their default config from `framework.session.cookie_*`
and added an "auto" mode to their "secure" config option to make them secure on HTTPS automatically.

4.1.0
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpFoundation\Cookie;

class RememberMeFactory implements SecurityFactoryInterface
{
Expand Down Expand Up @@ -140,7 +141,11 @@ public function addConfiguration(NodeDefinition $node)
;

foreach ($this->options as $name => $value) {
if (\is_bool($value)) {
if ('secure' === $name) {
$builder->enumNode($name)->values(array(true, false, 'auto'))->defaultValue('auto' === $value ? null : $value);
} elseif ('samesite' === $name) {
$builder->enumNode($name)->values(array(null, Cookie::SAMESITE_LAX, Cookie::SAMESITE_STRICT))->defaultValue($value);
} elseif (\is_bool($value)) {
$builder->booleanNode($name)->defaultValue($value);
} else {
$builder->scalarNode($name)->defaultValue($value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bundle\SecurityBundle\DependencyInjection;

use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\RememberMeFactory;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\SecurityFactoryInterface;
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\UserProvider\UserProviderFactoryInterface;
use Symfony\Bundle\SecurityBundle\SecurityUserValueResolver;
Expand All @@ -22,6 +23,7 @@
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\DependencyInjection\Reference;
Expand All @@ -37,7 +39,7 @@
* @author Fabien Potencier <fabien@symfony.com>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class SecurityExtension extends Extension
class SecurityExtension extends Extension implements PrependExtensionInterface
{
private $requestMatchers = array();
private $expressions = array();
Expand All @@ -54,6 +56,32 @@ public function __construct()
}
}

public function prepend(ContainerBuilder $container)
{
$rememberMeSecureDefault = false;
$rememberMeSameSiteDefault = null;

if (!isset($container->getExtensions()['framework'])) {
return;
}
foreach ($container->getExtensionConfig('framework') as $config) {
if (isset($config['session'])) {
$rememberMeSecureDefault = $config['session']['cookie_secure'] ?? $rememberMeSecureDefault;
$rememberMeSameSiteDefault = array_key_exists('cookie_samesite', $config['session']) ? $config['session']['cookie_samesite'] : $rememberMeSameSiteDefault;
}
}
foreach ($this->listenerPositions as $position) {
foreach ($this->factories[$position] as $factory) {
if ($factory instanceof RememberMeFactory) {
\Closure::bind(function () use ($rememberMeSecureDefault, $rememberMeSameSiteDefault) {
$this->options['secure'] = $rememberMeSecureDefault;
$this->options['samesite'] = $rememberMeSameSiteDefault;
}, $factory, $factory)();
}
}
}
}

public function load(array $configs, ContainerBuilder $container)
{
if (!array_filter($configs)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function testSessionLessRememberMeLogout()
$cookieJar->expire(session_name());

$this->assertNotNull($cookieJar->get('REMEMBERME'));
$this->assertSame('lax', $cookieJar->get('REMEMBERME')->getSameSite());

$client->request('GET', '/logout');

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
imports:
- { resource: ./../config/framework.yml }

framework:
session:
cookie_secure: auto
cookie_samesite: lax

security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
Expand Down
3 changes: 2 additions & 1 deletion 3 src/Symfony/Bundle/SecurityBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"require-dev": {
"symfony/asset": "~3.4|~4.0",
"symfony/browser-kit": "~3.4|~4.0",
"symfony/browser-kit": "~4.2",
"symfony/console": "~3.4|~4.0",
"symfony/css-selector": "~3.4|~4.0",
"symfony/dom-crawler": "~3.4|~4.0",
Expand All @@ -48,6 +48,7 @@
"twig/twig": "~1.34|~2.4"
},
"conflict": {
"symfony/browser-kit": "<4.2",
"symfony/var-dumper": "<3.4",
"symfony/event-dispatcher": "<3.4",
"symfony/framework-bundle": "<4.2",
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Bundle/TwigBundle/TemplateIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function getIterator()
$this->templates = array_merge(
$this->templates,
$this->findTemplatesInDirectory($bundle->getPath().'/Resources/views', $name),
$this->findTemplatesInDirectory($this->rootDir.'/'.$bundle->getName().'/views', $name),
$this->findTemplatesInDirectory($this->rootDir.'/Resources/'.$bundle->getName().'/views', $name),
$this->findTemplatesInDirectory($this->defaultPath.'/bundles/'.$bundle->getName(), $name)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function testGetIterator()
sort($sorted);
$this->assertEquals(
array(
'@Bar/base.html.twig',
'@Bar/index.html.twig',
'@Bar/layout.html.twig',
'@Foo/index.html.twig',
Expand Down
6 changes: 6 additions & 0 deletions 6 src/Symfony/Bundle/WebProfilerBundle/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
WebProfilerBundle
=================

The Web profiler bundle is a **development tool** that gives detailed
information about the execution of any request.

**Never** enable it on production servers as it will lead to major security
vulnerabilities in your project.

Resources
---------

Expand Down
8 changes: 6 additions & 2 deletions 8 src/Symfony/Bundle/WebProfilerBundle/WebProfilerBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
* Bundle.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class WebProfilerBundle extends Bundle
{
public function boot()
{
if ('prod' === $this->container->getParameter('kernel.environment')) {
@trigger_error('Using WebProfilerBundle in production is not supported and puts your project at risk, disable it.', E_USER_WARNING);
}
}
}
3 changes: 2 additions & 1 deletion 3 src/Symfony/Component/BrowserKit/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ CHANGELOG
-----

* The method `Client::submit()` will have a new `$serverParameters` argument
in version 5.0, not defining it is deprecated since version 4.2
in version 5.0, not defining it is deprecated
* Added ability to read the "samesite" attribute of cookies using `Cookie::getSameSite()`

3.4.0
-----
Expand Down
14 changes: 11 additions & 3 deletions 14 src/Symfony/Component/BrowserKit/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function getMaxRedirects()
public function insulate($insulated = true)
{
if ($insulated && !class_exists('Symfony\\Component\\Process\\Process')) {
throw new \RuntimeException('Unable to isolate requests as the Symfony Process Component is not installed.');
throw new \LogicException('Unable to isolate requests as the Symfony Process Component is not installed.');
}

$this->insulated = (bool) $insulated;
Expand Down Expand Up @@ -297,7 +297,11 @@ public function click(Link $link)
*/
public function clickLink(string $linkText): Crawler
{
return $this->click($this->getCrawler()->selectLink($linkText)->link());
if (null === $this->crawler) {
throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
}

return $this->click($this->crawler->selectLink($linkText)->link());
}

/**
Expand Down Expand Up @@ -332,7 +336,11 @@ public function submit(Form $form, array $values = array()/*, array $serverParam
*/
public function submitForm(string $button, array $fieldValues = array(), string $method = 'POST', array $serverParameters = array()): Crawler
{
$buttonNode = $this->getCrawler()->selectButton($button);
if (null === $this->crawler) {
throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
}

$buttonNode = $this->crawler->selectButton($button);
$form = $buttonNode->form($fieldValues, $method);

return $this->submit($form, array(), $serverParameters);
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.