Merge pull request from GHSA-23r4-5mxp-c7g5
This commit is contained in:
11
CHANGELOG.md
11
CHANGELOG.md
@@ -1,7 +1,16 @@
|
|||||||
## Parse Server Changelog
|
## Parse Server Changelog
|
||||||
|
|
||||||
### master
|
### master
|
||||||
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.5.0...master)
|
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.5.2...master)
|
||||||
|
|
||||||
|
### 4.5.2
|
||||||
|
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.5.1...4.5.2)
|
||||||
|
|
||||||
|
### Security Fixes
|
||||||
|
- 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)
|
||||||
|
|
||||||
|
### 4.5.1
|
||||||
|
*This version was published by mistake and was deprecated.*
|
||||||
|
|
||||||
### 4.5.0
|
### 4.5.0
|
||||||
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.4.0...4.5.0)
|
[Full Changelog](https://github.com/parse-community/parse-server/compare/4.4.0...4.5.0)
|
||||||
|
|||||||
5419
package-lock.json
generated
5419
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "parse-server",
|
"name": "parse-server",
|
||||||
"version": "4.5.0",
|
"version": "4.5.2",
|
||||||
"description": "An express module providing a Parse-compatible API server",
|
"description": "An express module providing a Parse-compatible API server",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -2374,59 +2374,63 @@ describe('Parse.User testing', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('user get session from token on signup', done => {
|
it('user get session from token on signup', async () => {
|
||||||
Promise.resolve()
|
const user = await Parse.User.signUp('finn', 'human', { foo: 'bar' });
|
||||||
.then(() => {
|
const response = await request({
|
||||||
return Parse.User.signUp('finn', 'human', { foo: 'bar' });
|
|
||||||
})
|
|
||||||
.then(user => {
|
|
||||||
request({
|
|
||||||
headers: {
|
headers: {
|
||||||
'X-Parse-Application-Id': 'test',
|
'X-Parse-Application-Id': 'test',
|
||||||
'X-Parse-Session-Token': user.getSessionToken(),
|
'X-Parse-Session-Token': user.getSessionToken(),
|
||||||
'X-Parse-REST-API-Key': 'rest',
|
'X-Parse-REST-API-Key': 'rest',
|
||||||
},
|
},
|
||||||
url: 'http://localhost:8378/1/sessions/me',
|
url: 'http://localhost:8378/1/sessions/me',
|
||||||
}).then(response => {
|
|
||||||
const b = response.data;
|
|
||||||
expect(typeof b.sessionToken).toEqual('string');
|
|
||||||
expect(typeof b.createdWith).toEqual('object');
|
|
||||||
expect(b.createdWith.action).toEqual('signup');
|
|
||||||
expect(typeof b.user).toEqual('object');
|
|
||||||
expect(b.user.objectId).toEqual(user.id);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
const data = response.data;
|
||||||
|
expect(typeof data.sessionToken).toEqual('string');
|
||||||
|
expect(typeof data.createdWith).toEqual('object');
|
||||||
|
expect(data.createdWith.action).toEqual('signup');
|
||||||
|
expect(data.createdWith.authProvider).toEqual('password');
|
||||||
|
expect(typeof data.user).toEqual('object');
|
||||||
|
expect(data.user.objectId).toEqual(user.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('user get session from token on login', done => {
|
it('user get session from token on username/password login', async () => {
|
||||||
Promise.resolve()
|
await Parse.User.signUp('finn', 'human', { foo: 'bar' });
|
||||||
.then(() => {
|
await Parse.User.logOut();
|
||||||
return Parse.User.signUp('finn', 'human', { foo: 'bar' });
|
const user = await Parse.User.logIn('finn', 'human');
|
||||||
})
|
const response = await request({
|
||||||
.then(() => {
|
|
||||||
return Parse.User.logOut().then(() => {
|
|
||||||
return Parse.User.logIn('finn', 'human');
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.then(user => {
|
|
||||||
request({
|
|
||||||
headers: {
|
headers: {
|
||||||
'X-Parse-Application-Id': 'test',
|
'X-Parse-Application-Id': 'test',
|
||||||
'X-Parse-Session-Token': user.getSessionToken(),
|
'X-Parse-Session-Token': user.getSessionToken(),
|
||||||
'X-Parse-REST-API-Key': 'rest',
|
'X-Parse-REST-API-Key': 'rest',
|
||||||
},
|
},
|
||||||
url: 'http://localhost:8378/1/sessions/me',
|
url: 'http://localhost:8378/1/sessions/me',
|
||||||
}).then(response => {
|
|
||||||
const b = response.data;
|
|
||||||
expect(typeof b.sessionToken).toEqual('string');
|
|
||||||
expect(typeof b.createdWith).toEqual('object');
|
|
||||||
expect(b.createdWith.action).toEqual('login');
|
|
||||||
expect(typeof b.user).toEqual('object');
|
|
||||||
expect(b.user.objectId).toEqual(user.id);
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
const data = response.data;
|
||||||
|
expect(typeof data.sessionToken).toEqual('string');
|
||||||
|
expect(typeof data.createdWith).toEqual('object');
|
||||||
|
expect(data.createdWith.action).toEqual('login');
|
||||||
|
expect(data.createdWith.authProvider).toEqual('password');
|
||||||
|
expect(typeof data.user).toEqual('object');
|
||||||
|
expect(data.user.objectId).toEqual(user.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('user get session from token on anonymous login', async () => {
|
||||||
|
const user = await Parse.AnonymousUtils.logIn();
|
||||||
|
const response = await request({
|
||||||
|
headers: {
|
||||||
|
'X-Parse-Application-Id': 'test',
|
||||||
|
'X-Parse-Session-Token': user.getSessionToken(),
|
||||||
|
'X-Parse-REST-API-Key': 'rest',
|
||||||
|
},
|
||||||
|
url: 'http://localhost:8378/1/sessions/me',
|
||||||
|
});
|
||||||
|
const data = response.data;
|
||||||
|
expect(typeof data.sessionToken).toEqual('string');
|
||||||
|
expect(typeof data.createdWith).toEqual('object');
|
||||||
|
expect(data.createdWith.action).toEqual('login');
|
||||||
|
expect(data.createdWith.authProvider).toEqual('anonymous');
|
||||||
|
expect(typeof data.user).toEqual('object');
|
||||||
|
expect(data.user.objectId).toEqual(user.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('user update session with other field', done => {
|
it('user update session with other field', done => {
|
||||||
|
|||||||
@@ -857,7 +857,11 @@ RestWrite.prototype.createSessionToken = async function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { sessionData, createSession } = Auth.createSession(this.config, {
|
if (this.storage['authProvider'] == null && this.data.authData) {
|
||||||
|
this.storage['authProvider'] = Object.keys(this.data.authData).join(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
const { sessionData, createSession } = RestWrite.createSession(this.config, {
|
||||||
userId: this.objectId(),
|
userId: this.objectId(),
|
||||||
createdWith: {
|
createdWith: {
|
||||||
action: this.storage['authProvider'] ? 'login' : 'signup',
|
action: this.storage['authProvider'] ? 'login' : 'signup',
|
||||||
|
|||||||
Reference in New Issue
Block a user