Skip to content

Commit 98bd7f9

Browse files
authored
Merge pull request #111 from Countly/protp-pollution-fix
Proto pollution fix
2 parents 51b1032 + e0ecbb8 commit 98bd7f9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/countly-bulk-user.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,10 @@ function CountlyBulkUser(conf) {
602602
var change_custom_property = function(key, value, mod) {
603603
key = cc.truncateSingleValue(key, conf.maxKeyLength, "change_custom_property");
604604
value = cc.truncateSingleValue(value, conf.maxValueSize, "change_custom_property");
605-
605+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
606+
cc.log(cc.logLevelEnums.ERROR, "change_custom_property, Provided key is not allowed.");
607+
return;
608+
}
606609
if (!customData[key]) {
607610
customData[key] = {};
608611
}

lib/countly.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,10 @@ Countly.Bulk = Bulk;
865865
var change_custom_property = function(key, value, mod) {
866866
key = cc.truncateSingleValue(key, Countly.maxKeyLength, "change_custom_property", Countly.debug);
867867
value = cc.truncateSingleValue(value, Countly.maxValueSize, "change_custom_property", Countly.debug);
868+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
869+
cc.log(cc.logLevelEnums.ERROR, "change_custom_property, Provided key is not allowed.");
870+
return;
871+
}
868872

869873
if (Countly.check_consent("users")) {
870874
if (!customData[key]) {

0 commit comments

Comments
 (0)