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 (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/Partial.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
4
Copyright 2013-2020 Zordius Chen. All Rights Reserved.
5
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
9
Origin: https://github.com/zordius/lightncandy
10
*/
11
12
/**
13
 * file to keep LightnCandy partial methods
14
 *
15
 * @package    LightnCandy
16
 * @author     Zordius <[email protected]>
17
 */
18
19
namespace LightnCandy;
20
21
/**
22
 * LightnCandy Partial handler
23
 */
24
class Partial
25
{
26
    public static $TMP_JS_FUNCTION_STR = "!!\aFuNcTiOn\a!!";
27
28
    /**
29
     * Include all partials when using dynamic partials
30
     */
31 718
    public static function handleDynamic(&$context)
32
    {
33 718
        if ($context['usedFeature']['dynpartial'] == 0) {
34 712
            return;
35
        }
36
37 6
        foreach ($context['partials'] as $name => $code) {
38 6
            static::read($context, $name);
39
        }
40 6
    }
41
42
    /**
43
     * Read partial file content as string and store in context
44
     *
45
     * @param array<string,array|string|integer> $context Current context of compiler progress.
46
     * @param string $name partial name
47
     *
48
     * @return string|null $code compiled PHP code when success
49
     */
50 108
    public static function read(&$context, $name)
51
    {
52 108
        $isPB = ($name === '@partial-block');
53 108
        $context['usedFeature']['partial']++;
54
55 108
        if (isset($context['usedPartial'][$name])) {
56 25
            return;
57
        }
58
59 102
        $cnt = static::resolve($context, $name);
60
61 102
        if ($cnt !== null) {
62 91
            $context['usedPartial'][$name] = SafeString::escapeTemplate($cnt);
63 91
            return static::compileDynamic($context, $name);
64
        }
65
66 14
        if (!$context['flags']['skippartial'] && !$isPB) {
67 5
            $context['error'][] = "Can not find partial for '$name', you should provide partials or partialresolver in options";
68
        }
69 14
    }
70
71
    /**
72
     * preprocess partial template before it be stored into context
73
     *
74
     * @param array<string,array|string|integer> $context Current context of compiler progress.
75
     * @param string $tmpl partial template
76
     * @param string $name partial name
77
     *
78
     * @return string|null $content processed partial template
79
     *
80
     * @expect 'hey' when input array('prepartial' => false), 'hey', 'haha'
81
     * @expect 'haha-hoho' when input array('prepartial' => function ($cx, $tmpl, $name) {return "$name-$tmpl";}), 'hoho', 'haha'
82
     */
83 92
    protected static function prePartial(&$context, $tmpl, &$name)
84
    {
85 92
        return $context['prepartial'] ? $context['prepartial']($context, $tmpl, $name) : $tmpl;
86
    }
87
88
    /**
89
     * resolve partial, return the partial content
90
     *
91
     * @param array<string,array|string|integer> $context Current context of compiler progress.
92
     * @param string $name partial name
93
     *
94
     * @return string|null $content partial content
95
     */
96 110
    public static function resolve(&$context, &$name)
97
    {
98 110
        if ($name === '@partial-block') {
99 17
            $name = "@partial-block{$context['usedFeature']['pblock']}";
100
        }
101 110
        if (isset($context['partials'][$name])) {
102 90
            return static::prePartial($context, $context['partials'][$name], $name);
103
        }
104
105 25
        return static::resolver($context, $name);
106
    }
107
108
    /**
109
     * use partialresolver to resolve partial, return the partial content
110
     *
111
     * @param array<string,array|string|integer> $context Current context of compiler progress.
112
     * @param string $name partial name
113
     *
114
     * @return string|null $content partial content
115
     */
116 25
    public static function resolver(&$context, &$name)
117
    {
118 25
        if ($context['partialresolver']) {
119 1
            $cnt = $context['partialresolver']($context, $name);
120 1
            return static::prePartial($context, $cnt, $name);
121
        }
122 24
    }
123
124
    /**
125
     * compile a partial to static embed PHP code
126
     *
127
     * @param array<string,array|string|integer> $context Current context of compiler progress.
128
     * @param string $name partial name
129
     *
130
     * @return string|null $code PHP code string
131
     */
132 9
    public static function compileStatic(&$context, $name)
133
    {
134
        // Check for recursive partial
135 9
        if (!$context['flags']['runpart']) {
136 9
            $context['partialStack'][] = $name;
137 9
            $diff = count($context['partialStack']) - count(array_unique($context['partialStack']));
138 9
            if ($diff) {
139 1
                $context['error'][] = 'I found recursive partial includes as the path: ' . implode(' -> ', $context['partialStack']) . '! You should fix your template or compile with LightnCandy::FLAG_RUNTIMEPARTIAL flag.';
140
            }
141
        }
142
143 9
        $code = Compiler::compileTemplate($context, preg_replace('/^/m', $context['tokens']['partialind'], $context['usedPartial'][$name]));
144
145 9
        if (!$context['flags']['runpart']) {
146 9
            array_pop($context['partialStack']);
147
        }
148
149 9
        return $code;
150
    }
151
152
    /**
153
     * compile partial as closure, stored in context
154
     *
155
     * @param array<string,array|string|integer> $context Current context of compiler progress.
156
     * @param string $name partial name
157
     *
158
     * @return string|null $code compiled PHP code when success
159
     */
160 109
    public static function compileDynamic(&$context, $name)
161
    {
162 109
        if (!$context['flags']['runpart']) {
163 11
            return;
164
        }
165
166 98
        $func = static::compile($context, $context['usedPartial'][$name], $name);
167
168 98
        if (!isset($context['partialCode'][$name]) && $func) {
169 98
            $context['partialCode'][$name] = "'$name' => $func";
170
        }
171
172 98
        return $func;
173
    }
174
175
    /**
176
     * compile a template into a closure function
177
     *
178
     * @param array<string,array|string|integer> $context Current context of compiler progress.
179
     * @param string $template template string
180
     * @param string|integer $name partial name or 0
0 ignored issues
show
Consider making the type for parameter $name a bit more specific; maybe use integer.
Loading history...
181
     *
182
     * @return string $code compiled PHP code
183
     */
184 98
    public static function compile(&$context, $template, $name = 0)
185
    {
186 98
        if ((end($context['partialStack']) === $name) && (substr($name, 0, 14) === '@partial-block')) {
187 3
            return;
188
        }
189
190 98
        $tmpContext = $context;
191 98
        $tmpContext['inlinepartial'] = array();
192 98
        $tmpContext['partialblock'] = array();
193
194 98
        if ($name !== 0) {
195 98
            $tmpContext['partialStack'][] = $name;
196
        }
197
198 98
        $code = Compiler::compileTemplate($tmpContext, str_replace('function', static::$TMP_JS_FUNCTION_STR, $template));
199 98
        Context::merge($context, $tmpContext);
200 98
        if (!$context['flags']['noind']) {
201 93
            $sp = ', $sp';
202 93
            $code = preg_replace('/^/m', "'{$context['ops']['seperator']}\$sp{$context['ops']['seperator']}'", $code);
203
            // callbacks inside partial should be aware of $sp
204 93
            $code = preg_replace('/\bfunction\s*\(([^\(]*?)\)\s*{/', 'function(\\1)use($sp){', $code);
205 93
            $code = preg_replace('/function\(\$cx, \$in, \$sp\)use\(\$sp\){/', 'function($cx, $in)use($sp){', $code);
206
        } else {
207 5
            $sp = '';
208
        }
209 98
        $code = str_replace(static::$TMP_JS_FUNCTION_STR, 'function', $code);
210 98
        return "function (\$cx, \$in{$sp}) {{$context['ops']['array_check']}{$context['ops']['op_start']}'$code'{$context['ops']['op_end']}}";
211
    }
212
}
213