Skip to content

Commit

Permalink
Merge pull request #111 from Countly/protp-pollution-fix
Browse files Browse the repository at this point in the history
Proto pollution fix
  • Loading branch information
turtledreams authored Dec 20, 2024
2 parents 51b1032 + e0ecbb8 commit 98bd7f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/countly-bulk-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,10 @@ function CountlyBulkUser(conf) {
var change_custom_property = function(key, value, mod) {
key = cc.truncateSingleValue(key, conf.maxKeyLength, "change_custom_property");
value = cc.truncateSingleValue(value, conf.maxValueSize, "change_custom_property");

if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
cc.log(cc.logLevelEnums.ERROR, "change_custom_property, Provided key is not allowed.");
return;
}
if (!customData[key]) {
customData[key] = {};
}
Expand Down
4 changes: 4 additions & 0 deletions lib/countly.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,10 @@ Countly.Bulk = Bulk;
var change_custom_property = function(key, value, mod) {
key = cc.truncateSingleValue(key, Countly.maxKeyLength, "change_custom_property", Countly.debug);
value = cc.truncateSingleValue(value, Countly.maxValueSize, "change_custom_property", Countly.debug);
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
cc.log(cc.logLevelEnums.ERROR, "change_custom_property, Provided key is not allowed.");
return;
}

if (Countly.check_consent("users")) {
if (!customData[key]) {
Expand Down

0 comments on commit 98bd7f9

Please sign in to comment.