Merge branch 'master' of github.com:appwrite/appwrite into remove-globals

This commit is contained in:
Eldad Fux
2020-06-28 20:00:53 +03:00
6 changed files with 20 additions and 16 deletions
+3
View File
@@ -34,6 +34,9 @@
- Fixed wrong JSON validation when creating and updating database documnets
- Fixed bug where max file size was limited to max of 10MB
- Fixed bug preventing the deletion of the project logo
- Fixed Bug when trying to overwrite OAuth cookie in the Flutter SDK
- Fixed OAuth redirect when using the self-hosted instance default success URL ([#454](https://github.com/appwrite/appwrite/issues/454))
- Fixed bug denying authentication with Github OAuth provider
## Security
+5 -4
View File
@@ -29,8 +29,8 @@ use DeviceDetector\DeviceDetector;
use GeoIp2\Database\Reader;
use Utopia\Validator\ArrayList;
$oauthDefaultSuccess = $utopia->getEnv('_APP_HOME').'/auth/oauth2/success';
$oauthDefaultFailure = $utopia->getEnv('_APP_HOME').'/auth/oauth2/failure';
$oauthDefaultSuccess = '/auth/oauth2/success';
$oauthDefaultFailure = '/auth/oauth2/failure';
$oauth2Keys = [];
@@ -508,8 +508,9 @@ $utopia->get('/v1/account/sessions/oauth2/:provider/redirect')
->addHeader('X-Fallback-Cookies', \json_encode([Auth::$cookieName => Auth::encodeSession($user->getId(), $secret)]))
;
}
if ($state['success'] === $oauthDefaultSuccess) { // Add keys for non-web platforms
// Add keys for non-web platforms - TODO - add verification phase to aviod session sniffing
if (parse_url($state['success'], PHP_URL_PATH) === $oauthDefaultSuccess) {
$state['success'] = URLParser::parse($state['success']);
$query = URLParser::parseQuery($state['success']['query']);
$query['project'] = $project->getId();
Generated
+7 -8
View File
@@ -2141,24 +2141,23 @@
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "790426f28bfcbfc1a6f1d59ee8c986edfa45395c"
"reference": "664187301bfbc87e686df212094e6817805c3ab8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/790426f28bfcbfc1a6f1d59ee8c986edfa45395c",
"reference": "790426f28bfcbfc1a6f1d59ee8c986edfa45395c",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/664187301bfbc87e686df212094e6817805c3ab8",
"reference": "664187301bfbc87e686df212094e6817805c3ab8",
"shasum": ""
},
"require": {
"ext-filter": "^7.1",
"php": "^7.2",
"ext-filter": "*",
"php": "^7.2 || ^8.0",
"phpdocumentor/reflection-common": "^2.0",
"phpdocumentor/type-resolver": "^1.0",
"webmozart/assert": "^1"
},
"require-dev": {
"doctrine/instantiator": "^1",
"mockery/mockery": "^1"
"mockery/mockery": "1.3.*"
},
"type": "library",
"extra": {
@@ -2186,7 +2185,7 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2020-06-19T18:58:43+00:00"
"time": "2020-06-27T17:33:53+00:00"
},
{
"name": "phpdocumentor/type-resolver",
+1 -1
View File
@@ -50,7 +50,7 @@ services:
- ./phpunit.xml:/usr/share/nginx/html/phpunit.xml
- ./tests:/usr/share/nginx/html/tests
- ./app:/usr/share/nginx/html/app
# - ./vendor:/usr/share/nginx/html/vendor
# - ./vendor:/usr/share/nginx/html/vendor
- ./docs:/usr/share/nginx/html/docs
- ./public:/usr/share/nginx/html/public
- ./src:/usr/share/nginx/html/src
+1 -1
View File
@@ -138,7 +138,7 @@ abstract class OAuth2
\curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
\curl_setopt($ch, CURLOPT_HEADER, 0);
\curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
\curl_setopt($ch, CURLOPT_USERAGENT, '');
\curl_setopt($ch, CURLOPT_USERAGENT, 'Appwrite OAuth2');
if (!empty($payload)) {
\curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
@@ -15,7 +15,7 @@ class Github extends OAuth2
* @var array
*/
protected $scopes = [
'user:email'
'user:email',
];
/**
@@ -78,6 +78,7 @@ class Github extends OAuth2
{
$user = $this->getUser($accessToken);
var_dump($user);
if (isset($user['id'])) {
return $user['id'];
}
@@ -125,7 +126,7 @@ class Github extends OAuth2
* @return array
*/
protected function getUser(string $accessToken)
{
{
if (empty($this->user)) {
$this->user = \json_decode($this->request('GET', 'https://api.github.com/user', ['Authorization: token '.\urlencode($accessToken)]), true);
}