This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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 App\Auth; |
||
4 | |||
5 | use App\MemberToken; |
||
6 | use App\Member; |
||
7 | use Facebook\FacebookAuthorizationException; |
||
8 | use Facebook\FacebookSession; |
||
9 | use Facebook\FacebookRequest; |
||
10 | use Facebook\GraphUser; |
||
11 | use Illuminate; |
||
12 | use Illuminate\Support\Facades\Config; |
||
13 | use Illuminate\Support\Facades\Auth; |
||
14 | use Illuminate\Support\Facades\Session; |
||
15 | use Illuminate\Http\Request as HttpRequest; |
||
16 | |||
17 | /** |
||
18 | * Class Guard |
||
19 | * @package App\Auth |
||
20 | */ |
||
21 | class Guard |
||
22 | { |
||
23 | /** |
||
24 | * @param $code |
||
25 | * @return null |
||
26 | * @throws \Facebook\FacebookRequestException |
||
27 | * @throws \Facebook\FacebookSDKException |
||
28 | */ |
||
29 | protected function getAccessToken($code) |
||
30 | { |
||
31 | $response = (new FacebookRequest( |
||
32 | FacebookSession::newAppSession(), |
||
33 | 'GET', |
||
34 | '/oauth/access_token', |
||
35 | [ |
||
36 | 'client_id' => FacebookSession::_getTargetAppId(), |
||
37 | 'client_secret' => FacebookSession::_getTargetAppSecret(), |
||
38 | 'redirect_uri' => Config::get('auth.providers.facebook.redirect_uri'), |
||
39 | 'code' => $code |
||
40 | ] |
||
41 | ))->execute()->getResponse(); |
||
42 | |||
43 | // Graph v2.3 and greater return objects on the /oauth/access_token endpoint |
||
44 | $accessToken = null; |
||
45 | if (is_object($response) && isset($response->access_token)) { |
||
46 | $accessToken = $response->access_token; |
||
47 | } elseif (is_array($response) && array_key_exists('access_token', $response)) { |
||
48 | $accessToken = $response['access_token']; |
||
49 | } |
||
50 | |||
51 | return $accessToken; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @name facebookAuth |
||
56 | * @param $code |
||
57 | * @return null |
||
58 | * @throws \Facebook\FacebookSDKException |
||
59 | * @throws \Facebook\FacebookRequestException |
||
60 | * @throws FacebookAuthorizationException |
||
61 | */ |
||
62 | public function facebookAuth($code) |
||
63 | { |
||
64 | $accessToken = $this->getAccessToken($code); |
||
0 ignored issues
–
show
|
|||
65 | |||
66 | $session = new FacebookSession($accessToken); |
||
67 | |||
68 | if (!$session) { |
||
69 | throw new FacebookAuthorizationException('Invalid code', ['Invalid code'], 401); |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @var GraphUser $userProfile |
||
74 | */ |
||
75 | $userProfile = (new FacebookRequest( |
||
76 | $session, |
||
77 | 'GET', |
||
78 | '/me' |
||
79 | ))->execute()->getGraphObject(GraphUser::className()); |
||
80 | |||
81 | $user = Member::firstOrNew(['facebookId' => $userProfile->getId()]); |
||
82 | $user->name = $userProfile->getName(); |
||
83 | $user->save(); |
||
84 | |||
85 | Auth::login($user); |
||
86 | |||
87 | $memberToken = new MemberToken(); |
||
88 | $memberToken->memberId = $user->id; |
||
0 ignored issues
–
show
The property
memberId does not exist on object<App\MemberToken> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
89 | $memberToken->accessToken = $accessToken; |
||
0 ignored issues
–
show
The property
accessToken does not exist on object<App\MemberToken> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
90 | $memberToken->sessionId = Session::getId(); |
||
0 ignored issues
–
show
The property
sessionId does not exist on object<App\MemberToken> . Since you implemented __set , maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
91 | $memberToken->save(); |
||
92 | |||
93 | return $accessToken; |
||
94 | } |
||
95 | |||
96 | public function logout() |
||
97 | { |
||
98 | // If we have an event dispatcher instance, we can fire off the logout event |
||
99 | // so any further processing can be done. This allows the developer to be |
||
100 | // listening for anytime a user signs out of this application manually. |
||
101 | |||
102 | MemberToken::where(['sessionId' => Session::getId()])->delete(); |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * @name getSessionId |
||
107 | * @param HttpRequest $request |
||
108 | * @return mixed |
||
109 | */ |
||
110 | public static function getSessionId(HttpRequest $request) |
||
111 | { |
||
112 | $accessToken = trim( |
||
113 | preg_replace('/^(?:\s+)?Bearer\s/', '', $request->header('Authorization')) |
||
114 | ); |
||
115 | |||
116 | // find session with token |
||
117 | $memberToken = MemberToken::where('accessToken', $accessToken)->first(); |
||
118 | |||
119 | if ($memberToken && Session::isValidId($memberToken->sessionId)) { |
||
120 | /** |
||
121 | * @var MemberToken $memberToken |
||
122 | */ |
||
123 | $memberToken->update([ |
||
124 | 'updated_at' => $memberToken->freshTimestamp() |
||
125 | ]); |
||
126 | return $memberToken->sessionId; |
||
0 ignored issues
–
show
The property
sessionId does not exist on object<App\MemberToken> . Since you implemented __get , maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. ![]() |
|||
127 | } else { |
||
128 | return $request->cookies->get(Session::getName()); |
||
129 | } |
||
130 | } |
||
131 | } |
||
132 |
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()
can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.