Issues (102)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

actions/RefreshAction.php (4 issues)

1
<?php
2
3
namespace yrc\actions;
4
5
use common\models\RefreshToken;
0 ignored issues
show
The type common\models\RefreshToken was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use yrc\rest\Action as RestAction;
7
use yii\helpers\ArrayHelper;
8
use yii\web\HttpException;
9
use Yii;
10
11
/**
12
 * Handles token refresh
13
 * @class RefreshAction
14
 */
15
class RefreshAction extends RestAction
16
{
17
    public $extraAttributes = [];
18
19
    public $identityAttributes = [];
20
21
    /**
22
     * Refreshes the user's token
23
     * @return bool
24
     */
25
    public function post($params)
0 ignored issues
show
The parameter $params is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

25
    public function post(/** @scrutinizer ignore-unused */ $params)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
    {
27
        $refreshToken = Yii::$app->request->post('refresh_token', false);
28
        $model = RefreshToken::find()->where([
29
            'user_id' => Yii::$app->user->id,
30
            'token' => $refreshToken
31
        ])->one();
32
33
        if ($model === null) {
34
            throw new HttpException(401, Yii::t('yrc', 'The refresh token provided is either not valid, or has expired.'));
35
        }
36
37
        // If we can delete the token, send a newly generated token out
38
        if ($model->delete()) {
39
            // Merge any extra attributes with the generated tokens
40
            $tokenClass = (Yii::$app->user->identityClass::TOKEN_CLASS);
41
            $tokens = ArrayHelper::merge($this->extraAttributes, $tokenClass::generate(Yii::$app->user->id)->getAuthResponse());
42
            // Merge the identity attributes
43
            foreach ($this->identityAttributes as $attr) {
44
                $tokens[$attr] = Yii::$app->user->getIdentity()->$attr;
0 ignored issues
show
The method getIdentity() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
                $tokens[$attr] = Yii::$app->user->/** @scrutinizer ignore-call */ getIdentity()->$attr;

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
45
            }
46
            return $tokens;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $tokens returns the type array which is incompatible with the documented return type boolean.
Loading history...
47
        }
48
49
        throw new HttpException(400, Yii::t('yrc', 'An unexpected error occurred. Please re-authenticate.'));
50
    }
51
}
52