GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (27)

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/Commands/StatusCommand.php (1 issue)

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
 * @package: chapi
4
 *
5
 * @author:  msiebeneicher
6
 * @since:   2015-07-28
7
 *
8
 */
9
10
namespace Chapi\Commands;
11
12
use Chapi\BusinessCase\Comparison\JobComparisonInterface;
13
use Chapi\Service\JobIndex\JobIndexServiceInterface;
14
use Symfony\Component\Console\Input\InputInterface;
15
use Symfony\Component\Console\Input\InputOption;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
class StatusCommand extends AbstractCommand
19
{
20
    const LABEL_CHRONOS  = 'chronos';
21
    const LABEL_MARATHON = 'marathon';
22
23
    /** @var JobIndexServiceInterface  */
24
    private $jobIndexService;
25
26
    /**
27
     * Configures the current command.
28
     */
29
    protected function configure()
30
    {
31
        $this->setName('status')
32
            ->setDescription('Show the working tree status')
33
            ->addOption(
34
                'strict',
35
                null,
36
                InputOption::VALUE_NONE,
37
                "Return a non-zero exit code when there are changes",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal Return a non-zero exit code when there are changes does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
38
                null
39
            );
40
    }
41
42
    /**
43
     * @inheritdoc
44
     */
45
    protected function initialize(InputInterface $input, OutputInterface $output)
46
    {
47
        parent::initialize($input, $output);
48
49
        $this->jobIndexService = $this->getContainer()->get(JobIndexServiceInterface::DIC_NAME);
50
    }
51
52
    /**
53
     * @return int
54
     */
55
    protected function process()
56
    {
57
        $changedJobs = $this->getChangedAppJobs();
58
59
        // tracked jobs
60
        $this->output->writeln("\nChanges to be committed");
61
        $this->output->writeln("  (use 'chapi reset <job>...' to unstage)");
62
        $this->output->writeln('');
63
64
        $this->printStatusView($changedJobs, true);
65
66
        // untracked jobs
67
        $this->output->writeln("\nChanges not staged for commit");
68
        $this->output->writeln("  (use 'chapi add <job>...' to update what will be committed)");
69
        $this->output->writeln("  (use 'chapi checkout <job>...' to discard changes in local repository)");
70
        $this->output->writeln('');
71
72
        $this->printStatusView($changedJobs, false);
73
74
        if ($this->input->getOption('strict') && $this->containsChangedAppJobs($changedJobs)) {
75
            return 1;
76
        }
77
78
        return 0;
79
    }
80
81
    /**
82
     * @param array<string,array<string,array>> $jobs
83
     * @return bool
84
     */
85
    private function containsChangedAppJobs(array $jobs) {
86
        foreach (['new', 'missing', 'updates'] as $category) {
87
            foreach ([self::LABEL_CHRONOS, self::LABEL_MARATHON] as $framework) {
88
                if (!empty($jobs[$category][$framework])) {
89
                    return true;
90
                }
91
            }
92
        }
93
94
        return false;
95
    }
96
97
    /**
98
     * @return array<string,array<string,array>>
99
     */
100
    private function getChangedAppJobs()
101
    {
102
        /** @var JobComparisonInterface $jobComparisonBusinessCaseChronos */
103
        /** @var JobComparisonInterface $jobComparisonBusinessCaseMarathon */
104
        $jobComparisonBusinessCaseChronos  = $this->getContainer()->get(JobComparisonInterface::DIC_NAME_CHRONOS);
105
        $jobComparisonBusinessCaseMarathon = $this->getContainer()->get(JobComparisonInterface::DIC_NAME_MARATHON);
106
107
        $result = [
108
            'new' => [
109
                self::LABEL_CHRONOS => $jobComparisonBusinessCaseChronos->getRemoteMissingJobs(),
110
                self::LABEL_MARATHON => $jobComparisonBusinessCaseMarathon->getRemoteMissingJobs(),
111
            ],
112
            'missing' => [
113
                self::LABEL_CHRONOS => $jobComparisonBusinessCaseChronos->getLocalMissingJobs(),
114
                self::LABEL_MARATHON => $jobComparisonBusinessCaseMarathon->getLocalMissingJobs(),
115
            ],
116
            'updates' => [
117
                self::LABEL_CHRONOS => $jobComparisonBusinessCaseChronos->getLocalJobUpdates(),
118
                self::LABEL_MARATHON => $jobComparisonBusinessCaseMarathon->getLocalJobUpdates(),
119
            ],
120
        ];
121
122
        return $result;
123
    }
124
125
    /**
126
     * @param array $changedJobs
127
     * @param bool $filterIsInIndex
128
     */
129
    private function printStatusView($changedJobs, $filterIsInIndex)
130
    {
131
        $formatMap = [
132
            'new' => ['title' => 'New jobs in local repository', 'format' => "\t<comment>new %s job:\t%s</comment>"],
133
            'missing' => ['title' => 'Missing jobs in local repository', 'format' => "\t<fg=red>delete %s job:\t%s</>"],
134
            'updates' => ['title' => 'Updated jobs in local repository', 'format' => "\t<info>modified %s job:\t%s</info>"]
135
        ];
136
137
        foreach ($changedJobs as $jobStatus => $jobList) {
138
            $filteredJobList = $this->filterJobListWithIndex($jobList, $filterIsInIndex);
139
            if (!empty($filteredJobList)) {
140
                $this->printJobList($formatMap[$jobStatus]['title'], $filteredJobList, $formatMap[$jobStatus]['format']);
141
            }
142
        }
143
    }
144
145
    /**
146
     * @param array $jobLists
147
     * @param bool $filterIsInIndex
148
     * @return array
149
     */
150
    private function filterJobListWithIndex($jobLists, $filterIsInIndex)
151
    {
152
        $filteredJobList = [];
153
154
        foreach ($jobLists as $appLabel => $jobList) {
155
            foreach ($jobList as $jobName) {
156
                if ($filterIsInIndex == $this->jobIndexService->isJobInIndex($jobName)) {
157
                    $filteredJobList[$appLabel][] = $jobName;
158
                }
159
            }
160
        }
161
162
        return $filteredJobList;
163
    }
164
165
    /**
166
     * @param string $title
167
     * @param array $jobLists
168
     * @param string $listFormat
169
     */
170
    private function printJobList($title, $jobLists, $listFormat)
171
    {
172
        $this->output->writeln(sprintf('  %s:', $title));
173
174
        foreach ($jobLists as $label => $jobList) {
175
            foreach ($jobList as $jobName) {
176
                $this->output->writeln(
177
                    sprintf($listFormat, $label, $jobName)
178
                );
179
            }
180
        }
181
182
        $this->output->writeln("\n");
183
    }
184
}
185