Comparing version 4.2.0 to 4.2.1
@@ -45,8 +45,9 @@ // Load modules | ||
var id = (key && typeof key === 'object') ? key.id : key; | ||
if (this._pendings[id]) { | ||
this._pendings[id].push(callback); | ||
var pendingsId = '+' + id; // Prefix to avoid conflicts with JS internals (e.g. __proto__) | ||
if (this._pendings[pendingsId]) { | ||
this._pendings[pendingsId].push(callback); | ||
return; | ||
} | ||
this._pendings[id] = [callback]; | ||
this._pendings[pendingsId] = [callback]; | ||
@@ -173,2 +174,3 @@ // Lookup in cache | ||
id = '+' + id; | ||
var pendings = this._pendings[id]; | ||
@@ -175,0 +177,0 @@ delete this._pendings[id]; |
{ | ||
"name": "catbox", | ||
"description": "Multi-strategy object caching service", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"repository": "git://github.com/hapijs/catbox", | ||
@@ -16,3 +16,3 @@ "main": "index", | ||
"hoek": "2.x.x", | ||
"joi": "4.x.x" | ||
"joi": "5.x.x" | ||
}, | ||
@@ -19,0 +19,0 @@ "devDependencies": { |
@@ -47,2 +47,25 @@ // Load modules | ||
it('works with special property names', function (done) { | ||
var client = new Catbox.Client(Import); | ||
var policy = new Catbox.Policy({ expiresIn: 1000 }, client, 'test'); | ||
client.start(function (err) { | ||
expect(err).to.not.exist(); | ||
policy.set('__proto__', '123', null, function (err) { | ||
expect(err).to.not.exist(); | ||
policy.get('__proto__', function (err, value, cached, report) { | ||
expect(err).to.not.exist(); | ||
expect(value).to.equal('123'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
it('finds nothing when using empty policy rules', function (done) { | ||
@@ -49,0 +72,0 @@ |
156468
2301