Skip to content

Commit e9dd71d

Browse files
Merge pull request appwrite#1479 from TorstenDittmann/release-0-9-4
prepare: release 0.9.4
2 parents cbee874 + 7af9bdb commit e9dd71d

File tree

134 files changed

+464
-297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+464
-297
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
.DS_Store
77
.php_cs.cache
88
debug/
9-
app/sdks
9+
app/sdks
10+
dev/yasd_init.php

CHANGES.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
# Version 0.9.4
2+
3+
## Security
4+
5+
- Fixed security vulnerability that exposes project ID's from other admin users (#1453)
6+
7+
# Version 0.9.3
8+
9+
## Bugs
10+
11+
- Fixed Abuse Limit keys for JWT and E-Mail confirmation (#1434)
12+
13+
# Version 0.9.2
14+
15+
## Bugs
16+
17+
- Fixed JWT session validation (#1408)
18+
- Fixed passing valid JWT session to Cloud Functions (#1421)
19+
- Fixed race condition when uploading and extracting bigger Cloud Functions (#1419)
20+
21+
# Version 0.9.1
22+
23+
## Bugs
24+
25+
- Fixed PDO Connection timeout (#1385)
26+
- Removed unnecessary `app` resource and replace with `utopia` (#1384)
27+
- Fixed missing quote in Functions Worker logs (#1375)
28+
129
# Version 0.9.0
230

331
## Features

CONTRIBUTING.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ Learn more at our [Technology Stack](## Technology Stack) section.
123123

124124
Appwrite's current structure is a combination of both [Monolithic](https://en.wikipedia.org/wiki/Monolithic_application) and [Microservice](https://en.wikipedia.org/wiki/Microservices) architectures, but our final goal, as we grow, is to be using only microservices.
125125

126+
---
127+
![Appwrite](docs/specs/overview.drawio.svg)
128+
---
129+
126130
### File Structure
127131

128132
```bash
@@ -174,10 +178,6 @@ Appwrite's current structure is a combination of both [Monolithic](https://en.wi
174178
└── unit
175179
```
176180

177-
---
178-
![Appwrite](docs/specs/overview.drawio.svg)
179-
---
180-
181181
### The Monolithic Part
182182

183183
Appwrite's main API container is designed as a monolithic app. This is a decision we made to allow us to develop the project faster while still being a very small team.
@@ -282,6 +282,30 @@ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
282282

283283
The Runtimes for all supported cloud functions (multicore builds) can be found at the [appwrite/php-runtimes](https://github.com/appwrite/php-runtimes) repository.
284284

285+
## Debug
286+
287+
Appwrite uses [yasd](https://github.com/swoole/yasd) debugger, which can be made available during build of Appwrite. You can connect to the debugger using VS Code [PHP Debug](https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug) extension or if you are in PHP Storm you don't need any plugin. Below are the settings required for remote debugger connection.
288+
289+
First, you need to create an init file. Duplicate **dev/yasd_init.php.stub** file and name it **dev/yasd_init.php** and there change the IP address to your development machine's IP. Without the proper IP address debugger wont connect. And you also need to set **DEBUG** build arg in **appwrite** service in **docker-compose.yml** file.
290+
291+
### VS Code Launch Configuration
292+
293+
```json
294+
{
295+
"name": "Listen for Xdebug",
296+
"type": "php",
297+
"request": "launch",
298+
"port": 9005,
299+
"pathMappings": {
300+
"/usr/src/code": "${workspaceRoot}"
301+
},
302+
}
303+
```
304+
305+
### PHPStorm Setup
306+
307+
In settings, go to **Languages & Frameworks** > **PHP** > **Debug**, there under **Xdebug** set the debug port to **9005** and enable **can accept external connections** checkbox.
308+
285309
## Tests
286310

287311
To run all tests manually, use the Appwrite Docker CLI from your terminal:

Dockerfile

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ RUN composer update --ignore-platform-reqs --optimize-autoloader \
1414

1515
FROM php:8.0-cli-alpine as step1
1616

17+
ARG DEBUG=false
18+
ENV DEBUG=$DEBUG
19+
1720
ENV PHP_REDIS_VERSION=5.3.4 \
1821
PHP_SWOOLE_VERSION=v4.6.7 \
1922
PHP_IMAGICK_VERSION=3.5.0 \
@@ -75,11 +78,25 @@ RUN \
7578
make && make install && \
7679
cd ../..
7780

81+
## Swoole Debugger setup
82+
RUN if [ "$DEBUG" == "true" ]; then \
83+
cd /tmp && \
84+
apk add boost-dev && \
85+
git clone --depth 1 https://github.com/swoole/yasd && \
86+
cd yasd && \
87+
phpize && \
88+
./configure && \
89+
make && make install && \
90+
cd ..;\
91+
fi
92+
7893
FROM php:8.0-cli-alpine as final
7994

8095
LABEL maintainer="team@appwrite.io"
8196

8297
ARG VERSION=dev
98+
ARG DEBUG=false
99+
ENV DEBUG=$DEBUG
83100

84101
ENV _APP_SERVER=swoole \
85102
_APP_ENV=production \
@@ -160,10 +177,15 @@ RUN \
160177
&& apk del .deps \
161178
&& rm -rf /var/cache/apk/*
162179

180+
RUN \
181+
if [ "$DEBUG" == "true" ]; then \
182+
apk add boost boost-dev; \
183+
fi
184+
163185
WORKDIR /usr/src/code
164186

165187
COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor
166-
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20200930/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
188+
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20200930/swoole.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/yasd.so* /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
167189
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20200930/redis.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
168190
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20200930/imagick.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
169191
COPY --from=step1 /usr/local/lib/php/extensions/no-debug-non-zts-20200930/yaml.so /usr/local/lib/php/extensions/no-debug-non-zts-20200930/
@@ -218,7 +240,9 @@ RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini
218240
RUN echo extension=imagick.so >> /usr/local/etc/php/conf.d/imagick.ini
219241
RUN echo extension=yaml.so >> /usr/local/etc/php/conf.d/yaml.ini
220242
RUN echo extension=maxminddb.so >> /usr/local/etc/php/conf.d/maxminddb.ini
243+
RUN if [ "$DEBUG" == "true" ]; then printf "zend_extension=yasd \nyasd.debug_mode=remote \nyasd.init_file=/usr/local/dev/yasd_init.php \nyasd.remote_port=9005 \nyasd.log_level=-1" >> /usr/local/etc/php/conf.d/yasd.ini; fi
221244

245+
RUN if [ "$DEBUG" == "true" ]; then echo "opcache.enable=0" >> /usr/local/etc/php/conf.d/appwrite.ini; fi
222246
RUN echo "opcache.preload_user=www-data" >> /usr/local/etc/php/conf.d/appwrite.ini
223247
RUN echo "opcache.preload=/usr/src/code/app/preload.php" >> /usr/local/etc/php/conf.d/appwrite.ini
224248
RUN echo "opcache.enable_cli=1" >> /usr/local/etc/php/conf.d/appwrite.ini

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<br />
22
<p align="center">
3-
<a href="https://appwrite.io" target="_blank"><img width="260" height="39" src="https://appwrite.io/images/github-logo.png" alt="Appwrite Logo"></a>
3+
<a href="https://appwrite.io" target="_blank"><img width="260" height="39" src="https://appwrite.io/images/appwrite.svg" alt="Appwrite Logo"></a>
44
<br />
55
<br />
66
<b>A complete backend solution for your [Flutter / Vue / Angular / React / iOS / Android / *ANY OTHER*] app</b>
@@ -15,7 +15,7 @@
1515
[![Build Status](https://img.shields.io/travis/com/appwrite/appwrite?style=flat-square)](https://travis-ci.com/appwrite/appwrite)
1616
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
1717

18-
[**Appwrite 0.8 has been released! Learn what's new!**](https://dev.to/appwrite/announcing-appwrite-0-8-an-open-source-self-hosted-baas-kda)
18+
[**Appwrite 0.9 has been released! Learn what's new!**](https://dev.to/appwrite/announcing-appwrite-0-9-the-open-source-firebase-alternative-53ho)
1919

2020
Appwrite is an end-to-end backend server for Web, Mobile, Native, or Backend apps packaged as a set of Docker<nobr> microservices. Appwrite abstracts the complexity and repetitiveness required to build a modern backend API from scratch and allows you to build secure apps faster.
2121

@@ -56,7 +56,7 @@ docker run -it --rm \
5656
--volume /var/run/docker.sock:/var/run/docker.sock \
5757
--volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
5858
--entrypoint="install" \
59-
appwrite/appwrite:0.8.0
59+
appwrite/appwrite:0.9.4
6060
```
6161

6262
### Windows
@@ -68,7 +68,7 @@ docker run -it --rm ^
6868
--volume //var/run/docker.sock:/var/run/docker.sock ^
6969
--volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^
7070
--entrypoint="install" ^
71-
appwrite/appwrite:0.8.0
71+
appwrite/appwrite:0.9.4
7272
```
7373

7474
#### PowerShell
@@ -78,7 +78,7 @@ docker run -it --rm ,
7878
--volume /var/run/docker.sock:/var/run/docker.sock ,
7979
--volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ,
8080
--entrypoint="install" ,
81-
appwrite/appwrite:0.8.0
81+
appwrite/appwrite:0.9.4
8282
```
8383

8484
Once the Docker installation completes, go to http://localhost to access the Appwrite console from your browser. Please note that on non-linux native hosts, the server might take a few minutes to start after installation completes.
@@ -121,14 +121,16 @@ Below is a list of currently supported platforms and languages. If you wish to h
121121
#### Client
122122
*&nbsp; [Web](https://github.com/appwrite/sdk-for-web) (Maintained by the Appwrite Team)
123123
*&nbsp; [Flutter](https://github.com/appwrite/sdk-for-flutter) (Maintained by the Appwrite Team)
124+
*&nbsp; [Android](https://github.com/appwrite/sdk-for-android) (Maintained by the Appwrite Team)
124125

125126
#### Server
126127
*&nbsp; [NodeJS](https://github.com/appwrite/sdk-for-node) (Maintained by the Appwrite Team)
127128
*&nbsp; [PHP](https://github.com/appwrite/sdk-for-php) (Maintained by the Appwrite Team)
128129
*&nbsp; [Dart](https://github.com/appwrite/sdk-for-dart) **Beta** (Maintained by the Appwrite Team)
129130
*&nbsp; [Deno](https://github.com/appwrite/sdk-for-deno) - **Beta** (Maintained by the Appwrite Team)
130-
*&nbsp; [Ruby](https://github.com/appwrite/sdk-for-ruby) - **Beta** (Maintained by the Appwrite Team)
131-
*&nbsp; [Python](https://github.com/appwrite/sdk-for-python) - **Beta** (Maintained by the Appwrite Team)
131+
*&nbsp; [Ruby](https://github.com/appwrite/sdk-for-ruby) (Maintained by the Appwrite Team)
132+
*&nbsp; [Python](https://github.com/appwrite/sdk-for-python) (Maintained by the Appwrite Team)
133+
*&nbsp; [Kotlin](https://github.com/appwrite/sdk-for-kotlin) - **Beta** (Maintained by the Appwrite Team)
132134
*&nbsp; [.NET](https://github.com/appwrite/sdk-for-dotnet) - **Experimental** (Maintained by the Appwrite Team)
133135

134136
Looking for more SDKs? - Help us by contributing a pull request to our [SDK Generator](https://github.com/appwrite/sdk-generator)!

app/config/platforms.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
'name' => 'Android',
114114
'version' => '0.0.1',
115115
'url' => 'https://github.com/appwrite/sdk-for-android',
116-
'package' => 'https://repo1.maven.org/maven2/io/appwrite/sdk-for-android/',
116+
'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-android',
117117
'enabled' => true,
118118
'beta' => true,
119119
'dev' => false,
@@ -355,7 +355,7 @@
355355
'name' => 'Kotlin',
356356
'version' => '0.0.1',
357357
'url' => 'https://github.com/appwrite/sdk-for-kotlin',
358-
'package' => 'https://repo1.maven.org/maven2/io/appwrite/sdk-for-kotlin/',
358+
'package' => 'https://search.maven.org/artifact/io.appwrite/sdk-for-kotlin',
359359
'enabled' => true,
360360
'beta' => true,
361361
'dev' => false,

app/controllers/api/account.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@
782782
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
783783
->label('sdk.response.model', Response::MODEL_JWT)
784784
->label('abuse-limit', 10)
785-
->label('abuse-key', 'url:{url},userId:{param-userId}')
785+
->label('abuse-key', 'url:{url},userId:{userId}')
786786
->inject('response')
787787
->inject('user')
788788
->action(function ($response, $user) {
@@ -918,16 +918,16 @@
918918
->inject('user')
919919
->inject('locale')
920920
->inject('geodb')
921-
->inject('app')
922-
->action(function ($response, $project, $user, $locale, $geodb, $app) {
921+
->inject('utopia')
922+
->action(function ($response, $project, $user, $locale, $geodb, $utopia) {
923923
/** @var Appwrite\Utopia\Response $response */
924924
/** @var Appwrite\Database\Document $project */
925925
/** @var Appwrite\Database\Document $user */
926926
/** @var Utopia\Locale\Locale $locale */
927927
/** @var MaxMind\Db\Reader $geodb */
928-
/** @var Utopia\App $app */
928+
/** @var Utopia\App $utopia */
929929

930-
$adapter = new AuditAdapter($app->getResource('db'));
930+
$adapter = new AuditAdapter($utopia->getResource('db'));
931931
$adapter->setNamespace('app_'.$project->getId());
932932

933933
$audit = new Audit($adapter);
@@ -1668,7 +1668,7 @@
16681668
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
16691669
->label('sdk.response.model', Response::MODEL_TOKEN)
16701670
->label('abuse-limit', 10)
1671-
->label('abuse-key', 'url:{url},email:{param-email}')
1671+
->label('abuse-key', 'url:{url},userId:{userId}')
16721672
->param('url', '', function ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', false, ['clients']) // TODO add built-in confirm page
16731673
->inject('request')
16741674
->inject('response')

app/controllers/api/database.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@
437437
}
438438

439439
$types = [];
440-
foreach ($collection->getAttribute('rules') as $rule) {
440+
foreach ($collection->getAttribute('rules', []) as $rule) {
441441
/** @var Document $rule */
442442
$types[$rule->getAttribute('key')] = $rule->getAttribute('type');
443443
}
@@ -630,4 +630,4 @@
630630
;
631631

632632
$response->noContent();
633-
});
633+
});

app/controllers/api/functions.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -748,20 +748,20 @@
748748
$jwt = ''; // initialize
749749
if (!empty($user->getId())) { // If userId exists, generate a JWT for function
750750

751-
$tokens = $user->getAttribute('tokens', []);
752-
$session = new Document();
751+
$sessions = $user->getAttribute('sessions', []);
752+
$current = new Document();
753753

754-
foreach ($tokens as $token) { /** @var Appwrite\Database\Document $token */
755-
if ($token->getAttribute('secret') == Auth::hash(Auth::$secret)) { // If current session delete the cookies too
756-
$session = $token;
754+
foreach ($sessions as $session) { /** @var Appwrite\Database\Document $session */
755+
if ($session->getAttribute('secret') == Auth::hash(Auth::$secret)) { // If current session delete the cookies too
756+
$current = $session;
757757
}
758758
}
759759

760-
if(!$session->isEmpty()) {
760+
if(!$current->isEmpty()) {
761761
$jwtObj = new JWT(App::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 10); // Instantiate with key, algo, maxAge and leeway.
762762
$jwt = $jwtObj->encode([
763763
'userId' => $user->getId(),
764-
'sessionId' => $session->getId(),
764+
'sessionId' => $current->getId(),
765765
]);
766766
}
767767
}

app/controllers/api/health.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
->label('sdk.method', 'getDB')
4343
->label('sdk.description', '/docs/references/health/get-db.md')
4444
->inject('response')
45-
->inject('app')
46-
->action(function ($response, $app) {
45+
->inject('utopia')
46+
->action(function ($response, $utopia) {
4747
/** @var Appwrite\Utopia\Response $response */
48-
/** @var Utopia\App $app */
49-
$app->getResource('db');
48+
/** @var Utopia\App $utopia */
49+
$utopia->getResource('db');
5050

5151
$response->json(['status' => 'OK']);
5252
});
@@ -60,11 +60,11 @@
6060
->label('sdk.method', 'getCache')
6161
->label('sdk.description', '/docs/references/health/get-cache.md')
6262
->inject('response')
63-
->inject('app')
64-
->action(function ($response, $app) {
63+
->inject('utopia')
64+
->action(function ($response, $utopia) {
6565
/** @var Appwrite\Utopia\Response $response */
66-
/** @var Utopia\App $register */
67-
$app->getResource('cache');
66+
/** @var Utopia\App $utopia */
67+
$utopia->getResource('cache');
6868

6969
$response->json(['status' => 'OK']);
7070
});

0 commit comments

Comments
 (0)