Skip to content

Commit b34a7c5

Browse files
committed
adapt for master merge
1 parent c66a39f commit b34a7c5

File tree

5 files changed

+84
-65
lines changed

5 files changed

+84
-65
lines changed

CHANGELOG.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22

33
Jump directly to a version:
44

5-
| 4.x |
6-
|-------------------|
7-
| [**4.5.0 (latest release)**](#450) |
8-
| [4.4.0](#440) |
9-
| [4.3.0](#430) |
10-
| [4.2.0](#420) |
11-
| [4.1.0](#410) |
12-
| [4.0.2](#402) |
13-
| [4.0.1](#401) |
14-
| [4.0.0](#400) |
5+
| 4.x |
6+
|------------------------------------|
7+
| [**4.5.2 (latest release)**](#452) |
8+
| [4.5.1](#451) |
9+
| [4.5.0](#450) |
10+
| [4.4.0](#440) |
11+
| [4.3.0](#430) |
12+
| [4.2.0](#420) |
13+
| [4.1.0](#410) |
14+
| [4.0.2](#402) |
15+
| [4.0.1](#401) |
16+
| [4.0.0](#400) |
1517

1618
<details>
1719
<summary>Previous Versions</summary>
@@ -88,7 +90,7 @@ Jump directly to a version:
8890
___
8991

9092
## Unreleased (Master Branch)
91-
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.5.0...master)
93+
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.5.2...master)
9294
### Breaking Changes
9395
- Improved schema caching through database real-time hooks. Reduces DB queries, decreases Parse Query execution time and fixes a potential schema memory leak. If multiple Parse Server instances connect to the same DB (for example behind a load balancer), set the [Parse Server Option](https://parseplatform.org/parse-server/api/master/ParseServerOptions.html) `databaseOptions.enableSchemaHooks: true` to enable this feature and keep the schema in sync across all instances. Failing to do so will cause a schema change to not propagate to other instances and re-syncing will only happen when these instances restart. The options `enableSingleSchemaCache` and `schemaCacheTTL` have been removed. To use this feature with MongoDB, a replica set cluster with [change stream](https://docs.mongodb.com/manual/changeStreams/#availability) support is required. (Diamond Lewis, SebC) [#7214](https://github.com/parse-community/parse-server/issues/7214)
9496
- Added file upload restriction. File upload is now only allowed for authenticated users by default for improved security. To allow file upload also for Anonymous Users or Public, set the `fileUpload` parameter in the [Parse Server Options](https://parseplatform.org/parse-server/api/master/ParseServerOptions.html) (dblythy, Manuel Trezza) [#7071](https://github.com/parse-community/parse-server/pull/7071)
@@ -140,7 +142,16 @@ ___
140142
- Added runtime deprecation warnings (Manuel Trezza) [#7451](https://github.com/parse-community/parse-server/pull/7451)
141143
- Add ability to pass context of an object via a header, X-Parse-Cloud-Context, for Cloud Code triggers. The header addition allows client SDK's to add context without injecting _context in the body of JSON objects (Corey Baker) [#7437](https://github.com/parse-community/parse-server/pull/7437)
142144

143-
___
145+
146+
## 4.5.2
147+
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.5.0...4.5.2)
148+
149+
### Security Fixes
150+
- SECURITY FIX: Fixes incorrect session property `authProvider: password` of anonymous users. When signing up an anonymous user, the session field `createdWith` indicates incorrectly that the session has been created using username and password with `authProvider: password`, instead of an anonymous sign-up with `authProvider: anonymous`. This fixes the issue by setting the correct `authProvider: anonymous` for future sign-ups of anonymous users. This fix does not fix incorrect `authProvider: password` for existing sessions of anonymous users. Consider this if your app logic depends on the `authProvider` field. (Corey Baker) [GHSA-23r4-5mxp-c7g5](https://github.com/parse-community/parse-server/security/advisories/GHSA-23r4-5mxp-c7g5)
151+
152+
## 4.5.1
153+
*This version was published by mistake and was deprecated.*
154+
144155
## 4.5.0
145156
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.4.0...4.5.0)
146157
### Breaking Changes

package-lock.json

Lines changed: 1 addition & 1 deletion
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": "4.5.0",
3+
"version": "4.5.2",
44
"description": "An express module providing a Parse-compatible API server",
55
"main": "lib/index.js",
66
"repository": {

spec/ParseUser.spec.js

Lines changed: 55 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,59 +2377,63 @@ describe('Parse.User testing', () => {
23772377
});
23782378
});
23792379

2380-
it('user get session from token on signup', done => {
2381-
Promise.resolve()
2382-
.then(() => {
2383-
return Parse.User.signUp('finn', 'human', { foo: 'bar' });
2384-
})
2385-
.then(user => {
2386-
request({
2387-
headers: {
2388-
'X-Parse-Application-Id': 'test',
2389-
'X-Parse-Session-Token': user.getSessionToken(),
2390-
'X-Parse-REST-API-Key': 'rest',
2391-
},
2392-
url: 'http://localhost:8378/1/sessions/me',
2393-
}).then(response => {
2394-
const b = response.data;
2395-
expect(typeof b.sessionToken).toEqual('string');
2396-
expect(typeof b.createdWith).toEqual('object');
2397-
expect(b.createdWith.action).toEqual('signup');
2398-
expect(typeof b.user).toEqual('object');
2399-
expect(b.user.objectId).toEqual(user.id);
2400-
done();
2401-
});
2402-
});
2380+
it('user get session from token on signup', async () => {
2381+
const user = await Parse.User.signUp('finn', 'human', { foo: 'bar' });
2382+
const response = await request({
2383+
headers: {
2384+
'X-Parse-Application-Id': 'test',
2385+
'X-Parse-Session-Token': user.getSessionToken(),
2386+
'X-Parse-REST-API-Key': 'rest',
2387+
},
2388+
url: 'http://localhost:8378/1/sessions/me',
2389+
});
2390+
const data = response.data;
2391+
expect(typeof data.sessionToken).toEqual('string');
2392+
expect(typeof data.createdWith).toEqual('object');
2393+
expect(data.createdWith.action).toEqual('signup');
2394+
expect(data.createdWith.authProvider).toEqual('password');
2395+
expect(typeof data.user).toEqual('object');
2396+
expect(data.user.objectId).toEqual(user.id);
24032397
});
24042398

2405-
it('user get session from token on login', done => {
2406-
Promise.resolve()
2407-
.then(() => {
2408-
return Parse.User.signUp('finn', 'human', { foo: 'bar' });
2409-
})
2410-
.then(() => {
2411-
return Parse.User.logOut().then(() => {
2412-
return Parse.User.logIn('finn', 'human');
2413-
});
2414-
})
2415-
.then(user => {
2416-
request({
2417-
headers: {
2418-
'X-Parse-Application-Id': 'test',
2419-
'X-Parse-Session-Token': user.getSessionToken(),
2420-
'X-Parse-REST-API-Key': 'rest',
2421-
},
2422-
url: 'http://localhost:8378/1/sessions/me',
2423-
}).then(response => {
2424-
const b = response.data;
2425-
expect(typeof b.sessionToken).toEqual('string');
2426-
expect(typeof b.createdWith).toEqual('object');
2427-
expect(b.createdWith.action).toEqual('login');
2428-
expect(typeof b.user).toEqual('object');
2429-
expect(b.user.objectId).toEqual(user.id);
2430-
done();
2431-
});
2432-
});
2399+
it('user get session from token on username/password login', async () => {
2400+
await Parse.User.signUp('finn', 'human', { foo: 'bar' });
2401+
await Parse.User.logOut();
2402+
const user = await Parse.User.logIn('finn', 'human');
2403+
const response = await request({
2404+
headers: {
2405+
'X-Parse-Application-Id': 'test',
2406+
'X-Parse-Session-Token': user.getSessionToken(),
2407+
'X-Parse-REST-API-Key': 'rest',
2408+
},
2409+
url: 'http://localhost:8378/1/sessions/me',
2410+
});
2411+
const data = response.data;
2412+
expect(typeof data.sessionToken).toEqual('string');
2413+
expect(typeof data.createdWith).toEqual('object');
2414+
expect(data.createdWith.action).toEqual('login');
2415+
expect(data.createdWith.authProvider).toEqual('password');
2416+
expect(typeof data.user).toEqual('object');
2417+
expect(data.user.objectId).toEqual(user.id);
2418+
});
2419+
2420+
it('user get session from token on anonymous login', async () => {
2421+
const user = await Parse.AnonymousUtils.logIn();
2422+
const response = await request({
2423+
headers: {
2424+
'X-Parse-Application-Id': 'test',
2425+
'X-Parse-Session-Token': user.getSessionToken(),
2426+
'X-Parse-REST-API-Key': 'rest',
2427+
},
2428+
url: 'http://localhost:8378/1/sessions/me',
2429+
});
2430+
const data = response.data;
2431+
expect(typeof data.sessionToken).toEqual('string');
2432+
expect(typeof data.createdWith).toEqual('object');
2433+
expect(data.createdWith.action).toEqual('login');
2434+
expect(data.createdWith.authProvider).toEqual('anonymous');
2435+
expect(typeof data.user).toEqual('object');
2436+
expect(data.user.objectId).toEqual(user.id);
24332437
});
24342438

24352439
it('user update session with other field', done => {

src/RestWrite.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,10 @@ RestWrite.prototype.createSessionToken = async function () {
857857
return;
858858
}
859859

860+
if (this.storage['authProvider'] == null && this.data.authData) {
861+
this.storage['authProvider'] = Object.keys(this.data.authData).join(',');
862+
}
863+
860864
const { sessionData, createSession } = RestWrite.createSession(this.config, {
861865
userId: this.objectId(),
862866
createdWith: {

0 commit comments

Comments
 (0)