fix: Prototype pollution via Cloud Code Webhooks; fixes security vulnerability [GHSA-93vw-8fm5-p2jf](https://github.com/parse-community/parse-server/security/advisories/GHSA-93vw-8fm5-p2jf) (#8305)
This commit is contained in:
@@ -109,6 +109,17 @@ describe('Vulnerabilities', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('denies expanding existing object with polluted keys', async () => {
|
||||||
|
const obj = await new Parse.Object('RCE', { a: { foo: [] } }).save();
|
||||||
|
await reconfigureServer({
|
||||||
|
requestKeywordDenylist: ['foo'],
|
||||||
|
});
|
||||||
|
obj.addUnique('a.foo', 'abc');
|
||||||
|
await expectAsync(obj.save()).toBeRejectedWith(
|
||||||
|
new Parse.Error(Parse.Error.INVALID_KEY_NAME, `Prohibited keyword in request data: "foo".`)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('denies creating a cloud trigger with polluted data', async () => {
|
it('denies creating a cloud trigger with polluted data', async () => {
|
||||||
Parse.Cloud.beforeSave('TestObject', ({ object }) => {
|
Parse.Cloud.beforeSave('TestObject', ({ object }) => {
|
||||||
object.set('obj', {
|
object.set('obj', {
|
||||||
|
|||||||
@@ -1765,7 +1765,11 @@ class DatabaseController {
|
|||||||
if (this.options && this.options.requestKeywordDenylist) {
|
if (this.options && this.options.requestKeywordDenylist) {
|
||||||
// Scan request data for denied keywords
|
// Scan request data for denied keywords
|
||||||
for (const keyword of this.options.requestKeywordDenylist) {
|
for (const keyword of this.options.requestKeywordDenylist) {
|
||||||
const match = Utils.objectContainsKeyValue({ firstKey: undefined }, keyword.key, undefined);
|
const match = Utils.objectContainsKeyValue(
|
||||||
|
{ [firstKey]: true, [nextPath]: true },
|
||||||
|
keyword.key,
|
||||||
|
true
|
||||||
|
);
|
||||||
if (match) {
|
if (match) {
|
||||||
throw new Parse.Error(
|
throw new Parse.Error(
|
||||||
Parse.Error.INVALID_KEY_NAME,
|
Parse.Error.INVALID_KEY_NAME,
|
||||||
|
|||||||
Reference in New Issue
Block a user