Skip to content

Commit 60c5a73

Browse files
authored
fix: Prototype pollution via Cloud Code Webhooks; fixes security vulnerability [GHSA-93vw-8fm5-p2jf](GHSA-93vw-8fm5-p2jf) (parse-community#8305)
1 parent 3e983c4 commit 60c5a73

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

spec/vulnerabilities.spec.js

+11
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,17 @@ describe('Vulnerabilities', () => {
109109
);
110110
});
111111

112+
it('denies expanding existing object with polluted keys', async () => {
113+
const obj = await new Parse.Object('RCE', { a: { foo: [] } }).save();
114+
await reconfigureServer({
115+
requestKeywordDenylist: ['foo'],
116+
});
117+
obj.addUnique('a.foo', 'abc');
118+
await expectAsync(obj.save()).toBeRejectedWith(
119+
new Parse.Error(Parse.Error.INVALID_KEY_NAME, `Prohibited keyword in request data: "foo".`)
120+
);
121+
});
122+
112123
it('denies creating a cloud trigger with polluted data', async () => {
113124
Parse.Cloud.beforeSave('TestObject', ({ object }) => {
114125
object.set('obj', {

src/Controllers/DatabaseController.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,11 @@ class DatabaseController {
17651765
if (this.options && this.options.requestKeywordDenylist) {
17661766
// Scan request data for denied keywords
17671767
for (const keyword of this.options.requestKeywordDenylist) {
1768-
const match = Utils.objectContainsKeyValue({ firstKey: undefined }, keyword.key, undefined);
1768+
const match = Utils.objectContainsKeyValue(
1769+
{ [firstKey]: true, [nextPath]: true },
1770+
keyword.key,
1771+
true
1772+
);
17691773
if (match) {
17701774
throw new Parse.Error(
17711775
Parse.Error.INVALID_KEY_NAME,

0 commit comments

Comments
 (0)