Issues (45)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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/BantenprovSso.php (18 issues)

1
<?php
2
3
/**
4
 * @Author: jdi-juma
5
 * @Date:   2017-12-09 16:45:17
6
 * @Last Modified by:   jdi-juma
7
 * @Last Modified time: 2017-12-09 23:19:33
8
 */
9
10
11
namespace Bantenprov\BantenprovSso;
12
13
14
class BantenprovSso 
15
{
16
17
	public static $result;
18
	public static $profile_result;
19
	public static $status;
20
	public static $request;
21
	public static $fails;
22
	public static $check_login;
23
	public static $token_access;
24
25
	public function __construct()
26
	{
27
		Self::$fails   			= false;
28
		Self::$profile_fails   	= false;
0 ignored issues
show
Bug Best Practice introduced by
The property profile_fails does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
29
		Self::$token_access     = false;
30
		$this->profile = '';
0 ignored issues
show
Bug Best Practice introduced by
The property profile does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
31
	}
32
33
34
	static function Attempt($post)
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...
35
	{
36
		$post['appid']		= env('APPID');
0 ignored issues
show
The function env was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
		$post['appid']		= /** @scrutinizer ignore-call */ env('APPID');
Loading history...
37
		$post['token']		= env('TOKEN');
38
		$curl=curl_init();
39
		curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
40
		curl_setopt($curl,CURLOPT_URL,env('SSO_LOGIN'));
41
		curl_setopt($curl,CURLOPT_POST,1);
42
		curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post));
43
		curl_setopt($curl,CURLOPT_TIMEOUT,20);
44
		curl_setopt($curl,CURLOPT_HTTPHEADER, array(
45
		    'Accept: application/json')
46
		);
47
		$exec=curl_exec($curl);
48
		if(!$exec)
49
		{
50
			return BantenprovSso::$fails = true;
51
		}
52
		curl_close($curl);
53
		$result = json_decode($exec);
54
		BantenprovSso::$result = $result;
55
		return $result->status;
56
	}
57
58
	static function message()
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...
59
	{
60
		return BantenprovSso::$result->message;
61
	}
62
63 View Code Duplication
	static function check_logout($post)
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...
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
64
	{
65
		$post['appid']		= env('APPID');
0 ignored issues
show
The function env was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

65
		$post['appid']		= /** @scrutinizer ignore-call */ env('APPID');
Loading history...
66
		$post['token']		= env('TOKEN');
67
		$curl=curl_init();
68
		curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
69
		curl_setopt($curl,CURLOPT_URL,env('CHECK_LOGOUT'));
70
		curl_setopt($curl,CURLOPT_POST,1);
71
		curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post));
72
		curl_setopt($curl,CURLOPT_TIMEOUT,20);
73
		curl_setopt($curl,CURLOPT_HTTPHEADER, array(
74
		    'Accept: application/json')
75
		);
76
		$exec=curl_exec($curl);
77
		if(!$exec)
78
		{
79
			return false;
80
		}
81
		curl_close($curl);
82
		$result = json_decode($exec);
83
		return $result->status;
84
	}
85
86 View Code Duplication
	static function check_login($post)
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...
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
87
	{
88
		$post['appid']		= env('APPID');
0 ignored issues
show
The function env was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

88
		$post['appid']		= /** @scrutinizer ignore-call */ env('APPID');
Loading history...
89
		$post['token']		= env('TOKEN');
90
		$curl=curl_init();
91
		curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
92
		curl_setopt($curl,CURLOPT_URL,env('CHECK_LOGIN'));
93
		curl_setopt($curl,CURLOPT_POST,1);
94
		curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post));
95
		curl_setopt($curl,CURLOPT_TIMEOUT,20);
96
		curl_setopt($curl,CURLOPT_HTTPHEADER, array(
97
		    'Accept: application/json')
98
		);
99
		$exec=curl_exec($curl);
100
101
		//dd($exec);
102
103
		if(!$exec)
104
		{
105
			return false;
106
		}
107
		curl_close($curl);
108
		$result = json_decode($exec);
109
		BantenprovSso::$check_login = $result;
110
		return $result->status;
111
	}
112
113
	static function check_login_data()
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...
114
	{
115
		return BantenprovSso::$check_login->data;
116
	}
117
118
	static function data()
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...
119
	{
120
		if( BantenprovSso::$result->status == false)
121
		{
122
			return BantenprovSso::$result->message;
123
		}
124
		return BantenprovSso::$result->data;
125
126
	}
127
128 View Code Duplication
	static function Logout($post)
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...
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
129
	{
130
		$post['appid']		= env('APPID');
0 ignored issues
show
The function env was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

130
		$post['appid']		= /** @scrutinizer ignore-call */ env('APPID');
Loading history...
131
		$post['token']		= env('TOKEN');
132
		$curl=curl_init();
133
		curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
134
		curl_setopt($curl,CURLOPT_URL,env('SSO_LOGOUT'));
135
		curl_setopt($curl,CURLOPT_POST,1);
136
		curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post));
137
		curl_setopt($curl,CURLOPT_TIMEOUT,20);
138
		curl_setopt($curl,CURLOPT_HTTPHEADER, array(
139
		    'Accept: application/json')
140
		);
141
		$exec=curl_exec($curl);
142
		//dd($exec);
143
		if(!$exec)
144
		{
145
			return false;
146
		}
147
		curl_close($curl);
148
		$result = json_decode($exec);
149
		BantenprovSso::$check_login = $result;
150
		return $result->status;
151
	}
152
153
	static function InitAddress()
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...
154
	{
155
		$ipaddress = '';
156
	    if (getenv('HTTP_CLIENT_IP'))
157
	        $ipaddress = getenv('HTTP_CLIENT_IP');
158
	    else if(getenv('HTTP_X_FORWARDED_FOR'))
159
	        $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
160
	    else if(getenv('HTTP_X_FORWARDED'))
161
	        $ipaddress = getenv('HTTP_X_FORWARDED');
162
	    else if(getenv('HTTP_FORWARDED_FOR'))
163
	        $ipaddress = getenv('HTTP_FORWARDED_FOR');
164
	    else if(getenv('HTTP_FORWARDED'))
165
	       $ipaddress = getenv('HTTP_FORWARDED');
166
	    else if(getenv('REMOTE_ADDR'))
167
	        $ipaddress = getenv('REMOTE_ADDR');
168
	    else
169
	        $ipaddress = 'UNKNOWN';
170
	    return $ipaddress;
171
	}
172
173
	static function init()
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...
174
	{
175
		return 'package loaded';
176
	}
177
178
}