cookie variable "SID=" conflicts with other .*SID cookies from the same server
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 95
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
SID is too generic of a name for session id cookie. The regex conflicts with php's PHPSESID.
also, there is no way to manage the session variables from the core.js wrapper.
I think the best way to fix it is to rename SID to JSNODESID and to export a configuration object for opts. Also I think the history code in there is inappropriate.. same with the user="guest" stuff.. that's useful for a framework or cms.... so that should be ripped out i think.. then
renaming the sid:
in sessions.js:
if(req.headers.cookie) {
var m = req.headers.cookie.match(/NODEJSSID=([^ ,;]*)/);
if (m) {
m = m[1];
if (sessions[m])
return m;
}
}
...... then ..
Session.prototype.getSetCookieHeaderValue=function(){var parts
parts=['NODEJSSID='+this.id]
---
fixing the opts issue is simple
.. in core.js
exports.opts = exports.opts||{lifetime:604800};
exports.session = function( request, response, callback){
session = sessions.lookupOrCreate(request, exports.opts);
response.setHeader('Set-Cookie', session.getSetCookieHeaderValue());
request.session = session;
request.sessionRoot = sessions.sessionRoot;
callback(request, response);
};
..
then call it like this from the controller:
var http = require('http'),
session = require('sesh');
session.opts.path = "/path";
session.magicSession();
..
anyway, awesome work on the gorilla patch, much love
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading sessions.js for cookie lookup and Set-Cookie generation, then core.js for the wrapper and session options. Review the requested cookie rename, configurable options, and removal of history and guest-user behavior; the work is done when those requested session behaviors are consistently reflected in both entry points.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100