Skip to content

Commit 9117ebb

Browse files
authored
[tainting] stub ParameterBag to provide taint information for Symfony 3/4/5.0 (#103)
1 parent 6a97204 commit 9117ebb

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

src/Stubs/5/InputBag.stubphp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ final class InputBag extends ParameterBag
1010
* @template D of string|null
1111
* @psalm-param D $default
1212
* @psalm-return string|D
13+
* @psalm-taint-source input
1314
*/
1415
public function get(string $key, $default = null) {}
16+
17+
/**
18+
* Returns the parameters.
19+
*
20+
* @param string|null $key The name of the parameter to return or null to get them all
21+
*
22+
* @return array An array of parameters
23+
*
24+
* @psalm-taint-source input
25+
*/
26+
public function all(string $key = null) {}
1527
}

src/Stubs/common/InputBag.stubphp renamed to src/Stubs/common/ParameterBag.stubphp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
namespace Symfony\Component\HttpFoundation;
44

5-
final class InputBag extends ParameterBag
5+
class ParameterBag implements \IteratorAggregate, \Countable
66
{
77
/**
8-
* Returns a string input value by name.
8+
* Returns a parameter by name.
99
*
10-
* @param string|null $default The default value if the input key does not exist
11-
*
12-
* @return string|null
10+
* @param string $key The key
11+
* @param mixed $default The default value if the parameter key does not exist
1312
*
13+
* @return mixed
1414
* @psalm-taint-source input
1515
*/
1616
public function get(string $key, $default = null) {}

tests/acceptance/acceptance/Tainting.feature

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ Feature: Tainting
2424
"""
2525

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

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

0 commit comments

Comments
 (0)