Issues (20)

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/Traits/Serve.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
namespace Acacha\Llum\Traits;
4
5
use Symfony\Component\Console\Input\InputArgument;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
/**
10
 * Class Serve.
11
 *
12
 * @property OutputInterface $output
13
 */
14
trait Serve
15
{
16
    /**
17
     * Serve command.
18
     *
19
     * @param InputInterface $input
20
     * @param OutputInterface $output
21
     */
22
    protected function serve(InputInterface $input, OutputInterface $output)
0 ignored issues
show
The parameter $output is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
    {
24
        $port = $this->port($input);
25
        $continue = true;
26
        do {
27
            if ($this->check_port($port)) {
28
                $this->output->writeln('<info>Running php artisan serve --port='.$port.'</info>');
29
                exec('php artisan serve --port='.$port.' > /dev/null 2>&1 &');
30
                sleep(1);
31
                if (file_exists('/usr/bin/sensible-browser')) {
32
                    $this->output->writeln('<info>Opening http://localhost:'.$port.' with default browser</info>');
33
                    passthru('/usr/bin/sensible-browser http://localhost:'.$port);
34
                }
35
                $continue = false;
36
            }
37
            ++$port;
38
        } while ($continue);
39
    }
40
41
    /**
42
     * Check if port is in use.
43
     *
44
     * @param int    $port
45
     * @param string $host
46
     * @param int    $timeout
47
     *
48
     * @return bool
49
     */
50
    protected function check_port($port = 8000, $host = '127.0.0.1', $timeout = 3)
51
    {
52
        $fp = @fsockopen($host, $port, $errno, $errstr, $timeout);
53
        if (!$fp) {
54
            return true;
55
        } else {
56
            fclose($fp);
57
58
            return false;
59
        }
60
    }
61
62
    /**
63
     * Configure command.
64
     */
65
    public function configure()
66
    {
67
        parent::configure();
68
69
        $this
70
            // configure an argument
71
            ->addArgument('port', InputArgument::OPTIONAL, 'Port number')
72
        ;
73
    }
74
75
    /**
76
     * Obtain port.
77
     *
78
     * @param InputInterface $input
79
     * @return integer
80
     */
81
    protected function port(InputInterface $input) {
82
        $name = $input->getArgument('port');
83
        return isset($name) ? (int) $name : 8080;
84
    }
85
86
    /**
87
     * Method provided from \Symfony\Component\Console\Command\Command.
88
     *
89
     * @param string $name        The argument name
90
     * @param int    $mode        The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
91
     * @param string $description A description text
92
     * @param mixed  $default     The default value (for InputArgument::OPTIONAL mode only)
93
     *
94
     * @return Command The current instance
95
     */
96
    abstract public function addArgument($name, $mode = null, $description = '', $default = null);
97
}
98