Passed
Pull Request — master (#15)
by
unknown
07:32
created

HasSettings::setSettingsByRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace LaravelPropertyBag\Settings;
4
5
use LaravelPropertyBag\Helpers\NameResolver;
6
use LaravelPropertyBag\Exceptions\ResourceNotFound;
7
8
trait HasSettings
9
{
10
    /**
11
     * Instance of Settings.
12
     *
13
     * @var LaravelPropertyBag\Settings\Settings
14
     */
15
    protected $settings = null;
16
17
    /**
18
     * A resource has many settings in a property bag.
19
     *
20
     * @return \Illuminate\Database\Eloquent\Relations\MorphMany
21
     */
22
    public function propertyBag()
23
    {
24
        return $this->morphMany(PropertyBag::class, 'resource');
0 ignored issues
show
Bug introduced by
It seems like morphMany() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
25
    }
26
27
    /**
28
     * If passed is string, get settings class for the resource or return value
29
     * for given key. If passed is array, set the key value pair.
30
     *
31
     * @param string|array $passed
32
     *
33
     * @return LaravelPropertyBag\Settings\Settings|mixed
34
     */
35
    public function settings($passed = null)
36
    {
37
        if (is_array($passed)) {
38
            return $this->setSettings($passed);
39
        } elseif (!is_null($passed)) {
40
            $settings = $this->getSettingsInstance();
41
42
            return $settings->get($passed);
43
        }
44
45
        return $this->getSettingsInstance();
46
    }
47
48
    /**
49
     * Get settings off this or create new instance.
50
     *
51
     * @return LaravelPropertyBag\Settings\Settings
52
     */
53
    protected function getSettingsInstance()
54
    {
55
        if (isset($this->settings)) {
56
            return $this->settings;
57
        }
58
59
        $settingsConfig = $this->getSettingsConfig();
60
61
        return $this->settings = new Settings($settingsConfig, $this);
0 ignored issues
show
Documentation Bug introduced by
It seems like new \LaravelPropertyBag\...$settingsConfig, $this) of type object<LaravelPropertyBag\Settings\Settings> is incompatible with the declared type object<LaravelPropertyBa...yBag\Settings\Settings> of property $settings.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
62
    }
63
64
    /**
65
     * Get the settings class name.
66
     *
67
     * @throws ResourceNotFound
68
     *
69
     * @return LaravelPropertyBag\Settings\ResourceConfig
70
     */
71
    protected function getSettingsConfig()
72
    {
73
        if (isset($this->settingsConfig)) {
74
            $fullNamespace = $this->settingsConfig;
0 ignored issues
show
Bug introduced by
The property settingsConfig does not seem to exist. Did you mean settings?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
75
        } else {
76
            $className = $this->getShortClassName();
77
78
            $fullNamespace = NameResolver::makeConfigFileName($className);
79
        }
80
81
        if (class_exists($fullNamespace)) {
82
            return new $fullNamespace($this);
83
        }
84
85
        throw ResourceNotFound::resourceConfigNotFound($fullNamespace);
86
    }
87
88
    /**
89
     * Get the short name of the model.
90
     *
91
     * @return string
92
     */
93
    protected function getShortClassName()
94
    {
95
        $reflection = new \ReflectionClass($this);
96
97
        return $reflection->getShortName();
98
    }
99
100
    /**
101
     * Set settings.
102
     *
103
     * @param array $attributes
104
     *
105
     * @return LaravelPropertyBag\Settings\Settings
106
     */
107
    public function setSettings(array $attributes)
108
    {
109
        return $this->settings()->set($attributes);
110
    }
111
112
        /**
113
     * Set all allowed settings by Request.
114
     *
115
     * @return LaravelPropertyBag\Settings\Settings
116
     */
117
    public function setSettingsByRequest()
118
    {
119
        $allAllowedSettings = array_keys($this->allSettings()->toArray());
120
        return $this->settings()->set(request()->only($allAllowedSettings));
0 ignored issues
show
Security File Exposure introduced by
$allAllowedSettings can contain request data and is used in file inclusion context(s) leading to a potential security vulnerability.

9 paths for user data to reach this point

  1. Path: $this->parameters['HTTP_AUTHORIZATION'] seems to return tainted data, and $authorizationHeader is assigned in ServerBag.php on line 62
  1. $this->parameters['HTTP_AUTHORIZATION'] seems to return tainted data, and $authorizationHeader is assigned
    in vendor/ServerBag.php on line 62
  2. ParameterBag::$parameters is assigned
    in vendor/ServerBag.php on line 77
  3. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  4. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  5. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  6. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  7. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  8. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  9. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  2. Path: Read from $_POST, and $_POST is passed to Request::createRequestFromFactory() in Request.php on line 281
  1. Read from $_POST, and $_POST is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  2. $request is passed to Request::__construct()
    in vendor/Request.php on line 1963
  3. $request is passed to Request::initialize()
    in vendor/Request.php on line 222
  4. $request is passed to ParameterBag::__construct()
    in vendor/Request.php on line 240
  5. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  6. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  7. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  8. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  9. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  10. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  11. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  12. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  3. Path: Read from $_SERVER, and $server is assigned in Request.php on line 271
  1. Read from $_SERVER, and $server is assigned
    in vendor/Request.php on line 271
  2. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  3. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  4. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  5. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  6. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  7. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  8. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  9. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  10. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  11. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  12. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  13. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  4. Path: Fetching key HTTP_CONTENT_LENGTH from $_SERVER, and $server is assigned in Request.php on line 274
  1. Fetching key HTTP_CONTENT_LENGTH from $_SERVER, and $server is assigned
    in vendor/Request.php on line 274
  2. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  3. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  4. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  5. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  6. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  7. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  8. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  9. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  10. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  11. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  12. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  13. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  5. Path: Fetching key HTTP_CONTENT_TYPE from $_SERVER, and $server is assigned in Request.php on line 277
  1. Fetching key HTTP_CONTENT_TYPE from $_SERVER, and $server is assigned
    in vendor/Request.php on line 277
  2. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  3. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  4. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  5. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  6. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  7. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  8. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  9. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  10. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  11. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  12. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  13. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  6. Path: $server['HTTP_HOST'] seems to return tainted data, and $server is assigned in Request.php on line 347
  1. $server['HTTP_HOST'] seems to return tainted data, and $server is assigned
    in vendor/Request.php on line 347
  2. $server is assigned
    in vendor/Request.php on line 395
  3. $server is assigned
    in vendor/Request.php on line 396
  4. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 398
  5. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  6. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  7. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  8. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  9. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  10. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  11. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  12. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  13. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  14. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  15. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  7. Path: $this->parameters['PHP_AUTH_USER'] seems to return tainted data, and $headers is assigned in ServerBag.php on line 43
  1. $this->parameters['PHP_AUTH_USER'] seems to return tainted data, and $headers is assigned
    in vendor/ServerBag.php on line 43
  2. $headers is assigned
    in vendor/ServerBag.php on line 44
  3. ServerBag::getHeaders() returns tainted data, and $this->server->getHeaders() is passed to HeaderBag::__construct()
    in vendor/Request.php on line 246
  4. $values is assigned
    in vendor/HeaderBag.php on line 31
  5. $values is passed to HeaderBag::set()
    in vendor/HeaderBag.php on line 32
  6. (array) $values is passed through array_values(), and $values is assigned
    in vendor/HeaderBag.php on line 142
  7. HeaderBag::$headers is assigned
    in vendor/HeaderBag.php on line 145
  8. Tainted property HeaderBag::$headers is read
    in vendor/HeaderBag.php on line 125
  9. HeaderBag::get() returns tainted data, and $requestUri is assigned
    in vendor/Request.php on line 1733
  10. $requestUri is passed to ParameterBag::set()
    in vendor/Request.php on line 1764
  11. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 99
  12. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  13. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  14. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  15. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  16. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  17. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  18. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  8. Path: $this->parameters['PHP_AUTH_PW'] seems to return tainted data, and $headers is assigned in ServerBag.php on line 44
  1. $this->parameters['PHP_AUTH_PW'] seems to return tainted data, and $headers is assigned
    in vendor/ServerBag.php on line 44
  2. ServerBag::getHeaders() returns tainted data, and $this->server->getHeaders() is passed to HeaderBag::__construct()
    in vendor/Request.php on line 246
  3. $values is assigned
    in vendor/HeaderBag.php on line 31
  4. $values is passed to HeaderBag::set()
    in vendor/HeaderBag.php on line 32
  5. (array) $values is passed through array_values(), and $values is assigned
    in vendor/HeaderBag.php on line 142
  6. HeaderBag::$headers is assigned
    in vendor/HeaderBag.php on line 145
  7. Tainted property HeaderBag::$headers is read
    in vendor/HeaderBag.php on line 125
  8. HeaderBag::get() returns tainted data, and $requestUri is assigned
    in vendor/Request.php on line 1733
  9. $requestUri is passed to ParameterBag::set()
    in vendor/Request.php on line 1764
  10. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 99
  11. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  12. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  13. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  14. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  15. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  16. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  17. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  9. Path: Read from $_SERVER in src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 19
  1. Read from $_SERVER
    in vendor/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 19
  2. Data is passed through array_replace()
    in vendor/Request.php on line 324
  3. Data is passed through call_user_func()
    in vendor/Request.php on line 1954
  4. \Illuminate\Http\Request::create($app->make('config')->get('app.url', 'http://localhost'), 'GET', array(), array(), array(), $_SERVER) is passed to Container::instance()
    in vendor/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 18
  5. Container::$instances is assigned
    in vendor/src/Illuminate/Container/Container.php on line 356
  6. Tainted property Container::$instances is read
    in vendor/src/Illuminate/Container/Container.php on line 556
  7. Container::make() returns tainted data
    in vendor/src/Illuminate/Container/Container.php on line 1070
  8. Container::offsetGet() returns tainted data, and $table is assigned
    in vendor/src/Illuminate/Session/SessionManager.php on line 74
  9. $table is passed to DatabaseSessionHandler::__construct()
    in vendor/src/Illuminate/Session/SessionManager.php on line 79
  10. DatabaseSessionHandler::$table is assigned
    in vendor/src/Illuminate/Session/DatabaseSessionHandler.php on line 61
  11. Tainted property DatabaseSessionHandler::$table is read, and $this->table is passed to Connection::table()
    in vendor/src/Illuminate/Session/DatabaseSessionHandler.php on line 274
  12. $table is passed to Builder::from()
    in vendor/src/Illuminate/Database/Connection.php on line 258
  13. Builder::$from is assigned
    in vendor/src/Illuminate/Database/Query/Builder.php on line 324
  14. Tainted property Builder::$from is read, and $query->from is passed to Grammar::wrapTable()
    in vendor/src/Illuminate/Database/Query/Grammars/Grammar.php on line 772
  15. $this->tablePrefix . $table is passed to Grammar::wrap()
    in vendor/src/Illuminate/Database/Grammar.php on line 36
  16. $value is passed through explode(), and explode('.', $value) is passed to Grammar::wrapSegments()
    in vendor/src/Illuminate/Database/Grammar.php on line 62
  17. $segments is passed to collect()
    in vendor/src/Illuminate/Database/Grammar.php on line 96
  18. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  19. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  20. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  21. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119

Used in path-read context

  1. InteractsWithInput::only() uses data_get() ($key)
    in vendor/src/Illuminate/Http/Concerns/InteractsWithInput.php on line 153
  2. data_get() uses Arr::exists() ($key)
    in vendor/src/Illuminate/Support/helpers.php on line 427
  3. Arr::exists() uses Repository::offsetExists() ($key)
    in vendor/src/Illuminate/Support/Arr.php on line 120
  4. Repository::offsetExists() uses Repository::has() ($key)
    in vendor/src/Illuminate/Cache/Repository.php on line 444
  5. Repository::has() uses Repository::get() ($key)
    in vendor/src/Illuminate/Cache/Repository.php on line 65
  6. Repository::get() uses FileStore::get() ($key)
    in vendor/src/Illuminate/Cache/Repository.php on line 83
  7. FileStore::get() uses FileStore::getPayload() ($key)
    in vendor/src/Illuminate/Cache/FileStore.php on line 50
  8. FileStore::getPayload() uses Filesystem::get() ($path)
    in vendor/src/Illuminate/Cache/FileStore.php on line 173
  9. Filesystem::get() uses file_get_contents() ($filename)
    in vendor/src/Illuminate/Filesystem/Filesystem.php on line 38

General Strategies to prevent injection

In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:

if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) {
    throw new \InvalidArgumentException('This input is not allowed.');
}

For numeric data, we recommend to explicitly cast the data:

$sanitized = (integer) $tainted;
Loading history...
Security File Manipulation introduced by
$allAllowedSettings can contain request data and is used in file manipulation context(s) leading to a potential security vulnerability.

9 paths for user data to reach this point

  1. Path: $this->parameters['HTTP_AUTHORIZATION'] seems to return tainted data, and $authorizationHeader is assigned in ServerBag.php on line 62
  1. $this->parameters['HTTP_AUTHORIZATION'] seems to return tainted data, and $authorizationHeader is assigned
    in vendor/ServerBag.php on line 62
  2. ParameterBag::$parameters is assigned
    in vendor/ServerBag.php on line 77
  3. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  4. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  5. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  6. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  7. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  8. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  9. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  2. Path: Read from $_POST, and $_POST is passed to Request::createRequestFromFactory() in Request.php on line 281
  1. Read from $_POST, and $_POST is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  2. $request is passed to Request::__construct()
    in vendor/Request.php on line 1963
  3. $request is passed to Request::initialize()
    in vendor/Request.php on line 222
  4. $request is passed to ParameterBag::__construct()
    in vendor/Request.php on line 240
  5. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  6. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  7. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  8. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  9. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  10. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  11. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  12. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  3. Path: Read from $_SERVER, and $server is assigned in Request.php on line 271
  1. Read from $_SERVER, and $server is assigned
    in vendor/Request.php on line 271
  2. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  3. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  4. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  5. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  6. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  7. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  8. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  9. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  10. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  11. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  12. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  13. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  4. Path: Fetching key HTTP_CONTENT_LENGTH from $_SERVER, and $server is assigned in Request.php on line 274
  1. Fetching key HTTP_CONTENT_LENGTH from $_SERVER, and $server is assigned
    in vendor/Request.php on line 274
  2. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  3. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  4. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  5. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  6. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  7. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  8. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  9. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  10. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  11. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  12. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  13. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  5. Path: Fetching key HTTP_CONTENT_TYPE from $_SERVER, and $server is assigned in Request.php on line 277
  1. Fetching key HTTP_CONTENT_TYPE from $_SERVER, and $server is assigned
    in vendor/Request.php on line 277
  2. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  3. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  4. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  5. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  6. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  7. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  8. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  9. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  10. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  11. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  12. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  13. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  6. Path: $server['HTTP_HOST'] seems to return tainted data, and $server is assigned in Request.php on line 347
  1. $server['HTTP_HOST'] seems to return tainted data, and $server is assigned
    in vendor/Request.php on line 347
  2. $server is assigned
    in vendor/Request.php on line 395
  3. $server is assigned
    in vendor/Request.php on line 396
  4. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 398
  5. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  6. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  7. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  8. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  9. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  10. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  11. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  12. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  13. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  14. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  15. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  7. Path: $this->parameters['PHP_AUTH_USER'] seems to return tainted data, and $headers is assigned in ServerBag.php on line 43
  1. $this->parameters['PHP_AUTH_USER'] seems to return tainted data, and $headers is assigned
    in vendor/ServerBag.php on line 43
  2. $headers is assigned
    in vendor/ServerBag.php on line 44
  3. ServerBag::getHeaders() returns tainted data, and $this->server->getHeaders() is passed to HeaderBag::__construct()
    in vendor/Request.php on line 246
  4. $values is assigned
    in vendor/HeaderBag.php on line 31
  5. $values is passed to HeaderBag::set()
    in vendor/HeaderBag.php on line 32
  6. (array) $values is passed through array_values(), and $values is assigned
    in vendor/HeaderBag.php on line 142
  7. HeaderBag::$headers is assigned
    in vendor/HeaderBag.php on line 145
  8. Tainted property HeaderBag::$headers is read
    in vendor/HeaderBag.php on line 125
  9. HeaderBag::get() returns tainted data, and $requestUri is assigned
    in vendor/Request.php on line 1733
  10. $requestUri is passed to ParameterBag::set()
    in vendor/Request.php on line 1764
  11. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 99
  12. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  13. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  14. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  15. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  16. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  17. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  18. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  8. Path: $this->parameters['PHP_AUTH_PW'] seems to return tainted data, and $headers is assigned in ServerBag.php on line 44
  1. $this->parameters['PHP_AUTH_PW'] seems to return tainted data, and $headers is assigned
    in vendor/ServerBag.php on line 44
  2. ServerBag::getHeaders() returns tainted data, and $this->server->getHeaders() is passed to HeaderBag::__construct()
    in vendor/Request.php on line 246
  3. $values is assigned
    in vendor/HeaderBag.php on line 31
  4. $values is passed to HeaderBag::set()
    in vendor/HeaderBag.php on line 32
  5. (array) $values is passed through array_values(), and $values is assigned
    in vendor/HeaderBag.php on line 142
  6. HeaderBag::$headers is assigned
    in vendor/HeaderBag.php on line 145
  7. Tainted property HeaderBag::$headers is read
    in vendor/HeaderBag.php on line 125
  8. HeaderBag::get() returns tainted data, and $requestUri is assigned
    in vendor/Request.php on line 1733
  9. $requestUri is passed to ParameterBag::set()
    in vendor/Request.php on line 1764
  10. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 99
  11. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  12. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  13. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  14. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  15. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  16. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  17. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  9. Path: Read from $_SERVER in src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 19
  1. Read from $_SERVER
    in vendor/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 19
  2. Data is passed through array_replace()
    in vendor/Request.php on line 324
  3. Data is passed through call_user_func()
    in vendor/Request.php on line 1954
  4. \Illuminate\Http\Request::create($app->make('config')->get('app.url', 'http://localhost'), 'GET', array(), array(), array(), $_SERVER) is passed to Container::instance()
    in vendor/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 18
  5. Container::$instances is assigned
    in vendor/src/Illuminate/Container/Container.php on line 356
  6. Tainted property Container::$instances is read
    in vendor/src/Illuminate/Container/Container.php on line 556
  7. Container::make() returns tainted data
    in vendor/src/Illuminate/Container/Container.php on line 1070
  8. Container::offsetGet() returns tainted data, and $table is assigned
    in vendor/src/Illuminate/Session/SessionManager.php on line 74
  9. $table is passed to DatabaseSessionHandler::__construct()
    in vendor/src/Illuminate/Session/SessionManager.php on line 79
  10. DatabaseSessionHandler::$table is assigned
    in vendor/src/Illuminate/Session/DatabaseSessionHandler.php on line 61
  11. Tainted property DatabaseSessionHandler::$table is read, and $this->table is passed to Connection::table()
    in vendor/src/Illuminate/Session/DatabaseSessionHandler.php on line 274
  12. $table is passed to Builder::from()
    in vendor/src/Illuminate/Database/Connection.php on line 258
  13. Builder::$from is assigned
    in vendor/src/Illuminate/Database/Query/Builder.php on line 324
  14. Tainted property Builder::$from is read, and $query->from is passed to Grammar::wrapTable()
    in vendor/src/Illuminate/Database/Query/Grammars/Grammar.php on line 772
  15. $this->tablePrefix . $table is passed to Grammar::wrap()
    in vendor/src/Illuminate/Database/Grammar.php on line 36
  16. $value is passed through explode(), and explode('.', $value) is passed to Grammar::wrapSegments()
    in vendor/src/Illuminate/Database/Grammar.php on line 62
  17. $segments is passed to collect()
    in vendor/src/Illuminate/Database/Grammar.php on line 96
  18. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  19. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  20. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  21. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119

Used in path-write context

  1. InteractsWithInput::only() uses data_get() ($key)
    in vendor/src/Illuminate/Http/Concerns/InteractsWithInput.php on line 153
  2. data_get() uses Arr::exists() ($key)
    in vendor/src/Illuminate/Support/helpers.php on line 427
  3. Arr::exists() uses Repository::offsetExists() ($key)
    in vendor/src/Illuminate/Support/Arr.php on line 120
  4. Repository::offsetExists() uses Repository::has() ($key)
    in vendor/src/Illuminate/Cache/Repository.php on line 444
  5. Repository::has() uses Repository::get() ($key)
    in vendor/src/Illuminate/Cache/Repository.php on line 65
  6. Repository::get() uses FileStore::get() ($key)
    in vendor/src/Illuminate/Cache/Repository.php on line 83
  7. FileStore::get() uses FileStore::getPayload() ($key)
    in vendor/src/Illuminate/Cache/FileStore.php on line 50
  8. FileStore::getPayload() uses FileStore::forget() ($key)
    in vendor/src/Illuminate/Cache/FileStore.php on line 183
  9. FileStore::forget() uses Filesystem::delete() ($paths)
    in vendor/src/Illuminate/Cache/FileStore.php on line 132
  10. Filesystem::delete() uses unlink() ($filename)
    in vendor/src/Illuminate/Filesystem/Filesystem.php on line 172

General Strategies to prevent injection

In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:

if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) {
    throw new \InvalidArgumentException('This input is not allowed.');
}

For numeric data, we recommend to explicitly cast the data:

$sanitized = (integer) $tainted;
Loading history...
Security Object Injection introduced by
$allAllowedSettings can contain request data and is used in unserialized context(s) leading to a potential security vulnerability.

9 paths for user data to reach this point

  1. Path: $this->parameters['HTTP_AUTHORIZATION'] seems to return tainted data, and $authorizationHeader is assigned in ServerBag.php on line 62
  1. $this->parameters['HTTP_AUTHORIZATION'] seems to return tainted data, and $authorizationHeader is assigned
    in vendor/ServerBag.php on line 62
  2. ParameterBag::$parameters is assigned
    in vendor/ServerBag.php on line 77
  3. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  4. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  5. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  6. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  7. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  8. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  9. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  2. Path: Read from $_POST, and $_POST is passed to Request::createRequestFromFactory() in Request.php on line 281
  1. Read from $_POST, and $_POST is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  2. $request is passed to Request::__construct()
    in vendor/Request.php on line 1963
  3. $request is passed to Request::initialize()
    in vendor/Request.php on line 222
  4. $request is passed to ParameterBag::__construct()
    in vendor/Request.php on line 240
  5. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  6. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  7. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  8. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  9. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  10. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  11. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  12. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  3. Path: Read from $_SERVER, and $server is assigned in Request.php on line 271
  1. Read from $_SERVER, and $server is assigned
    in vendor/Request.php on line 271
  2. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  3. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  4. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  5. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  6. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  7. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  8. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  9. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  10. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  11. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  12. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  13. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  4. Path: Fetching key HTTP_CONTENT_LENGTH from $_SERVER, and $server is assigned in Request.php on line 274
  1. Fetching key HTTP_CONTENT_LENGTH from $_SERVER, and $server is assigned
    in vendor/Request.php on line 274
  2. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  3. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  4. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  5. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  6. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  7. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  8. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  9. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  10. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  11. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  12. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  13. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  5. Path: Fetching key HTTP_CONTENT_TYPE from $_SERVER, and $server is assigned in Request.php on line 277
  1. Fetching key HTTP_CONTENT_TYPE from $_SERVER, and $server is assigned
    in vendor/Request.php on line 277
  2. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  3. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  4. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  5. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  6. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  7. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  8. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  9. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  10. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  11. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  12. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  13. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  6. Path: $server['HTTP_HOST'] seems to return tainted data, and $server is assigned in Request.php on line 347
  1. $server['HTTP_HOST'] seems to return tainted data, and $server is assigned
    in vendor/Request.php on line 347
  2. $server is assigned
    in vendor/Request.php on line 395
  3. $server is assigned
    in vendor/Request.php on line 396
  4. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 398
  5. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  6. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  7. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  8. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  9. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  10. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  11. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  12. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  13. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  14. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  15. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  7. Path: $this->parameters['PHP_AUTH_USER'] seems to return tainted data, and $headers is assigned in ServerBag.php on line 43
  1. $this->parameters['PHP_AUTH_USER'] seems to return tainted data, and $headers is assigned
    in vendor/ServerBag.php on line 43
  2. $headers is assigned
    in vendor/ServerBag.php on line 44
  3. ServerBag::getHeaders() returns tainted data, and $this->server->getHeaders() is passed to HeaderBag::__construct()
    in vendor/Request.php on line 246
  4. $values is assigned
    in vendor/HeaderBag.php on line 31
  5. $values is passed to HeaderBag::set()
    in vendor/HeaderBag.php on line 32
  6. (array) $values is passed through array_values(), and $values is assigned
    in vendor/HeaderBag.php on line 142
  7. HeaderBag::$headers is assigned
    in vendor/HeaderBag.php on line 145
  8. Tainted property HeaderBag::$headers is read
    in vendor/HeaderBag.php on line 125
  9. HeaderBag::get() returns tainted data, and $requestUri is assigned
    in vendor/Request.php on line 1733
  10. $requestUri is passed to ParameterBag::set()
    in vendor/Request.php on line 1764
  11. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 99
  12. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  13. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  14. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  15. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  16. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  17. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  18. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  8. Path: $this->parameters['PHP_AUTH_PW'] seems to return tainted data, and $headers is assigned in ServerBag.php on line 44
  1. $this->parameters['PHP_AUTH_PW'] seems to return tainted data, and $headers is assigned
    in vendor/ServerBag.php on line 44
  2. ServerBag::getHeaders() returns tainted data, and $this->server->getHeaders() is passed to HeaderBag::__construct()
    in vendor/Request.php on line 246
  3. $values is assigned
    in vendor/HeaderBag.php on line 31
  4. $values is passed to HeaderBag::set()
    in vendor/HeaderBag.php on line 32
  5. (array) $values is passed through array_values(), and $values is assigned
    in vendor/HeaderBag.php on line 142
  6. HeaderBag::$headers is assigned
    in vendor/HeaderBag.php on line 145
  7. Tainted property HeaderBag::$headers is read
    in vendor/HeaderBag.php on line 125
  8. HeaderBag::get() returns tainted data, and $requestUri is assigned
    in vendor/Request.php on line 1733
  9. $requestUri is passed to ParameterBag::set()
    in vendor/Request.php on line 1764
  10. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 99
  11. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  12. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  13. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  14. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  15. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  16. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  17. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  9. Path: Read from $_SERVER in src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 19
  1. Read from $_SERVER
    in vendor/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 19
  2. Data is passed through array_replace()
    in vendor/Request.php on line 324
  3. Data is passed through call_user_func()
    in vendor/Request.php on line 1954
  4. \Illuminate\Http\Request::create($app->make('config')->get('app.url', 'http://localhost'), 'GET', array(), array(), array(), $_SERVER) is passed to Container::instance()
    in vendor/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 18
  5. Container::$instances is assigned
    in vendor/src/Illuminate/Container/Container.php on line 356
  6. Tainted property Container::$instances is read
    in vendor/src/Illuminate/Container/Container.php on line 556
  7. Container::make() returns tainted data
    in vendor/src/Illuminate/Container/Container.php on line 1070
  8. Container::offsetGet() returns tainted data, and $table is assigned
    in vendor/src/Illuminate/Session/SessionManager.php on line 74
  9. $table is passed to DatabaseSessionHandler::__construct()
    in vendor/src/Illuminate/Session/SessionManager.php on line 79
  10. DatabaseSessionHandler::$table is assigned
    in vendor/src/Illuminate/Session/DatabaseSessionHandler.php on line 61
  11. Tainted property DatabaseSessionHandler::$table is read, and $this->table is passed to Connection::table()
    in vendor/src/Illuminate/Session/DatabaseSessionHandler.php on line 274
  12. $table is passed to Builder::from()
    in vendor/src/Illuminate/Database/Connection.php on line 258
  13. Builder::$from is assigned
    in vendor/src/Illuminate/Database/Query/Builder.php on line 324
  14. Tainted property Builder::$from is read, and $query->from is passed to Grammar::wrapTable()
    in vendor/src/Illuminate/Database/Query/Grammars/Grammar.php on line 772
  15. $this->tablePrefix . $table is passed to Grammar::wrap()
    in vendor/src/Illuminate/Database/Grammar.php on line 36
  16. $value is passed through explode(), and explode('.', $value) is passed to Grammar::wrapSegments()
    in vendor/src/Illuminate/Database/Grammar.php on line 62
  17. $segments is passed to collect()
    in vendor/src/Illuminate/Database/Grammar.php on line 96
  18. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  19. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  20. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  21. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119

Used in unserialized context

  1. InteractsWithInput::only() uses data_get() ($key)
    in vendor/src/Illuminate/Http/Concerns/InteractsWithInput.php on line 153
  2. data_get() uses Arr::exists() ($key)
    in vendor/src/Illuminate/Support/helpers.php on line 427
  3. Arr::exists() uses Repository::offsetExists() ($key)
    in vendor/src/Illuminate/Support/Arr.php on line 120
  4. Repository::offsetExists() uses Repository::has() ($key)
    in vendor/src/Illuminate/Cache/Repository.php on line 444
  5. Repository::has() uses Repository::get() ($key)
    in vendor/src/Illuminate/Cache/Repository.php on line 65
  6. Repository::get() uses FileStore::get() ($key)
    in vendor/src/Illuminate/Cache/Repository.php on line 83
  7. FileStore::get() uses FileStore::getPayload() ($key)
    in vendor/src/Illuminate/Cache/FileStore.php on line 50
  8. FileStore::getPayload() uses unserialize() ($str)
    in vendor/src/Illuminate/Cache/FileStore.php on line 188

Preventing Object Injection Attacks

If you pass raw user-data to unserialize() for example, this can be used to create an object of any class that is available in your local filesystem. For an attacker, classes that have magic methods like __destruct or __wakeup are particularly interesting in such a case, as they can be exploited very easily.

We recommend to not pass user data to such a function. In case of unserialize, better use JSON to transfer data.

General Strategies to prevent injection

In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:

if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) {
    throw new \InvalidArgumentException('This input is not allowed.');
}

For numeric data, we recommend to explicitly cast the data:

$sanitized = (integer) $tainted;
Loading history...
Security Code Execution introduced by
$allAllowedSettings can contain request data and is used in code execution context(s) leading to a potential security vulnerability.

9 paths for user data to reach this point

  1. Path: $this->parameters['HTTP_AUTHORIZATION'] seems to return tainted data, and $authorizationHeader is assigned in ServerBag.php on line 62
  1. $this->parameters['HTTP_AUTHORIZATION'] seems to return tainted data, and $authorizationHeader is assigned
    in vendor/ServerBag.php on line 62
  2. ParameterBag::$parameters is assigned
    in vendor/ServerBag.php on line 77
  3. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  4. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  5. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  6. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  7. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  8. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  9. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  2. Path: Read from $_POST, and $_POST is passed to Request::createRequestFromFactory() in Request.php on line 281
  1. Read from $_POST, and $_POST is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  2. $request is passed to Request::__construct()
    in vendor/Request.php on line 1963
  3. $request is passed to Request::initialize()
    in vendor/Request.php on line 222
  4. $request is passed to ParameterBag::__construct()
    in vendor/Request.php on line 240
  5. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  6. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  7. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  8. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  9. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  10. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  11. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  12. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  3. Path: Read from $_SERVER, and $server is assigned in Request.php on line 271
  1. Read from $_SERVER, and $server is assigned
    in vendor/Request.php on line 271
  2. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  3. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  4. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  5. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  6. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  7. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  8. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  9. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  10. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  11. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  12. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  13. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  4. Path: Fetching key HTTP_CONTENT_LENGTH from $_SERVER, and $server is assigned in Request.php on line 274
  1. Fetching key HTTP_CONTENT_LENGTH from $_SERVER, and $server is assigned
    in vendor/Request.php on line 274
  2. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  3. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  4. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  5. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  6. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  7. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  8. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  9. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  10. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  11. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  12. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  13. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  5. Path: Fetching key HTTP_CONTENT_TYPE from $_SERVER, and $server is assigned in Request.php on line 277
  1. Fetching key HTTP_CONTENT_TYPE from $_SERVER, and $server is assigned
    in vendor/Request.php on line 277
  2. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 281
  3. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  4. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  5. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  6. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  7. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  8. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  9. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  10. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  11. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  12. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  13. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  6. Path: $server['HTTP_HOST'] seems to return tainted data, and $server is assigned in Request.php on line 347
  1. $server['HTTP_HOST'] seems to return tainted data, and $server is assigned
    in vendor/Request.php on line 347
  2. $server is assigned
    in vendor/Request.php on line 395
  3. $server is assigned
    in vendor/Request.php on line 396
  4. $server is passed to Request::createRequestFromFactory()
    in vendor/Request.php on line 398
  5. $server is passed to Request::__construct()
    in vendor/Request.php on line 1963
  6. $server is passed to Request::initialize()
    in vendor/Request.php on line 222
  7. $server is passed to ParameterBag::__construct()
    in vendor/Request.php on line 245
  8. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 35
  9. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  10. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  11. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  12. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  13. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  14. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  15. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  7. Path: $this->parameters['PHP_AUTH_USER'] seems to return tainted data, and $headers is assigned in ServerBag.php on line 43
  1. $this->parameters['PHP_AUTH_USER'] seems to return tainted data, and $headers is assigned
    in vendor/ServerBag.php on line 43
  2. $headers is assigned
    in vendor/ServerBag.php on line 44
  3. ServerBag::getHeaders() returns tainted data, and $this->server->getHeaders() is passed to HeaderBag::__construct()
    in vendor/Request.php on line 246
  4. $values is assigned
    in vendor/HeaderBag.php on line 31
  5. $values is passed to HeaderBag::set()
    in vendor/HeaderBag.php on line 32
  6. (array) $values is passed through array_values(), and $values is assigned
    in vendor/HeaderBag.php on line 142
  7. HeaderBag::$headers is assigned
    in vendor/HeaderBag.php on line 145
  8. Tainted property HeaderBag::$headers is read
    in vendor/HeaderBag.php on line 125
  9. HeaderBag::get() returns tainted data, and $requestUri is assigned
    in vendor/Request.php on line 1733
  10. $requestUri is passed to ParameterBag::set()
    in vendor/Request.php on line 1764
  11. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 99
  12. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  13. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  14. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  15. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  16. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  17. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  18. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  8. Path: $this->parameters['PHP_AUTH_PW'] seems to return tainted data, and $headers is assigned in ServerBag.php on line 44
  1. $this->parameters['PHP_AUTH_PW'] seems to return tainted data, and $headers is assigned
    in vendor/ServerBag.php on line 44
  2. ServerBag::getHeaders() returns tainted data, and $this->server->getHeaders() is passed to HeaderBag::__construct()
    in vendor/Request.php on line 246
  3. $values is assigned
    in vendor/HeaderBag.php on line 31
  4. $values is passed to HeaderBag::set()
    in vendor/HeaderBag.php on line 32
  5. (array) $values is passed through array_values(), and $values is assigned
    in vendor/HeaderBag.php on line 142
  6. HeaderBag::$headers is assigned
    in vendor/HeaderBag.php on line 145
  7. Tainted property HeaderBag::$headers is read
    in vendor/HeaderBag.php on line 125
  8. HeaderBag::get() returns tainted data, and $requestUri is assigned
    in vendor/Request.php on line 1733
  9. $requestUri is passed to ParameterBag::set()
    in vendor/Request.php on line 1764
  10. ParameterBag::$parameters is assigned
    in vendor/ParameterBag.php on line 99
  11. Tainted property ParameterBag::$parameters is read
    in vendor/ParameterBag.php on line 45
  12. ParameterBag::all() returns tainted data, and $bag->all() is passed to TransformsRequest::cleanArray()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 58
  13. $data is passed to collect()
    in vendor/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php on line 69
  14. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  15. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  16. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  17. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119
  9. Path: Read from $_SERVER in src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 19
  1. Read from $_SERVER
    in vendor/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 19
  2. Data is passed through array_replace()
    in vendor/Request.php on line 324
  3. Data is passed through call_user_func()
    in vendor/Request.php on line 1954
  4. \Illuminate\Http\Request::create($app->make('config')->get('app.url', 'http://localhost'), 'GET', array(), array(), array(), $_SERVER) is passed to Container::instance()
    in vendor/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 18
  5. Container::$instances is assigned
    in vendor/src/Illuminate/Container/Container.php on line 356
  6. Tainted property Container::$instances is read
    in vendor/src/Illuminate/Container/Container.php on line 556
  7. Container::make() returns tainted data
    in vendor/src/Illuminate/Container/Container.php on line 1070
  8. Container::offsetGet() returns tainted data, and $table is assigned
    in vendor/src/Illuminate/Session/SessionManager.php on line 74
  9. $table is passed to DatabaseSessionHandler::__construct()
    in vendor/src/Illuminate/Session/SessionManager.php on line 79
  10. DatabaseSessionHandler::$table is assigned
    in vendor/src/Illuminate/Session/DatabaseSessionHandler.php on line 61
  11. Tainted property DatabaseSessionHandler::$table is read, and $this->table is passed to Connection::table()
    in vendor/src/Illuminate/Session/DatabaseSessionHandler.php on line 274
  12. $table is passed to Builder::from()
    in vendor/src/Illuminate/Database/Connection.php on line 258
  13. Builder::$from is assigned
    in vendor/src/Illuminate/Database/Query/Builder.php on line 324
  14. Tainted property Builder::$from is read, and $query->from is passed to Grammar::wrapTable()
    in vendor/src/Illuminate/Database/Query/Grammars/Grammar.php on line 772
  15. $this->tablePrefix . $table is passed to Grammar::wrap()
    in vendor/src/Illuminate/Database/Grammar.php on line 36
  16. $value is passed through explode(), and explode('.', $value) is passed to Grammar::wrapSegments()
    in vendor/src/Illuminate/Database/Grammar.php on line 62
  17. $segments is passed to collect()
    in vendor/src/Illuminate/Database/Grammar.php on line 96
  18. $value is passed to Collection::__construct()
    in vendor/src/Illuminate/Support/helpers.php on line 378
  19. Collection::$items is assigned
    in vendor/src/Illuminate/Support/Collection.php on line 47
  20. Tainted property Collection::$items is read, and $this->items is passed through array_map()
    in vendor/src/Illuminate/Support/Collection.php on line 1285
  21. Collection::toArray() returns tainted data, and $this->allSettings()->toArray() is passed through array_keys(), and $allAllowedSettings is assigned
    in src/Settings/HasSettings.php on line 119

Used in code-execution context

  1. InteractsWithInput::only() uses data_get() ($key)
    in vendor/src/Illuminate/Http/Concerns/InteractsWithInput.php on line 153
  2. data_get() uses Arr::exists() ($key)
    in vendor/src/Illuminate/Support/helpers.php on line 427
  3. Arr::exists() uses Model::offsetExists() ($offset)
    in vendor/src/Illuminate/Support/Arr.php on line 120
  4. Model::offsetExists() uses Model::__get() ($key)
    in vendor/src/Illuminate/Database/Eloquent/Model.php on line 1244
  5. Model::__get() uses HasAttributes::getAttribute() ($key)
    in vendor/src/Illuminate/Database/Eloquent/Model.php on line 1221
  6. HasAttributes::getAttribute() uses HasAttributes::getRelationValue() ($key)
    in vendor/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php on line 315
  7. HasAttributes::getRelationValue() uses HasAttributes::getRelationshipFromMethod() ($method)
    in vendor/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php on line 385
  8. HasAttributes::getRelationshipFromMethod() uses dynamic method call
    in vendor/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php on line 399

General Strategies to prevent injection

In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:

if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) {
    throw new \InvalidArgumentException('This input is not allowed.');
}

For numeric data, we recommend to explicitly cast the data:

$sanitized = (integer) $tainted;
Loading history...
121
    }
122
123
    /**
124
     * Get all settings.
125
     *
126
     * @return \Illuminate\Support\Collection
127
     */
128
    public function allSettings()
129
    {
130
        return $this->settings()->all();
131
    }
132
133
    /**
134
     * Get all default settings or default setting for single key if given.
135
     *
136
     * @param string $key
137
     *
138
     * @return \Illuminate\Support\Collection|mixed
139
     */
140
    public function defaultSetting($key = null)
141
    {
142
        if (!is_null($key)) {
143
            return $this->settings()->getDefault($key);
144
        }
145
146
        return $this->settings()->allDefaults();
147
    }
148
149
    /**
150
     * Get all allowed settings or allowed settings for single ke if given.
151
     *
152
     * @param string $key
153
     *
154
     * @return \Illuminate\Support\Collection
155
     */
156
    public function allowedSetting($key = null)
157
    {
158
        if (!is_null($key)) {
159
            return $this->settings()->getAllowed($key);
160
        }
161
162
        return $this->settings()->allAllowed();
163
    }
164
}
165