Issues (73)

Security Analysis    no request data  

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

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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.

Step/ResolveComponentVersionsStep.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * Moodle component manager.
5
 *
6
 * @author Luke Carrier <[email protected]>
7
 * @copyright 2016 Luke Carrier
8
 * @license GPL-3.0+
9
 */
10
11
namespace ComponentManager\Step;
12
13
use ComponentManager\Exception\InvalidProjectException;
14
use ComponentManager\Project\Project;
15
use ComponentManager\ResolvedComponentVersion;
16
use ComponentManager\Task\InstallTask;
17
use Psr\Log\LoggerInterface;
18
19
/**
20
 * Resolve component version specifications to available versions.
21
 */
22
class ResolveComponentVersionsStep implements Step {
23
    /**
24
     * Project.
25
     *
26
     * @var Project
27
     */
28
    protected $project;
29
30
    /**
31
     * Initialiser.
32
     *
33
     * @param Project $project
34
     */
35
    public function __construct(Project $project) {
36
        $this->project = $project;
37
    }
38
39
    /**
40
     * @inheritdoc Step
41
     *
42
     * @param InstallTask $task
43
     */
44
    public function execute($task, LoggerInterface $logger) {
45
        $componentSpecifications = $this->project->getProjectFile()->getComponentSpecifications();
46
47
        foreach ($componentSpecifications as $componentSpecification) {
48
            $packageRepository = $this->project->getPackageRepository(
49
                    $componentSpecification->getPackageRepository());
50
51
            $logger->info('Resolving component version', [
52
                'component'         => $componentSpecification->getName(),
53
                'packageRepository' => $componentSpecification->getPackageRepository(),
54
                'version'           => $componentSpecification->getVersion(),
55
            ]);
56
57
            $componentName         = $componentSpecification->getName();
58
            $componentVersion      = $componentSpecification->getVersion();
59
            $packageRepositoryName = $componentSpecification->getPackageRepository();
60
61
            $component = $packageRepository->resolveComponent(
62
                    $componentSpecification, $logger);
63
            if (!$component) {
64
                throw new InvalidProjectException(
65
                        "The component \"{$componentName}\" could not be found within repository \"{$packageRepositoryName}\"",
0 ignored issues
show
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $componentName instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
Coding Style Best Practice introduced by
As per coding-style, please use concatenation or sprintf for the variable $packageRepositoryName instead of interpolation.

It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.

// Instead of
$x = "foo $bar $baz";

// Better use either
$x = "foo " . $bar . " " . $baz;
$x = sprintf("foo %s %s", $bar, $baz);
Loading history...
This line exceeds maximum limit of 120 characters; contains 127 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
66
                        InvalidProjectException::CODE_MISSING_COMPONENT);
67
            }
68
69
            /* Note that even at this late stage, we still might not have a final
70
             * version for the component:
71
             * -> If the package repository provides us with the Moodle
72
             *    $plugin->version value, we'll be using it here.
73
             * -> If the package repository is a version control system, the version
74
             *    will contain the name of a branch or tag and will need to be
75
             *    resolved to an individual commit. */
76
            $version = $component->getVersion($componentVersion);
77
78
            $task->addResolvedComponentVersion(new ResolvedComponentVersion(
79
                    $componentSpecification, $packageRepository, $component,
80
                    $version));
81
        }
82
    }
83
}
84