Skip to content

Commit

Permalink
[tainting] stub ParameterBag to provide taint information for Symfony…
Browse files Browse the repository at this point in the history
… 3/4/5.0 (#103)
  • Loading branch information
micheh authored Dec 5, 2020
1 parent 6a97204 commit 9117ebb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
12 changes: 12 additions & 0 deletions src/Stubs/5/InputBag.stubphp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ final class InputBag extends ParameterBag
* @template D of string|null
* @psalm-param D $default
* @psalm-return string|D
* @psalm-taint-source input
*/
public function get(string $key, $default = null) {}

/**
* Returns the parameters.
*
* @param string|null $key The name of the parameter to return or null to get them all
*
* @return array An array of parameters
*
* @psalm-taint-source input
*/
public function all(string $key = null) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace Symfony\Component\HttpFoundation;

final class InputBag extends ParameterBag
class ParameterBag implements \IteratorAggregate, \Countable
{
/**
* Returns a string input value by name.
* Returns a parameter by name.
*
* @param string|null $default The default value if the input key does not exist
*
* @return string|null
* @param string $key The key
* @param mixed $default The default value if the parameter key does not exist
*
* @return mixed
* @psalm-taint-source input
*/
public function get(string $key, $default = null) {}
Expand Down
2 changes: 0 additions & 2 deletions tests/acceptance/acceptance/Tainting.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Feature: Tainting
"""

Scenario Outline: One parameter of the Request's request/query/cookies is printed in the body of a Response object
Given I have the "symfony/framework-bundle" package satisfying the "^5.1"
And I have the following code
"""
class MyController
Expand All @@ -48,7 +47,6 @@ Feature: Tainting
| ->cookies |

Scenario Outline: All parameters of the Request's request/query/cookies are exported in the body of a Response object
Given I have the "symfony/framework-bundle" package satisfying the "^5.1"
And I have the following code
"""
class MyController
Expand Down

0 comments on commit 9117ebb

Please sign in to comment.