Skip to content

Commit ea7837c

Browse files
authored
Merge branch 'alpha' into fix/GHSA-4hf6-3x24-c9m8-v9
2 parents 8ae4801 + 620844d commit ea7837c

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

spec/vulnerabilities.spec.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,53 @@ describe('Vulnerabilities', () => {
245245
});
246246
});
247247

248+
describe('(GHSA-3v4q-4q9g-x83q) Prototype pollution via application ID in trigger store', () => {
249+
const prototypeProperties = ['constructor', 'toString', 'valueOf', 'hasOwnProperty', '__proto__'];
250+
251+
for (const prop of prototypeProperties) {
252+
it(`rejects "${prop}" as application ID in cloud function call`, async () => {
253+
const response = await request({
254+
headers: {
255+
'Content-Type': 'application/json',
256+
'X-Parse-Application-Id': prop,
257+
'X-Parse-REST-API-Key': 'rest',
258+
},
259+
method: 'POST',
260+
url: 'http://localhost:8378/1/functions/testFunction',
261+
body: JSON.stringify({}),
262+
}).catch(e => e);
263+
expect(response.status).toBe(403);
264+
});
265+
266+
it(`rejects "${prop}" as application ID with arbitrary API key in cloud function call`, async () => {
267+
const response = await request({
268+
headers: {
269+
'Content-Type': 'application/json',
270+
'X-Parse-Application-Id': prop,
271+
'X-Parse-REST-API-Key': 'ANY_KEY',
272+
},
273+
method: 'POST',
274+
url: 'http://localhost:8378/1/functions/testFunction',
275+
body: JSON.stringify({}),
276+
}).catch(e => e);
277+
expect(response.status).toBe(403);
278+
});
279+
280+
it(`rejects "${prop}" as application ID in class query`, async () => {
281+
const response = await request({
282+
headers: {
283+
'Content-Type': 'application/json',
284+
'X-Parse-Application-Id': prop,
285+
'X-Parse-REST-API-Key': 'rest',
286+
},
287+
method: 'GET',
288+
url: 'http://localhost:8378/1/classes/TestClass',
289+
}).catch(e => e);
290+
expect(response.status).toBe(403);
291+
});
292+
}
293+
});
294+
248295
describe('Request denylist', () => {
249296
describe('(GHSA-q342-9w2p-57fp) Denylist bypass via sibling nested objects', () => {
250297
it('denies _bsontype:Code after a sibling nested object', async () => {

src/triggers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function validateClassNameForTriggers(className, type) {
8787
return className;
8888
}
8989

90-
const _triggerStore = {};
90+
const _triggerStore = Object.create(null);
9191

9292
const Category = {
9393
Functions: 'Functions',

0 commit comments

Comments
 (0)