Skip to content

Commit 26f012d

Browse files
authored
Merge branch 'alpha' into slimImage
2 parents 0a32279 + bd82d8e commit 26f012d

30 files changed

+469
-142
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ jobs:
193193
steps:
194194
- name: Fix usage of insecure GitHub protocol
195195
run: sudo git config --system url."https://github".insteadOf "git://github"
196+
- name: Fix git protocol for Node 14
197+
if: ${{ startsWith(matrix.NODE_VERSION, '14.') }}
198+
run: sudo git config --system url."https://github".insteadOf "ssh://git@github"
196199
- uses: actions/checkout@v2
197200
- name: Use Node.js ${{ matrix.NODE_VERSION }}
198201
uses: actions/setup-node@v2

6.0.0.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,26 @@ This document only highlights specific changes that require a longer explanation
44

55
---
66

7+
- [Incompatible git protocol with Node 14](#incompatible-git-protocol-with-node-14)
78
- [Import Statement](#import-statement)
89
- [Asynchronous Initialization](#asynchronous-initialization)
910

1011
---
1112

13+
## Incompatible git protocol with Node 14
14+
15+
Parse Server 6 uses the Node Package Manger (npm) package lock file version 2. While version 2 is supposed to be backwards compatible with version 1, you may still encounter errors due to incompatible git protocols that cannot be interpreted correctly by npm bundled with Node 14.
16+
17+
If you are encountering issues installing Parse Server on Node 14 because of dependency references in the package lock file using the `ssh` protocol, configure git to use the `https` protocol instead:
18+
19+
```
20+
sudo git config --system url."https://github".insteadOf "ssh://git@github"
21+
```
22+
23+
Alternatively you could manually replace the dependency URLs in the package lock file.
24+
25+
⚠️ You could also delete the package lock file and recreate it with Node 14. Keep in mind that doing so you are not using an official version of Parse Server anymore. You may be using dependencies that have not been tested as part of the Parse Server release process.
26+
1227
## Import Statement
1328

1429
The import and initialization syntax has been simplified with more intuitive naming and structure.

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ A big *thank you* 🙏 to our [sponsors](#sponsors) and [backers](#backers) who
6060
- [Configuration](#configuration)
6161
- [Basic Options](#basic-options)
6262
- [Client Key Options](#client-key-options)
63+
- [Access Scopes](#access-scopes)
6364
- [Email Verification and Password Reset](#email-verification-and-password-reset)
6465
- [Password and Account Policy](#password-and-account-policy)
6566
- [Custom Routes](#custom-routes)
@@ -357,6 +358,15 @@ The client keys used with Parse are no longer necessary with Parse Server. If yo
357358
* `restAPIKey`
358359
* `dotNetKey`
359360

361+
## Access Scopes
362+
363+
| Scope | Internal data | Custom data | Restricted by CLP, ACL | Key |
364+
|----------------|---------------|-------------|------------------------|---------------------|
365+
| Internal | r/w | r/w | no | `maintenanceKey` |
366+
| Master | -/- | r/w | no | `masterKey` |
367+
| ReadOnlyMaster | -/- | r/- | no | `readOnlyMasterKey` |
368+
| Session | -/- | r/w | yes | `sessionToken` |
369+
360370
## Email Verification and Password Reset
361371

362372
Verifying user email addresses and enabling password reset via email requires an email adapter. There are many email adapters provided and maintained by the community. The following is an example configuration with an example email adapter. See the [Parse Server Options](https://parseplatform.org/parse-server/api/master/ParseServerOptions.html) for more details and a full list of available options.

changelogs/CHANGELOG_alpha.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
# [6.0.0-alpha.23](https://github.com/parse-community/parse-server/compare/6.0.0-alpha.22...6.0.0-alpha.23) (2023-01-08)
2+
3+
4+
### Features
5+
6+
* Access the internal scope of Parse Server using the new `maintenanceKey`; the internal scope contains unofficial and undocumented fields (prefixed with underscore `_`) which are used internally by Parse Server; you may want to manipulate these fields for out-of-band changes such as data migration or correction tasks; changes within the internal scope of Parse Server may happen at any time without notice or changelog entry, it is therefore recommended to look at the source code of Parse Server to understand the effects of manipulating internal fields before using the key; it is discouraged to use the `maintenanceKey` for routine operations in a production environment; see [access scopes](https://github.com/parse-community/parse-server#access-scopes) ([#8212](https://github.com/parse-community/parse-server/issues/8212)) ([f3bcc93](https://github.com/parse-community/parse-server/commit/f3bcc9365cd6f08b0a32c132e8e5ff6d1b650863))
7+
8+
9+
### BREAKING CHANGES
10+
11+
* Fields in the internal scope of Parse Server (prefixed with underscore `_`) are only returned using the new `maintenanceKey`; previously the `masterKey` allowed reading of internal fields; see [access scopes](https://github.com/parse-community/parse-server#access-scopes) for a comparison of the keys' access permissions (#8212) ([f3bcc93](f3bcc93))
12+
13+
# [6.0.0-alpha.22](https://github.com/parse-community/parse-server/compare/6.0.0-alpha.21...6.0.0-alpha.22) (2023-01-08)
14+
15+
16+
### Features
17+
18+
* Adapt `verifyServerUrl` for new asynchronous Parse Server start-up states ([#8366](https://github.com/parse-community/parse-server/issues/8366)) ([ffa4974](https://github.com/parse-community/parse-server/commit/ffa4974158615fbff4a2692b9db41dcb50d3f77b))
19+
20+
21+
### BREAKING CHANGES
22+
23+
* The method `ParseServer.verifyServerUrl` now returns a promise instead of a callback. ([ffa4974](ffa4974))
24+
125
# [6.0.0-alpha.21](https://github.com/parse-community/parse-server/compare/6.0.0-alpha.20...6.0.0-alpha.21) (2023-01-06)
226

327

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server",
3-
"version": "6.0.0-alpha.21",
3+
"version": "6.0.0-alpha.23",
44
"description": "An express module providing a Parse-compatible API server",
55
"main": "lib/index.js",
66
"repository": {

spec/EmailVerificationToken.spec.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
const Auth = require('../lib/Auth');
34
const Config = require('../lib/Config');
45
const request = require('../lib/request');
56

@@ -262,9 +263,14 @@ describe('Email Verification Token Expiration: ', () => {
262263
})
263264
.then(() => {
264265
const config = Config.get('test');
265-
return config.database.find('_User', {
266-
username: 'sets_email_verify_token_expires_at',
267-
});
266+
return config.database.find(
267+
'_User',
268+
{
269+
username: 'sets_email_verify_token_expires_at',
270+
},
271+
{},
272+
Auth.maintenance(config)
273+
);
268274
})
269275
.then(results => {
270276
expect(results.length).toBe(1);
@@ -499,7 +505,12 @@ describe('Email Verification Token Expiration: ', () => {
499505
.then(() => {
500506
const config = Config.get('test');
501507
return config.database
502-
.find('_User', { username: 'newEmailVerifyTokenOnEmailReset' })
508+
.find(
509+
'_User',
510+
{ username: 'newEmailVerifyTokenOnEmailReset' },
511+
{},
512+
Auth.maintenance(config)
513+
)
503514
.then(results => {
504515
return results[0];
505516
});
@@ -582,7 +593,7 @@ describe('Email Verification Token Expiration: ', () => {
582593
// query for this user again
583594
const config = Config.get('test');
584595
return config.database
585-
.find('_User', { username: 'resends_verification_token' })
596+
.find('_User', { username: 'resends_verification_token' }, {}, Auth.maintenance(config))
586597
.then(results => {
587598
return results[0];
588599
});
@@ -599,6 +610,7 @@ describe('Email Verification Token Expiration: ', () => {
599610
done();
600611
})
601612
.catch(error => {
613+
console.log(error);
602614
jfail(error);
603615
done();
604616
});

spec/Middlewares.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,22 @@ describe('middlewares', () => {
162162
expect(fakeReq.auth.isMaster).toBe(false);
163163
});
164164

165+
it('should not succeed if the ip does not belong to maintenanceKeyIps list', async () => {
166+
const logger = require('../lib/logger').logger;
167+
spyOn(logger, 'error').and.callFake(() => {});
168+
AppCache.put(fakeReq.body._ApplicationId, {
169+
maintenanceKey: 'masterKey',
170+
maintenanceKeyIps: ['10.0.0.0', '10.0.0.1'],
171+
});
172+
fakeReq.ip = '10.0.0.2';
173+
fakeReq.headers['x-parse-maintenance-key'] = 'masterKey';
174+
await new Promise(resolve => middlewares.handleParseHeaders(fakeReq, fakeRes, resolve));
175+
expect(fakeReq.auth.isMaintenance).toBe(false);
176+
expect(logger.error).toHaveBeenCalledWith(
177+
`Request using maintenance key rejected as the request IP address '10.0.0.2' is not set in Parse Server option 'maintenanceKeyIps'.`
178+
);
179+
});
180+
165181
it('should succeed if the ip does belong to masterKeyIps list', async () => {
166182
AppCache.put(fakeReq.body._ApplicationId, {
167183
masterKey: 'masterKey',

spec/ParseLiveQuery.spec.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use strict';
2+
const Auth = require('../lib/Auth');
23
const UserController = require('../lib/Controllers/UserController').UserController;
34
const Config = require('../lib/Config');
45
const validatorFail = () => {
@@ -977,6 +978,7 @@ describe('ParseLiveQuery', function () {
977978
};
978979

979980
await reconfigureServer({
981+
maintenanceKey: 'test2',
980982
liveQuery: {
981983
classNames: [Parse.User],
982984
},
@@ -998,9 +1000,14 @@ describe('ParseLiveQuery', function () {
9981000
.signUp()
9991001
.then(() => {
10001002
const config = Config.get('test');
1001-
return config.database.find('_User', {
1002-
username: 'zxcv',
1003-
});
1003+
return config.database.find(
1004+
'_User',
1005+
{
1006+
username: 'zxcv',
1007+
},
1008+
{},
1009+
Auth.maintenance(config)
1010+
);
10041011
})
10051012
.then(async results => {
10061013
const foundUser = results[0];

spec/ParseServer.spec.js

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,20 @@ describe('Server Url Checks', () => {
2929
server.close(done);
3030
});
3131

32-
it('validate good server url', done => {
32+
it('validate good server url', async () => {
3333
Parse.serverURL = 'http://localhost:13376';
34-
ParseServer.verifyServerUrl(async result => {
35-
if (!result) {
36-
done.fail('Did not pass valid url');
37-
}
38-
await reconfigureServer();
39-
done();
40-
});
34+
const response = await ParseServer.verifyServerUrl();
35+
expect(response).toBeTrue();
4136
});
4237

43-
it('mark bad server url', done => {
38+
it('mark bad server url', async () => {
4439
spyOn(console, 'warn').and.callFake(() => {});
4540
Parse.serverURL = 'notavalidurl';
46-
ParseServer.verifyServerUrl(async result => {
47-
if (result) {
48-
done.fail('Did not mark invalid url');
49-
}
50-
await reconfigureServer();
51-
done();
52-
});
41+
const response = await ParseServer.verifyServerUrl();
42+
expect(response).not.toBeTrue();
43+
expect(console.warn).toHaveBeenCalledWith(
44+
`\nWARNING, Unable to connect to 'notavalidurl' as the URL is invalid. Cloud code and push notifications may be unavailable!\n`
45+
);
5346
});
5447

5548
xit('handleShutdown, close connection', done => {

0 commit comments

Comments
 (0)