Skip to content

Commit 10ce7f2

Browse files
committed
Merge branch 'master' into snyk-upgrade-938e739a096186b3896edce01bfc998a
2 parents e259eca + 54a61b7 commit 10ce7f2

File tree

8 files changed

+170
-123
lines changed

8 files changed

+170
-123
lines changed

.github/workflows/ci.yml

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: ci
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- '**'
9+
env:
10+
COVERAGE_OPTION: ./node_modules/.bin/nyc
11+
NODE_VERSION: 10
12+
PARSE_SERVER_TEST_TIMEOUT: 20000
13+
jobs:
14+
check-mongo:
15+
strategy:
16+
matrix:
17+
include:
18+
- name: Mongo 4.0.4, ReplicaSet, WiredTiger
19+
MONGODB_VERSION: 4.0.4
20+
MONGODB_TOPOLOGY: replicaset
21+
MONGODB_STORAGE_ENGINE: wiredTiger
22+
NODE_VERSION: 10
23+
- name: Mongo 3.6.21
24+
MONGODB_VERSION: 3.6.21
25+
NODE_VERSION: 10
26+
- name: Redis Cache
27+
PARSE_SERVER_TEST_CACHE: redis
28+
NODE_VERSION: 10
29+
- name: Node 12.12.0
30+
NODE_VERSION: 12.12.0
31+
name: ${{ matrix.name }}
32+
timeout-minutes: 30
33+
runs-on: ubuntu-18.04
34+
services:
35+
redis:
36+
image: redis
37+
ports:
38+
- 6379:6379
39+
env:
40+
MONGODB_VERSION: ${{ matrix.MONGODB_VERSION }}
41+
MONGODB_TOPOLOGY: ${{ matrix.MONGODB_TOPOLOGY }}
42+
MONGODB_STORAGE_ENGINE: ${{ matrix.MONGODB_STORAGE_ENGINE }}
43+
PARSE_SERVER_TEST_CACHE: ${{ matrix.PARSE_SERVER_TEST_CACHE }}
44+
NODE_VERSION: ${{ matrix.NODE_VERSION }}
45+
steps:
46+
- uses: actions/checkout@v2
47+
- name: Use Node.js ${{ matrix.NODE_VERSION }}
48+
uses: actions/setup-node@v1
49+
with:
50+
node-version: ${{ matrix.NODE_VERSION }}
51+
- name: Cache Node.js modules
52+
uses: actions/cache@v2
53+
with:
54+
path: ~/.npm
55+
key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
56+
restore-keys: |
57+
${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-
58+
- name: Install dependencies
59+
run: npm ci
60+
- if: ${{ matrix.name == 'Mongo 3.6.21' }}
61+
run: npm run lint
62+
- run: npm run pretest
63+
- run: npm run coverage
64+
env:
65+
CI: true
66+
- run: bash <(curl -s https://codecov.io/bash)
67+
check-postgres:
68+
name: Postgresql
69+
timeout-minutes: 30
70+
runs-on: ubuntu-18.04
71+
services:
72+
redis:
73+
image: redis
74+
ports:
75+
- 6379:6379
76+
postgres:
77+
image: postgis/postgis:11-3.0
78+
env:
79+
POSTGRES_PASSWORD: postgres
80+
ports:
81+
- 5432:5432
82+
options: >-
83+
--health-cmd pg_isready
84+
--health-interval 10s
85+
--health-timeout 5s
86+
--health-retries 5
87+
env:
88+
PARSE_SERVER_TEST_DB: postgres
89+
POSTGRES_MAJOR_VERSION: 11
90+
PARSE_SERVER_TEST_DATABASE_URI: postgres://postgres:postgres@localhost:5432/parse_server_postgres_adapter_test_database
91+
steps:
92+
- uses: actions/checkout@v2
93+
- name: Use Node.js 10
94+
uses: actions/setup-node@v1
95+
with:
96+
node-version: 10
97+
- name: Cache Node.js modules
98+
uses: actions/cache@v2
99+
with:
100+
path: ~/.npm
101+
key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
102+
restore-keys: |
103+
${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-
104+
- name: Install dependencies
105+
run: npm ci
106+
- run: bash scripts/before_script_postgres.sh
107+
- run: npm run coverage
108+
env:
109+
CI: true
110+
- run: bash <(curl -s https://codecov.io/bash)

.travis.yml

-80
This file was deleted.

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
<p align="center">
1212
<a href="https://twitter.com/intent/follow?screen_name=parseplatform"><img alt="Follow on Twitter" src="https://img.shields.io/twitter/follow/parseplatform?style=social&label=Follow"></a>
13-
<a href="https://travis-ci.org/parse-community/parse-server"><img alt="Build status" src="https://img.shields.io/travis/parse-community/parse-server/master.svg?style=flat"></a>
13+
<a href="https://github.com/parse-community/parse-server/actions?query=workflow%3Aci+branch%3Amaster">
14+
<img alt="Build status" src="https://github.com/parse-community/parse-server/workflows/ci/badge.svg?branch=master">
15+
</a>
1416
<a href="https://codecov.io/github/parse-community/parse-server?branch=master"><img alt="Coverage status" src="https://img.shields.io/codecov/c/github/parse-community/parse-server/master.svg"></a>
1517
<a href="https://www.npmjs.com/package/parse-server"><img alt="npm version" src="https://img.shields.io/npm/v/parse-server.svg?style=flat"></a>
1618
<a href="https://community.parseplatform.org/"><img alt="Join the conversation" src="https://img.shields.io/discourse/https/community.parseplatform.org/topics.svg"></a>

scripts/before_install_postgres.sh

-34
This file was deleted.

scripts/before_script_postgres.sh

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ set -e
44

55
echo "[SCRIPT] Before Script :: Setup Parse DB for Postgres ${POSTGRES_MAJOR_VERSION}"
66

7-
node -e 'require("./lib/index.js")'
8-
greenkeeper-lockfile-update
9-
10-
psql -v ON_ERROR_STOP=1 -p 5433 --username "postgres" --dbname "${POSTGRES_DB}" <<-EOSQL
7+
PGPASSWORD=postgres psql -v ON_ERROR_STOP=1 -h localhost -U postgres <<-EOSQL
118
CREATE DATABASE parse_server_postgres_adapter_test_database;
129
\c parse_server_postgres_adapter_test_database;
1310
CREATE EXTENSION postgis;

spec/CloudCode.spec.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -1633,9 +1633,8 @@ describe('Cloud Code', () => {
16331633

16341634
it('should set the message / success on the job', done => {
16351635
Parse.Cloud.job('myJob', req => {
1636-
req.message('hello');
16371636
const promise = req
1638-
.message()
1637+
.message('hello')
16391638
.then(() => {
16401639
return getJobStatus(req.jobId);
16411640
})
@@ -1716,9 +1715,15 @@ describe('Cloud Code', () => {
17161715
throw new Parse.Error(101, 'Something went wrong');
17171716
});
17181717
const job = await Parse.Cloud.startJob('myJobError');
1719-
const jobStatus = await Parse.Cloud.getJobStatus(job);
1718+
let jobStatus, status;
1719+
while (status !== 'failed') {
1720+
if (jobStatus) {
1721+
await new Promise(resolve => setTimeout(resolve, 10));
1722+
}
1723+
jobStatus = await Parse.Cloud.getJobStatus(job);
1724+
status = jobStatus.get('status');
1725+
}
17201726
expect(jobStatus.get('message')).toEqual('Something went wrong');
1721-
expect(jobStatus.get('status')).toEqual('failed');
17221727
});
17231728

17241729
function getJobStatus(jobId) {

spec/LdapAuth.spec.js

+46
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,49 @@ it('Should fail if the LDAP server encounters an error while searching', done =>
211211
.finally(() => server.close());
212212
});
213213
});
214+
215+
it('Should delete the password from authData after validation', done => {
216+
mockLdapServer(port, 'uid=testuser, o=example', true).then(server => {
217+
const options = {
218+
suffix: 'o=example',
219+
url: `ldap://localhost:${port}`,
220+
dn: 'uid={{id}}, o=example'
221+
};
222+
223+
const authData = { id: 'testuser', password: 'secret' };
224+
225+
ldap
226+
.validateAuthData(authData, options)
227+
.then(() => {
228+
expect(authData).toEqual({ id: 'testuser' });
229+
done();
230+
})
231+
.catch(done.fail)
232+
.finally(() => server.close());
233+
});
234+
});
235+
236+
it('Should not save the password in the user record after authentication', done => {
237+
mockLdapServer(port, 'uid=testuser, o=example', true).then(server => {
238+
const options = {
239+
suffix: 'o=example',
240+
url: `ldap://localhost:${port}`,
241+
dn: 'uid={{id}}, o=example'
242+
};
243+
reconfigureServer({ auth: { ldap: options } }).then(() => {
244+
const authData = { authData: { id: 'testuser', password: 'secret' } };
245+
Parse.User.logInWith('ldap', authData).then((returnedUser) => {
246+
const query = new Parse.Query("User");
247+
query
248+
.equalTo('objectId', returnedUser.id).first({ useMasterKey: true })
249+
.then((user) => {
250+
expect(user.get('authData')).toEqual({ ldap:{ id: 'testuser' }});
251+
expect(user.get('authData').ldap.password).toBeUndefined();
252+
done();
253+
})
254+
.catch(done.fail)
255+
.finally(() => server.close())
256+
})
257+
});
258+
});
259+
});

src/Adapters/Auth/ldap.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function validateAuthData(authData, options) {
2323

2424
return new Promise((resolve, reject) => {
2525
client.bind(userCn, authData.password, ldapError => {
26+
delete(authData.password);
2627
if (ldapError) {
2728
let error;
2829
switch (ldapError.code) {

0 commit comments

Comments
 (0)