Skip to content

Commit

Permalink
Revert "feat: add secure cookie override to agent" (#1537)
Browse files Browse the repository at this point in the history
This reverts commit 737697f.
  • Loading branch information
niftylettuce committed Jan 8, 2020
1 parent 737697f commit 40424e6
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 105 deletions.
3 changes: 1 addition & 2 deletions src/agent-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ function Agent() {
'key',
'pfx',
'cert',
'disableTLSCerts',
'sendSecureCookie'
'disableTLSCerts'
].forEach(fn => {
// Default setting for all requests from this agent
Agent.prototype[fn] = function(...args) {
Expand Down
9 changes: 1 addition & 8 deletions src/node/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ function Agent(options) {
if (options.rejectUnauthorized === false) {
this.disableTLSCerts();
}

if (options.sendSecureCookie) {
this.sendSecureCookie();
}
}
}

Expand All @@ -80,14 +76,11 @@ Agent.prototype._saveCookies = function(res) {
*/

Agent.prototype._attachCookies = function(req) {
const sendSecureCookie = Boolean(
this._defaults.find(current => current.fn === 'sendSecureCookie')
);
const url = parse(req.url);
const access = new CookieAccessInfo(
url.hostname,
url.pathname,
url.protocol === 'https:' || sendSecureCookie
url.protocol === 'https:'
);
const cookies = this.jar.getCookies(access).toValueString();
req.cookies = cookies;
Expand Down
13 changes: 0 additions & 13 deletions src/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,19 +646,6 @@ Request.prototype.disableTLSCerts = function() {
return this;
};

/**
* Sends secure cookies on http and https requests
* Be warned this allows cookie hijacking
*
* @return {Request} for chaining
* @api public
*/

Request.prototype.sendSecureCookie = function() {
this._sendSecureCookie = true;
return this;
};

/**
* Return an http[s] request.
*
Expand Down
82 changes: 0 additions & 82 deletions test/node/secure-cookie.js

This file was deleted.

0 comments on commit 40424e6

Please sign in to comment.