Issues (106)

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.

src/GitElephant/Command/DiffCommand.php (1 issue)

Labels
Severity

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
 * GitElephant - An abstraction layer for git written in PHP
5
 * Copyright (C) 2013  Matteo Giachino
6
 *
7
 * This program is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program.  If not, see [http://www.gnu.org/licenses/].
19
 */
20
21
namespace GitElephant\Command;
22
23
use GitElephant\Objects\TreeishInterface;
24
use GitElephant\Repository;
25
26
/**
27
 * Diff command generator
28
 *
29
 * @author Matteo Giachino <[email protected]>
30
 */
31
class DiffCommand extends BaseCommand
32
{
33
    public const DIFF_COMMAND = 'diff';
34
35
    /**
36
     * constructor
37
     *
38
     * @param \GitElephant\Repository $repo The repository object this command
39
     *                                      will interact with
40
     */
41 3
    public function __construct(Repository $repo = null)
42
    {
43 3
        parent::__construct($repo);
44 3
    }
45
46
    /**
47
     * build a diff command
48
     *
49
     * @param TreeishInterface      $of   the reference to diff
50
     * @param TreeishInterface|null $with the source reference to diff with $of, if not specified is the current HEAD
51
     * @param string|null                 $path the path to diff, if not specified the full repository
52
     *
53
     * @throws \RuntimeException
54
     * @return string
55
     */
56 3
    public function diff($of, $with = null, $path = null): string
57
    {
58 3
        $this->clearAll();
59 3
        $this->addCommandName(self::DIFF_COMMAND);
60
        // Instead of the first handful of characters, show the full pre- and post-image blob object names on the
61
        // "index" line when generating patch format output
62 3
        $this->addCommandArgument('--full-index');
63 3
        $this->addCommandArgument('--no-color');
64
        // Disallow external diff drivers
65 3
        $this->addCommandArgument('--no-ext-diff');
66
        // Detect renames
67 3
        $this->addCommandArgument('-M');
68 3
        $this->addCommandArgument('--dst-prefix=DST/');
69 3
        $this->addCommandArgument('--src-prefix=SRC/');
70
71 3
        $subject = '';
72
73 3
        if (is_null($with)) {
74 3
            $subject .= $of . '^..' . $of;
75
        } else {
76 1
            $subject .= $with . '..' . $of;
77
        }
78
79 3
        if (!is_null($path)) {
80 1
            if (!is_string($path)) {
81
                /** @var Object $path */
82
                $path = $path->getPath();
83
            }
84 1
            $this->addPath($path);
0 ignored issues
show
It seems like $path defined by parameter $path on line 56 can also be of type object; however, GitElephant\Command\BaseCommand::addPath() does only seem to accept string, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
85
        }
86
87 3
        $this->addCommandSubject($subject);
88
89 3
        return $this->getCommand();
90
    }
91
}
92