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

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/TwigGravatar.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
class TwigGravatar extends \Twig_Extension {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
	public $baseUrl = "http://www.gravatar.com/";
5
	public $httpsUrl = "https://secure.gravatar.com/";
6
7
	public $filterPrefix = "gr";
8
9
	private $filterOptions = array("is_safe" => array("html"));
10
11
	private $defaults = array(
12
		"404", "mm", "identicon", "monsterid", "wavatar", "retro", "blank"
13
	);
14
	private $ratings = array(
15
		"g", "pg", "r", "x"
16
	);
17
18
	/**
19
	 * {@inheritdoc}
20
	 */
21
	public function getFilters(){
22
        return array(
23
            new \Twig_SimpleFilter($this->filterPrefix . 'Avatar', array($this, 'avatar'), $this->filterOptions),
24
            new \Twig_SimpleFilter($this->filterPrefix . 'Https', array($this, 'https'), $this->filterOptions),
25
            new \Twig_SimpleFilter($this->filterPrefix . 'Size', array($this, 'size'), $this->filterOptions),
26
            new \Twig_SimpleFilter($this->filterPrefix . 'Default', array($this, 'def'), $this->filterOptions),
27
            new \Twig_SimpleFilter($this->filterPrefix . 'Rating', array($this, 'rating'), $this->filterOptions)
28
        );
29
    }
30
31
	/**
32
	 * Get a Gravatar Avatar URL
33
	 * @param  string $email Gravatar Email address
34
	 * @return string        Gravatar Avatar URL
35
	 * @throws \InvalidArgumentException If $email is invalid
36
	 */
37
	public function avatar($email) {
38
		if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
39
			return $this->baseUrl . "avatar/" . $this->generateHash($email);
40
		} else {
41
			throw new InvalidArgumentException("The avatar filter must be passed a valid Email address");
42
		}
43
	}
44
45
	/**
46
	 * Change a Gravatar URL to its Secure version
47
	 * @param  string $value URL to convert
48
	 * @return string        Converted URL
49
	 * @throws \InvalidArgumentException If $value isn't an existing Gravatar URL
50
	 */
51
	public function https($value) {
52
		if (strpos($value, $this->baseUrl) === false) {
53
			throw new InvalidArgumentException("You can only convert existing Gravatar URLs to HTTPS");
54
		}
55
		else {
56
			return str_replace($this->baseUrl, $this->httpsUrl, $value);
57
		}
58
	}
59
60
	/**
61
	 * Change the Size of a Gravatar URL
62
	 * @param  string  $value
63
	 * @param  integer $px
64
	 * @return string Sized Gravatar URL
65
	 */
66
	public function size($value, $px = 100) {
67
		if (!is_numeric($px) || $px < 0 || $px > 2048) {
68
			throw new InvalidArgumentException("You must pass the size filter a valid number between 0 and 2048");
69
		}
70
		else if (strpos($value, $this->baseUrl) === false
71
			&& strpos($value, $this->httpsUrl) === false) {
72
			throw new InvalidArgumentException("You must pass the size filter an existing Gravatar URL");
73
		}
74
		else {
75
			return $this->query($value, array("size" => $px));
76
		}
77
	}
78
79
	/**
80
	 * Specify a default Image for when there is no matching Gravatar image.
81
	 * @param string  $value
82
	 * @param string  $default Defaults to Mystery Man
83
	 * @param boolean $force   Always load the default image
84
	 * @return string          Gravatar URL with a default image.
85
	 */
86
	public function def($value, $default = "mm", $force = false) {
87
		if (strpos($value, $this->baseUrl) === false && strpos($value, $this->httpsUrl) === false) {
88
			throw new InvalidArgumentException("You can only a default to existing Gravatar URLs");
89
		}
90
		else if (!filter_var($default, FILTER_VALIDATE_URL) && !in_array($default, $this->defaults)) {
91
			throw new InvalidArgumentException("Default must be a URL or valid default");
92
		}
93
		else if (!is_bool($force)) {
94
			throw new InvalidArgumentException("The force option for a default must be boolean");
95
		}
96
		else {
97
			if (filter_var($default, FILTER_VALIDATE_URL)) $default = urlencode($default);
98
			$force = ($force ? "y" : "n");
99
			return $this->query($value, array("default" => $default, "forcedefault" => $force));
100
		}
101
	}
102
103
	/**
104
	 * Specify the maximum rating for an avatar
105
	 * @param  string $value
106
	 * @param  string $rating Expects g,pg,r or x
107
	 * @return string Gravatar URL with a rating specified
108
	 */
109
	public function rating($value, $rating = "g") {
110
		if (strpos($value, $this->baseUrl) === false && strpos($value, $this->httpsUrl) === false) {
111
			throw new InvalidArgumentException("You can only add a rating to an existing Gravatar URL");
112
		}
113
		else if (!in_array(strtolower($rating), $this->ratings)) {
114
			throw new InvalidArgumentException("Rating must be g,pg,r or x");
115
		}
116
		else {
117
			return $this->query($value, array("rating" => $rating));
118
		}
119
	}
120
121
122
	/**
123
	 * Generate the Hashed email address
124
	 * @param  string $email
125
	 * @return string        Hashed email address
126
	 */
127
	public function generateHash($email) {
128
		return md5(strtolower(trim($email)));
129
	}
130
131
	/**
132
	 * Generate the query string
133
	 * @param  string $string
134
	 * @param  array  $addition Array of what parameters to add
135
	 * @return string
136
	 */
137
	private function query($string, array $addition) {
138
		foreach ($addition as $name => $value) {
139
			$string .= (strpos($string, "?") === FALSE ? "?" : "&") . $name . "=" . $value;
140
		}
141
		return $string;
142
	}
143
144
	/**
145
	 * Get the Extension name
146
	 * @return string
147
	 */
148
	public function getName() {
149
		return 'TwigGravatar';
150
	}
151
}