Socket
Socket
Sign inDemoInstall

@cloudant/cloudant

Package Overview
Dependencies
73
Maintainers
6
Versions
183
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.5.1-SNAPSHOT.29 to 4.5.1-SNAPSHOT.30

4

CHANGES.md

@@ -0,1 +1,5 @@

# Unreleased
- [FIXED] Issue where new session cookies from pre-emptive renewal would not persist beyond the original session
lifetime.
# 4.5.0 (2021-08-26)

@@ -2,0 +6,0 @@ - [IMPROVED] - Document IDs and attachment names are now rejected if they could cause an unexpected

@@ -30,2 +30,46 @@ // Copyright © 2019, 2021 IBM Corp. All rights reserved.

this._tokenExchangeEE = new EventEmitter().setMaxListeners(Infinity);
// START monkey patch for https://github.com/salesforce/tough-cookie/issues/154
// Use the tough-cookie CookieJar from the RequestJar
const cookieJar = this._jar ? this._jar._jar : false;
// Check if we've already patched the jar
if (cookieJar && !cookieJar.cloudantPatch) {
// Set the patching flag
cookieJar.cloudantPatch = true;
// Replace the store's updateCookie function with one that applies a patch to newCookie
const originalUpdateCookieFn = cookieJar.store.updateCookie;
cookieJar.store.updateCookie = function(oldCookie, newCookie, cb) {
// Add current time as an update timestamp to the newCookie
newCookie.cloudantPatchUpdateTime = new Date();
// Replace the cookie's expiryTime function with one that uses cloudantPatchUpdateTime
// in place of creation time to check the expiry.
const originalExpiryTimeFn = newCookie.expiryTime;
newCookie.expiryTime = function(now) {
// The original expiryTime check is relative to a time in this order:
// 1. supplied now argument
// 2. this.creation (original cookie creation time)
// 3. current time
// This patch replaces 2 with an expiry check relative to the cloudantPatchUpdateTime if set instead of
// the creation time by passing it as the now argument.
return originalExpiryTimeFn.call(
newCookie,
newCookie.cloudantPatchUpdateTime || now
);
};
// Finally delegate back to the original update function or the fallback put (which is set by Cookie
// when an update function is not present on the store). Since we always set an update function for our
// patch we need to also provide that fallback.
if (originalUpdateCookieFn) {
originalUpdateCookieFn.call(
cookieJar.store,
oldCookie,
newCookie,
cb
);
} else {
cookieJar.store.putCookie(newCookie, cb);
}
};
}
// END cookie jar monkey patch
}

@@ -32,0 +76,0 @@

2

package.json

@@ -10,3 +10,3 @@ {

},
"version": "4.5.1-SNAPSHOT.29",
"version": "4.5.1-SNAPSHOT.30",
"author": {

@@ -13,0 +13,0 @@ "name": "IBM Cloudant",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc