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 (8)

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/RobbieP/ZbarQrdecoder/ZbarDecoder.php (1 issue)

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
namespace RobbieP\ZbarQrdecoder;
4
5
use RobbieP\ZbarQrdecoder\Result\ErrorResult;
6
use RobbieP\ZbarQrdecoder\Result\Result;
7
use Symfony\Component\Process\Exception\ProcessFailedException;
8
use Symfony\Component\Process\ProcessBuilder;
9
10
class ZbarDecoder {
11
12
    const EXECUTABLE = 'zbarimg';
13
14
    private $path;
15
    private $file_path;
16
    private $result;
17
    /**
18
     * @var ProcessBuilder
19
     */
20
    private $processBuilder;
21
    /**
22
     * @var array
23
     */
24
    private $config;
25
26
    /**
27
     * @param array $config
28
     * @param ProcessBuilder $processBuilder
29
     */
30
    function __construct($config = [], $processBuilder = null)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
31
    {
32
        $this->config = $config;
33
        if(isset($this->config['path'])) {
34
            $this->setPath($this->config['path']);
35
        }
36
        $this->processBuilder =  is_null($processBuilder) ? new ProcessBuilder() : $processBuilder;
37
    }
38
39
    /**
40
     * Main constructor - builds the process, runs it then returns the Result object
41
     * @param $filename
42
     * @return mixed
43
     * @throws \Exception
44
     */
45
    public function make($filename)
46
    {
47
        $this->setFilepath($filename);
48
        $this->buildProcess();
49
        $this->runProcess();
50
        return $this->output();
51
    }
52
53
    /**
54
     * Returns the path to the executable zbarimg
55
     * Defaults to /usr/bin
56
     * @throws \Exception
57
     * @return mixed
58
     */
59
    public function getPath()
60
    {
61
        if(! $this->path ) {
62
            $this->setPath('/usr/bin');
63
        }
64
        return $this->path;
65
    }
66
67
    /**
68
     * @param mixed $path
69
     */
70
    public function setPath($path)
71
    {
72
        $this->path = rtrim($path, DIRECTORY_SEPARATOR);
73
    }
74
75
    /**
76
     * @return mixed
77
     */
78
    public function getFilepath()
79
    {
80
        return $this->file_path;
81
    }
82
83
    /**
84
     * @param mixed $filepath
85
     * @throws \Exception
86
     */
87
    public function setFilepath($filepath)
88
    {
89
        if(! is_file($filepath) ) {
90
            throw new \Exception('Invalid filepath given');
91
        }
92
        $this->file_path = $filepath;
93
    }
94
95
    /**
96
     * Builds the process
97
     * TODO: Configurable arguments
98
     * @throws \Exception
99
     */
100
    private function buildProcess()
101
    {
102
        $path = $this->getPath();
103
        $this->processBuilder->setPrefix($path . DIRECTORY_SEPARATOR . static::EXECUTABLE);
104
        $this->processBuilder->setArguments(array('-D', '--xml', '-q', $this->getFilepath()))->enableOutput();
105
    }
106
107
    /**
108
     * Runs the process
109
     * @throws \Exception
110
     */
111
    private function runProcess()
112
    {
113
        $process = $this->processBuilder->getProcess();
114
        try {
115
            $process->mustRun();
116
            $this->result = new Result($process->getOutput());
117
        } catch (ProcessFailedException $e) {
118
            switch($e->getProcess()->getExitCode()) {
119
                case 1:
120
                    throw new \Exception('An error occurred while processing the image. It could be bad arguments, I/O errors and image handling errors from ImageMagick');
121
                case 2:
122
                    throw new \Exception('ImageMagick fatal error');
123
                case 4:
124
                    $this->result = new ErrorResult('No barcode detected');
125
                    break;
126
                default:
127
                    throw new \Exception('Problem with decode - check you have zbar-tools installed');
128
            }
129
        }
130
131
    }
132
133
    /**
134
     * Only return the output class to the end user
135
     * @return mixed
136
     */
137
    private function output()
138
    {
139
        return $this->result;
140
    }
141
142
}