Issues (15)

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/Command/CompareCommand.php (5 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
 * Copyright (c) Andreas Heigl<[email protected]>
4
 *
5
 * Permission is hereby granted, free of charge, to any person obtaining a copy
6
 * of this software and associated documentation files (the "Software"), to deal
7
 * in the Software without restriction, including without limitation the rights
8
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
 * copies of the Software, and to permit persons to whom the Software is
10
 * furnished to do so, subject to the following conditions:
11
 *
12
 * The above copyright notice and this permission notice shall be included in
13
 * all copies or substantial portions of the Software.
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
 * THE SOFTWARE.
22
 *
23
 * @author    Andreas Heigl<[email protected]>
24
 * @copyright Andreas Heigl
25
 * @license   http://www.opensource.org/licenses/mit-license.php MIT-License
26
 * @since     14.06.2016
27
 * @link      http://github.com/heiglandreas/org.heigl.junitdiff
28
 */
29
30
namespace Org_Heigl\JUnitDiff\Command;
31
32
use Org_Heigl\JUnitDiff\JUnitMerger;
33
use Org_Heigl\JUnitDiff\JUnitParser;
34
use Org_Heigl\JUnitDiff\MergeResult;
35
use Org_Heigl\JUnitDiff\Style\DiffStyle;
36
use Org_Heigl\JUnitDiff\Writer\FileSummary;
37
use Org_Heigl\JUnitDiff\Writer\Legend;
38
use Org_Heigl\JUnitDiff\Writer\Standard;
39
use Org_Heigl\JUnitDiff\Writer\Quiet;
40
use Org_Heigl\JUnitDiff\Writer\Summary;
41
use Symfony\Component\Console\Command\Command;
42
use Symfony\Component\Console\Input\InputArgument;
43
use Symfony\Component\Console\Input\InputInterface;
44
use Symfony\Component\Console\Output\Output;
45
use Symfony\Component\Console\Output\OutputInterface;
46
47
class CompareCommand extends Command
48
{
49
    protected function configure()
50
    {
51
        $this->setName('compare')
52
             ->setDescription('Compares two JUnit log files')
53
             ->setDefinition([
54
                 new InputArgument('base', InputArgument::REQUIRED, 'Base file for the comparison'),
55
                 new InputArgument('current', InputArgument::REQUIRED, 'Current file to compare against the base file')
56
             ])
57
             ->setHelp('');
58
    }
59
60
61
    protected function execute(InputInterface $input, OutputInterface $output)
62
    {
63
        $style = new DiffStyle($input, $output);
64
        $style->title($this->getApplication()->getLongVersion());
65
66
67
        $parser = new JUnitParser();
68
        $merger = new JUnitMerger(new MergeResult($style));
69
        try {
70
            $mergeResult = $merger->merge(
71
                $parser->parseFile($input->getArgument('base')),
0 ignored issues
show
It seems like $input->getArgument('base') targeting Symfony\Component\Consol...nterface::getArgument() can also be of type array<integer,string> or null; however, Org_Heigl\JUnitDiff\JUnitParser::parseFile() does only seem to accept string, maybe add an additional type check?

This check looks at variables that 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...
72
                $parser->parseFile($input->getArgument('current'))
0 ignored issues
show
It seems like $input->getArgument('current') targeting Symfony\Component\Consol...nterface::getArgument() can also be of type array<integer,string> or null; however, Org_Heigl\JUnitDiff\JUnitParser::parseFile() does only seem to accept string, maybe add an additional type check?

This check looks at variables that 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...
73
            );
74
        } catch (\Exception $e) {
75
            $style->error($e->getMessage());
76
            return;
77
        }
78
79
        if ($output->getVerbosity() >= Output::VERBOSITY_NORMAL) {
80
            $writer = new Standard($style, $output->getVerbosity());
81
            $writer->write($mergeResult);
82
        }
83
84 View Code Duplication
        if ($output->getVerbosity() >= Output::VERBOSITY_VERBOSE) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
85
            $writer = new Legend(
86
                $style,
87
                basename($input->getArgument('base')),
88
                basename($input->getArgument('current'))
89
            );
90
            $writer->write($mergeResult);
91
        }
92
93 View Code Duplication
        if ($output->getVerbosity() >= Output::VERBOSITY_QUIET) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
94
            $writer = new FileSummary(
95
                $style,
96
                basename($input->getArgument('base')),
97
                basename($input->getArgument('current'))
98
            );
99
100
            $writer->write($mergeResult);
101
        }
102
103 View Code Duplication
        if ($output->getVerbosity() >= Output::VERBOSITY_QUIET) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
104
            $writer = new Summary(
105
                $style,
106
                basename($input->getArgument('base')),
107
                basename($input->getArgument('current'))
108
            );
109
            $writer->write($mergeResult);
110
        }
111
    }
112
}
113