YetiForceCompany/YetiForceCRM

View on GitHub
app/Controller/Headers.php

Summary

Maintainability
A
1 hr
Test Coverage
C
71%

Function loadCsp has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadCsp()
    {
        if (\Config\Security::$generallyAllowedDomains) {
            $this->csp['default-src'] .= ' ' . implode(' ', \Config\Security::$generallyAllowedDomains);
        }
Severity: Minor
Found in app/Controller/Headers.php - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct()
    {
        $browser = \App\RequestUtil::getBrowserInfo();
        $this->headers['Expires'] = gmdate('D, d M Y H:i:s') . ' GMT';
        $this->headers['Last-Modified'] = gmdate('D, d M Y H:i:s') . ' GMT';
Severity: Minor
Found in app/Controller/Headers.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

The method loadCsp() has an NPath complexity of 256. The configured NPath complexity threshold is 200.
Open

    public function loadCsp()
    {
        if (\Config\Security::$generallyAllowedDomains) {
            $this->csp['default-src'] .= ' ' . implode(' ', \Config\Security::$generallyAllowedDomains);
        }
Severity: Minor
Found in app/Controller/Headers.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid using static access to class '\App\Config' in method 'getHeaders'.
Open

        if (\App\Config::security('cspHeaderActive')) {
Severity: Minor
Found in app/Controller/Headers.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\RequestUtil' in method '__construct'.
Open

        $browser = \App\RequestUtil::getBrowserInfo();
Severity: Minor
Found in app/Controller/Headers.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\Session' in method 'generateCspToken'.
Open

        \App\Session::set('CSP_TOKEN', hash('sha256', \App\Encryption::generatePassword(10)));
Severity: Minor
Found in app/Controller/Headers.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\Config' in method '__construct'.
Open

        if ($keys = \App\Config::security('hpkpKeysHeader')) {
Severity: Minor
Found in app/Controller/Headers.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\App\Encryption' in method 'generateCspToken'.
Open

        \App\Session::set('CSP_TOKEN', hash('sha256', \App\Encryption::generatePassword(10)));
Severity: Minor
Found in app/Controller/Headers.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid assigning values to variables in if clauses and the like (line '96', column '7').
Open

    public function __construct()
    {
        $browser = \App\RequestUtil::getBrowserInfo();
        $this->headers['Expires'] = gmdate('D, d M Y H:i:s') . ' GMT';
        $this->headers['Last-Modified'] = gmdate('D, d M Y H:i:s') . ' GMT';
Severity: Minor
Found in app/Controller/Headers.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid using static access to class '\App\Config' in method '__construct'.
Open

        if (\App\Config::security('cspHeaderActive')) {
Severity: Minor
Found in app/Controller/Headers.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Define a constant instead of duplicating this literal "img-src" 3 times.
Open

        'img-src' => '\'self\' data:',
Severity: Critical
Found in app/Controller/Headers.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "\'self\'" 3 times.
Open

        'form-action' => '\'self\'',
Severity: Critical
Found in app/Controller/Headers.php by sonar-php

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Call to method generatePassword from undeclared class \App\Encryption (Did you mean class \Tests\App\Encryption)
Open

        \App\Session::set('CSP_TOKEN', hash('sha256', \App\Encryption::generatePassword(10)));
Severity: Critical
Found in app/Controller/Headers.php by phan

Return type of getInstance() is undeclared type \self
Open

    public static function getInstance()
Severity: Minor
Found in app/Controller/Headers.php by phan

Spaces must be used to indent lines; tabs are not allowed
Open

        'style-src' => '\'self\' \'unsafe-inline\'',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return void
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /** @todo remove one addres */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'frame-src' => '\'self\' mailto: tel:',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'Access-Control-Allow-Methods' => 'GET, POST',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'Pragma' => 'no-cache',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->loadCsp();
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $key
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (headers_sent()) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            header_remove($name);
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'form-action' => '\'self\'',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Headers instance..
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var string[]
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'frame-ancestors' => '\'self\'',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'Referrer-Policy' => 'no-referrer',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'X-Xss-Protection' => '1; mode=block',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static $instance;
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Default header values.
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'X-Content-Type-Options' => 'nosniff',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Set header.
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ($this->headersToDelete as $name) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Headers to delete.
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $browser = \App\RequestUtil::getBrowserInfo();
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return;
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'img-src' => '\'self\' data:',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'connect-src' => '\'self\'',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'X-Robots-Tag' => 'none',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    ];
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Construct, loads default headers depending on the browser and environment.
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\App\Config::security('cspHeaderActive')) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if ($keys = \App\Config::security('hpkpKeysHeader')) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->headers['Public-Key-Pins'] = 'pin-sha256="' . implode('"; pin-sha256="', $keys) . '"; max-age=10000;';
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'X-Frame-Options' => 'sameorigin',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->headers['Expires'] = gmdate('D, d M Y H:i:s') . ' GMT';
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->headers['X-Ua-Compatible'] = 'IE=11,edge';
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if ($browser->https) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\Config\Security::$generallyAllowedDomains) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Default CSP header values.
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'Content-Type' => 'text/html; charset=UTF-8',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'X-Permitted-Cross-Domain-Policies' => 'none',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var string[]
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return self::$instance = new self();
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            header($value);
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $return = [];
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'default-src' => '\'self\' blob:',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function setHeader(string $key, string $value)
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return $return;
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $return[] = "$name: $value";
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function loadCsp()
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /** Default CSP img-src */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var self
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'Expect-Ct' => 'enforce; max-age=3600',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                $this->headers['Cache-Control'] = 'private, must-revalidate';
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return void
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    private const CSP_IMG = ['https://api.yetiforce.eu'];
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var string[]
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $headers = [
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'Expires' => '-',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Get headers instance.
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\App\Config::security('cspHeaderActive')) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Generate Content Security Policy token.
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        \App\Session::set('CSP_TOKEN', hash('sha256', \App\Encryption::generatePassword(10)));
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

                $this->headers['Pragma'] = 'private';
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            return self::$instance;
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->csp['frame-ancestors'] .= ' ' . implode(' ', \Config\Security::$allowedFrameDomains);
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Get CSP headers string.
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->csp['img-src'] .= ' ' . implode(' ', \Config\Security::$allowedImageDomains);
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $scp = '';
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $scp .= "$key $value; ";
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return void
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string[]
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\Config\Security::$allowedFormDomains) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $csp = [
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'script-src' => '\'self\' \'unsafe-inline\' blob:',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'Access-Control-Allow-Origin' => '*',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function __construct()
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->headers['Last-Modified'] = gmdate('D, d M Y H:i:s') . ' GMT';
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->headers['Strict-Transport-Security'] = 'max-age=31536000; includeSubDomains; preload';
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return \self
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function getInstance()
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ($this->getHeaders() as $value) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->csp['default-src'] .= ' ' . implode(' ', \Config\Security::$generallyAllowedDomains);
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $headersToDelete = ['X-Powered-By', 'Server'];
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getCspHeader(): string
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function send()
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public static function generateCspToken(): void
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Load CSP directive.
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (self::CSP_IMG) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->csp['script-src'] .= ' ' . implode(' ', \Config\Security::$allowedScriptDomains);
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->csp['form-action'] .= ' ' . implode(' ', \Config\Security::$allowedFormDomains);
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\Config\Security::$allowedFrameDomains) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\Config\Security::$allowedConnectDomains) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'font-src' => '\'self\' data:',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    ];
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if ($browser->ie) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (isset(self::$instance)) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\Config\Security::$allowedScriptDomains) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ($this->csp as $key => $value) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        return $scp;
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            if ($browser->https) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->headers[$key] = $value;
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Get headers string.
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->csp['connect-src'] .= ' ' . implode(' ', \Config\Security::$allowedConnectDomains);
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\Config\Security::$allowedDomainsLoadInFrame) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->csp['frame-src'] .= ' ' . implode(' ', \Config\Security::$allowedDomainsLoadInFrame);
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'Last-Modified' => '-',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        'Cache-Control' => 'private, no-cache, no-store, must-revalidate, post-check=0, pre-check=0',
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Line exceeds 120 characters; contains 121 characters
Open

            $this->headers['Public-Key-Pins'] = 'pin-sha256="' . implode('"; pin-sha256="', $keys) . '"; max-age=10000;';
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param string $value
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Send headers.
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->csp['img-src'] .= ' ' . implode(' ', self::CSP_IMG);
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (\Config\Security::$allowedImageDomains) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public function getHeaders(): array
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->headers['Content-Security-Policy'] = $this->getCspHeader();
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ($this->headers as $name => $value) {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in app/Controller/Headers.php by phpcodesniffer

There are no issues that match your filters.

Category
Status