From 7273026add7ec3600ecafd9709511c9b160b856a Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 17 Mar 2022 18:31:22 +1100 Subject: [PATCH 1/9] Update file-adapters.md --- _includes/parse-server/file-adapters.md | 39 +++++++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/_includes/parse-server/file-adapters.md b/_includes/parse-server/file-adapters.md index 49f8126a0..3541783cd 100644 --- a/_includes/parse-server/file-adapters.md +++ b/_includes/parse-server/file-adapters.md @@ -1,3 +1,30 @@ +# Configuring File Upload + +From Parse Server V5.0.0, Parse Server restricts file upload to authenticated users only to improve security. This behaviour can be modified by specifying `fileUpload` options to your Parse Server configuration. + +Available options are: + +`enableForAnonymousUser`: Whether file upload should be allowed for anonymous users +`enableForAuthenticatedUser`: Whether file upload should be allowed for authenticated users +`enableForPublic`: Whether file upload should be allowed for public users + +An example for allowing public file uploads to Parse Server `index.js` is below: + +```javascript +const api = new ParseServer({ + databaseURI: databaseUri || 'mongodb://localhost:27017/dev', + cloud: process.env.PARSE_SERVER_CLOUD || __dirname + '/cloud/main.js', + appId: process.env.PARSE_SERVER_APPLICATION_ID || 'myAppId', + masterKey: process.env.PARSE_SERVER_MASTER_KEY || '', + fileUpload: { + enableForPublic: true, + enableForAnonymousUser: true, + enableForAuthenticatedUser: true, + } +}); +``` + + # Configuring File Adapters Parse Server allows developers to choose from several options when hosting files: @@ -23,7 +50,7 @@ File encryption is available in parse-server 4.4.0+. The `GridStoreAdapter` can To use, simply do any of the following: - Use the environment variable `PARSE_SERVER_ENCRYPTION_KEY` - Pass in --encryptionKey in the command line when starting your server -- Initialize ParseServer with `encryptionKey="Your file encryptionKey"`. +- Initialize ParseServer with `encryptionKey="Your file encryptionKey"`. An example starting your Parse Server in `index.js` is below: @@ -32,13 +59,13 @@ const api = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.PARSE_SERVER_CLOUD || __dirname + '/cloud/main.js', appId: process.env.PARSE_SERVER_APPLICATION_ID || 'myAppId', - masterKey: process.env.PARSE_SERVER_MASTER_KEY || '', + masterKey: process.env.PARSE_SERVER_MASTER_KEY || '', encryptionKey: process.env.PARSE_SERVER_ENCRYPTION_KEY, //Add your file key here. Keep it secret ... }); ``` -Be sure not to lose your key or change it after encrypting files. +Be sure not to lose your key or change it after encrypting files. ### Enabling encryption on a server that already has unencrypted files When this is the case, it is recommended to start up a development parse-server (or a separate process from your main process) that has the same configuration as your production server. On the development server, initialize the file adapter as above with the new key and do the following after initialization in your `index.js`: @@ -69,7 +96,7 @@ const api = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.PARSE_SERVER_CLOUD || __dirname + '/cloud/main.js', appId: process.env.PARSE_SERVER_APPLICATION_ID || 'myAppId', - masterKey: process.env.PARSE_SERVER_MASTER_KEY || '', + masterKey: process.env.PARSE_SERVER_MASTER_KEY || '', //No encryptionKey here ... }); @@ -345,7 +372,7 @@ var api = new ParseServer({ }) ``` -Be sure not to lose your key or change it after encrypting files. +Be sure not to lose your key or change it after encrypting files. ### Enabling encryption on a server that already has unencrypted files When this is the case, it is recommended to start up a development parse-server (or a separate process from your main process) that has the same configuration as your production server. On the development server, initialize the file adapter as above with the new key and do the following after initialization in your `index.js`: @@ -376,7 +403,7 @@ const api = new ParseServer({ databaseURI: databaseUri || 'mongodb://localhost:27017/dev', cloud: process.env.PARSE_SERVER_CLOUD || __dirname + '/cloud/main.js', appId: process.env.PARSE_SERVER_APPLICATION_ID || 'myAppId', - masterKey: process.env.PARSE_SERVER_MASTER_KEY || '', + masterKey: process.env.PARSE_SERVER_MASTER_KEY || '', filesAdapter: new FSFilesAdapter(), //No encryptionKey supplied ... }); From e7e3f455c414b7a5d783f6a8195c5c8dcff75cbb Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 17 Mar 2022 18:31:56 +1100 Subject: [PATCH 2/9] Update file-adapters.md --- _includes/parse-server/file-adapters.md | 1 - 1 file changed, 1 deletion(-) diff --git a/_includes/parse-server/file-adapters.md b/_includes/parse-server/file-adapters.md index 3541783cd..7b2b4404e 100644 --- a/_includes/parse-server/file-adapters.md +++ b/_includes/parse-server/file-adapters.md @@ -24,7 +24,6 @@ const api = new ParseServer({ }); ``` - # Configuring File Adapters Parse Server allows developers to choose from several options when hosting files: From 5336f0909db2ed3eb20d5633a0daf1a5c69a09a3 Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 17 Mar 2022 18:33:46 +1100 Subject: [PATCH 3/9] Update file-adapters.md --- _includes/parse-server/file-adapters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/parse-server/file-adapters.md b/_includes/parse-server/file-adapters.md index 7b2b4404e..0bd6357cc 100644 --- a/_includes/parse-server/file-adapters.md +++ b/_includes/parse-server/file-adapters.md @@ -1,6 +1,6 @@ # Configuring File Upload -From Parse Server V5.0.0, Parse Server restricts file upload to authenticated users only to improve security. This behaviour can be modified by specifying `fileUpload` options to your Parse Server configuration. +From Parse Server V5.0.0, Parse Server restricts file upload to authenticated users only to improve Parse Server's default security. This behaviour can be modified by specifying `fileUpload` options to your Parse Server configuration. Available options are: From 4aff8d6b7f62756f665e395796865ae90d60fa44 Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 17 Mar 2022 18:34:09 +1100 Subject: [PATCH 4/9] Update file-adapters.md --- _includes/parse-server/file-adapters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/parse-server/file-adapters.md b/_includes/parse-server/file-adapters.md index 0bd6357cc..92fe82934 100644 --- a/_includes/parse-server/file-adapters.md +++ b/_includes/parse-server/file-adapters.md @@ -1,6 +1,6 @@ # Configuring File Upload -From Parse Server V5.0.0, Parse Server restricts file upload to authenticated users only to improve Parse Server's default security. This behaviour can be modified by specifying `fileUpload` options to your Parse Server configuration. +Starting at Parse Server V5.0.0, Parse Server restricts file upload to authenticated users only to improve Parse Server's default security. This behaviour can be modified by specifying `fileUpload` options to your Parse Server configuration. Available options are: From 8d02487adda5f244d4da1e067cd6aeaa7d721d2d Mon Sep 17 00:00:00 2001 From: dblythy Date: Tue, 26 Jul 2022 18:49:28 +1000 Subject: [PATCH 5/9] Update file-adapters.md --- _includes/parse-server/file-adapters.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/_includes/parse-server/file-adapters.md b/_includes/parse-server/file-adapters.md index 92fe82934..d44bd3774 100644 --- a/_includes/parse-server/file-adapters.md +++ b/_includes/parse-server/file-adapters.md @@ -1,6 +1,8 @@ # Configuring File Upload -Starting at Parse Server V5.0.0, Parse Server restricts file upload to authenticated users only to improve Parse Server's default security. This behaviour can be modified by specifying `fileUpload` options to your Parse Server configuration. +*Available only on Parse Server starting 5.0.0* + +Parse Server restricts file upload to authenticated users only to improve Parse Server's default security. This behaviour can be modified by specifying `fileUpload` options to your Parse Server configuration. Available options are: @@ -8,7 +10,7 @@ Available options are: `enableForAuthenticatedUser`: Whether file upload should be allowed for authenticated users `enableForPublic`: Whether file upload should be allowed for public users -An example for allowing public file uploads to Parse Server `index.js` is below: +To allow public file uploads to Parse Server: ```javascript const api = new ParseServer({ From 143ea4355366670371992623697b8943fa7c16ad Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 22 Sep 2022 02:10:15 +1000 Subject: [PATCH 6/9] Update _includes/parse-server/file-adapters.md Co-authored-by: Manuel <5673677+mtrezza@users.noreply.github.com> --- _includes/parse-server/file-adapters.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_includes/parse-server/file-adapters.md b/_includes/parse-server/file-adapters.md index 75663e40a..b53250054 100644 --- a/_includes/parse-server/file-adapters.md +++ b/_includes/parse-server/file-adapters.md @@ -6,9 +6,9 @@ Parse Server restricts file upload to authenticated users only to improve Parse Available options are: -`enableForAnonymousUser`: Whether file upload should be allowed for anonymous users -`enableForAuthenticatedUser`: Whether file upload should be allowed for authenticated users -`enableForPublic`: Whether file upload should be allowed for public users +- `enableForAnonymousUser`: Enable file upload for anonymous users +- `enableForAuthenticatedUser`: Enable file upload for authenticated users +- `enableForPublic`: Enable file upload for the public, i.e. everyone To allow public file uploads to Parse Server: From d1f92ebb7cff0849ffc32ec519820284979fc18d Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 22 Sep 2022 02:11:04 +1000 Subject: [PATCH 7/9] Update _includes/parse-server/file-adapters.md Co-authored-by: Manuel <5673677+mtrezza@users.noreply.github.com> --- _includes/parse-server/file-adapters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/parse-server/file-adapters.md b/_includes/parse-server/file-adapters.md index b53250054..c3c71e69c 100644 --- a/_includes/parse-server/file-adapters.md +++ b/_includes/parse-server/file-adapters.md @@ -1,6 +1,6 @@ # Configuring File Upload -*Available only on Parse Server starting 5.0.0* +*Available on Parse Server >=5.0.0* Parse Server restricts file upload to authenticated users only to improve Parse Server's default security. This behaviour can be modified by specifying `fileUpload` options to your Parse Server configuration. From 5a2e4ee9eef69e284e2673b42033badf1c79cad1 Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 22 Sep 2022 02:11:16 +1000 Subject: [PATCH 8/9] Update _includes/parse-server/file-adapters.md Co-authored-by: Manuel <5673677+mtrezza@users.noreply.github.com> --- _includes/parse-server/file-adapters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/parse-server/file-adapters.md b/_includes/parse-server/file-adapters.md index c3c71e69c..39068c4a3 100644 --- a/_includes/parse-server/file-adapters.md +++ b/_includes/parse-server/file-adapters.md @@ -50,7 +50,7 @@ File encryption is available in parse-server 4.4.0+. The `GridStoreAdapter` can To use, simply do any of the following: - Use the environment variable `PARSE_SERVER_ENCRYPTION_KEY` -- Pass in --encryptionKey in the command line when starting your server +- Pass the encryption key via parameter `--encryptionKey` in the command line when starting Parse Server - Initialize ParseServer with `encryptionKey="Your file encryptionKey"`. An example starting your Parse Server in `index.js` is below: From bce6dab5036a90e833412eb455700ba521202c0e Mon Sep 17 00:00:00 2001 From: dblythy Date: Thu, 22 Sep 2022 02:11:25 +1000 Subject: [PATCH 9/9] Update _includes/parse-server/file-adapters.md Co-authored-by: Manuel <5673677+mtrezza@users.noreply.github.com> --- _includes/parse-server/file-adapters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/parse-server/file-adapters.md b/_includes/parse-server/file-adapters.md index 39068c4a3..27b743c29 100644 --- a/_includes/parse-server/file-adapters.md +++ b/_includes/parse-server/file-adapters.md @@ -51,7 +51,7 @@ File encryption is available in parse-server 4.4.0+. The `GridStoreAdapter` can To use, simply do any of the following: - Use the environment variable `PARSE_SERVER_ENCRYPTION_KEY` - Pass the encryption key via parameter `--encryptionKey` in the command line when starting Parse Server -- Initialize ParseServer with `encryptionKey="Your file encryptionKey"`. +- Initialize Parse Server with `encryptionKey="PATH_TO_ENCRYPTION_KEY_FILE`. An example starting your Parse Server in `index.js` is below: