init
This commit is contained in:
95
node_modules/cookie-parser/HISTORY.md
generated
vendored
Normal file
95
node_modules/cookie-parser/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
1.4.5 / 2020-03-14
|
||||
==================
|
||||
|
||||
* deps: cookie@0.4.0
|
||||
|
||||
1.4.4 / 2019-02-12
|
||||
==================
|
||||
|
||||
* perf: normalize `secret` argument only once
|
||||
|
||||
1.4.3 / 2016-05-26
|
||||
==================
|
||||
|
||||
* deps: cookie@0.3.1
|
||||
- perf: use for loop in parse
|
||||
|
||||
1.4.2 / 2016-05-20
|
||||
==================
|
||||
|
||||
* deps: cookie@0.2.4
|
||||
- perf: enable strict mode
|
||||
- perf: use for loop in parse
|
||||
- perf: use string concatenation for serialization
|
||||
|
||||
1.4.1 / 2016-01-11
|
||||
==================
|
||||
|
||||
* deps: cookie@0.2.3
|
||||
* perf: enable strict mode
|
||||
|
||||
1.4.0 / 2015-09-18
|
||||
==================
|
||||
|
||||
* Accept array of secrets in addition to a single secret
|
||||
* Fix `JSONCookie` to return `undefined` for non-string arguments
|
||||
* Fix `signedCookie` to return `undefined` for non-string arguments
|
||||
* deps: cookie@0.2.2
|
||||
|
||||
1.3.5 / 2015-05-19
|
||||
==================
|
||||
|
||||
* deps: cookie@0.1.3
|
||||
- Slight optimizations
|
||||
|
||||
1.3.4 / 2015-02-15
|
||||
==================
|
||||
|
||||
* deps: cookie-signature@1.0.6
|
||||
|
||||
1.3.3 / 2014-09-05
|
||||
==================
|
||||
|
||||
* deps: cookie-signature@1.0.5
|
||||
|
||||
1.3.2 / 2014-06-26
|
||||
==================
|
||||
|
||||
* deps: cookie-signature@1.0.4
|
||||
- fix for timing attacks
|
||||
|
||||
1.3.1 / 2014-06-17
|
||||
==================
|
||||
|
||||
* actually export `signedCookie`
|
||||
|
||||
1.3.0 / 2014-06-17
|
||||
==================
|
||||
|
||||
* add `signedCookie` export for single cookie unsigning
|
||||
|
||||
1.2.0 / 2014-06-17
|
||||
==================
|
||||
|
||||
* export parsing functions
|
||||
* `req.cookies` and `req.signedCookies` are now plain objects
|
||||
* slightly faster parsing of many cookies
|
||||
|
||||
1.1.0 / 2014-05-12
|
||||
==================
|
||||
|
||||
* Support for NodeJS version 0.8
|
||||
* deps: cookie@0.1.2
|
||||
- Fix for maxAge == 0
|
||||
- made compat with expires field
|
||||
- tweak maxAge NaN error message
|
||||
|
||||
1.0.1 / 2014-02-20
|
||||
==================
|
||||
|
||||
* add missing dependencies
|
||||
|
||||
1.0.0 / 2014-02-15
|
||||
==================
|
||||
|
||||
* Genesis from `connect`
|
||||
23
node_modules/cookie-parser/LICENSE
generated
vendored
Normal file
23
node_modules/cookie-parser/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
102
node_modules/cookie-parser/README.md
generated
vendored
Normal file
102
node_modules/cookie-parser/README.md
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
# cookie-parser
|
||||
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Parse `Cookie` header and populate `req.cookies` with an object keyed by the
|
||||
cookie names. Optionally you may enable signed cookie support by passing a
|
||||
`secret` string, which assigns `req.secret` so it may be used by other
|
||||
middleware.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install cookie-parser
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var express = require('express')
|
||||
var cookieParser = require('cookie-parser')
|
||||
|
||||
var app = express()
|
||||
app.use(cookieParser())
|
||||
```
|
||||
|
||||
### cookieParser(secret, options)
|
||||
|
||||
- `secret` a string or array used for signing cookies. This is optional and if
|
||||
not specified, will not parse signed cookies. If a string is provided, this
|
||||
is used as the secret. If an array is provided, an attempt will be made to
|
||||
unsign the cookie with each secret in order.
|
||||
- `options` an object that is passed to `cookie.parse` as the second option. Se
|
||||
[cookie](https://www.npmjs.org/package/cookie) for more information.
|
||||
- `decode` a function to decode the value of the cookie
|
||||
|
||||
### cookieParser.JSONCookie(str)
|
||||
|
||||
Parse a cookie value as a JSON cookie. This will return the parsed JSON value
|
||||
if it was a JSON cookie, otherwise, it will return the passed value.
|
||||
|
||||
### cookieParser.JSONCookies(cookies)
|
||||
|
||||
Given an object, this will iterate over the keys and call `JSONCookie` on each
|
||||
value, replacing the original value with the parsed value. This returns the
|
||||
same object that was passed in.
|
||||
|
||||
### cookieParser.signedCookie(str, secret)
|
||||
|
||||
Parse a cookie value as a signed cookie. This will return the parsed unsigned
|
||||
value if it was a signed cookie and the signature was valid. If the value was
|
||||
not signed, the original value is returned. If the value was signed but the
|
||||
signature could not be validated, `false` is returned.
|
||||
|
||||
The `secret` argument can be an array or string. If a string is provided, this
|
||||
is used as the secret. If an array is provided, an attempt will be made to
|
||||
unsign the cookie with each secret in order.
|
||||
|
||||
### cookieParser.signedCookies(cookies, secret)
|
||||
|
||||
Given an object, this will iterate over the keys and check if any value is a
|
||||
signed cookie. If it is a signed cookie and the signature is valid, the key
|
||||
will be deleted from the object and added to the new object that is returned.
|
||||
|
||||
The `secret` argument can be an array or string. If a string is provided, this
|
||||
is used as the secret. If an array is provided, an attempt will be made to
|
||||
unsign the cookie with each secret in order.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var express = require('express')
|
||||
var cookieParser = require('cookie-parser')
|
||||
|
||||
var app = express()
|
||||
app.use(cookieParser())
|
||||
|
||||
app.get('/', function (req, res) {
|
||||
// Cookies that have not been signed
|
||||
console.log('Cookies: ', req.cookies)
|
||||
|
||||
// Cookies that have been signed
|
||||
console.log('Signed Cookies: ', req.signedCookies)
|
||||
})
|
||||
|
||||
app.listen(8080)
|
||||
|
||||
// curl command that sends an HTTP request with two cookies
|
||||
// curl http://127.0.0.1:8080 --cookie "Cho=Kim;Greet=Hello"
|
||||
```
|
||||
|
||||
### [MIT Licensed](LICENSE)
|
||||
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/cookie-parser/master
|
||||
[coveralls-url]: https://coveralls.io/r/expressjs/cookie-parser?branch=master
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/cookie-parser
|
||||
[npm-url]: https://npmjs.org/package/cookie-parser
|
||||
[npm-version-image]: https://badgen.net/npm/v/cookie-parser
|
||||
[travis-image]: https://badgen.net/travis/expressjs/cookie-parser/master
|
||||
[travis-url]: https://travis-ci.org/expressjs/cookie-parser
|
||||
182
node_modules/cookie-parser/index.js
generated
vendored
Normal file
182
node_modules/cookie-parser/index.js
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
/*!
|
||||
* cookie-parser
|
||||
* Copyright(c) 2014 TJ Holowaychuk
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var cookie = require('cookie')
|
||||
var signature = require('cookie-signature')
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = cookieParser
|
||||
module.exports.JSONCookie = JSONCookie
|
||||
module.exports.JSONCookies = JSONCookies
|
||||
module.exports.signedCookie = signedCookie
|
||||
module.exports.signedCookies = signedCookies
|
||||
|
||||
/**
|
||||
* Parse Cookie header and populate `req.cookies`
|
||||
* with an object keyed by the cookie names.
|
||||
*
|
||||
* @param {string|array} [secret] A string (or array of strings) representing cookie signing secret(s).
|
||||
* @param {Object} [options]
|
||||
* @return {Function}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function cookieParser (secret, options) {
|
||||
var secrets = !secret || Array.isArray(secret)
|
||||
? (secret || [])
|
||||
: [secret]
|
||||
|
||||
return function cookieParser (req, res, next) {
|
||||
if (req.cookies) {
|
||||
return next()
|
||||
}
|
||||
|
||||
var cookies = req.headers.cookie
|
||||
|
||||
req.secret = secrets[0]
|
||||
req.cookies = Object.create(null)
|
||||
req.signedCookies = Object.create(null)
|
||||
|
||||
// no cookies
|
||||
if (!cookies) {
|
||||
return next()
|
||||
}
|
||||
|
||||
req.cookies = cookie.parse(cookies, options)
|
||||
|
||||
// parse signed cookies
|
||||
if (secrets.length !== 0) {
|
||||
req.signedCookies = signedCookies(req.cookies, secrets)
|
||||
req.signedCookies = JSONCookies(req.signedCookies)
|
||||
}
|
||||
|
||||
// parse JSON cookies
|
||||
req.cookies = JSONCookies(req.cookies)
|
||||
|
||||
next()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse JSON cookie string.
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Object} Parsed object or undefined if not json cookie
|
||||
* @public
|
||||
*/
|
||||
|
||||
function JSONCookie (str) {
|
||||
if (typeof str !== 'string' || str.substr(0, 2) !== 'j:') {
|
||||
return undefined
|
||||
}
|
||||
|
||||
try {
|
||||
return JSON.parse(str.slice(2))
|
||||
} catch (err) {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse JSON cookies.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Object}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function JSONCookies (obj) {
|
||||
var cookies = Object.keys(obj)
|
||||
var key
|
||||
var val
|
||||
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
key = cookies[i]
|
||||
val = JSONCookie(obj[key])
|
||||
|
||||
if (val) {
|
||||
obj[key] = val
|
||||
}
|
||||
}
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a signed cookie string, return the decoded value.
|
||||
*
|
||||
* @param {String} str signed cookie string
|
||||
* @param {string|array} secret
|
||||
* @return {String} decoded value
|
||||
* @public
|
||||
*/
|
||||
|
||||
function signedCookie (str, secret) {
|
||||
if (typeof str !== 'string') {
|
||||
return undefined
|
||||
}
|
||||
|
||||
if (str.substr(0, 2) !== 's:') {
|
||||
return str
|
||||
}
|
||||
|
||||
var secrets = !secret || Array.isArray(secret)
|
||||
? (secret || [])
|
||||
: [secret]
|
||||
|
||||
for (var i = 0; i < secrets.length; i++) {
|
||||
var val = signature.unsign(str.slice(2), secrets[i])
|
||||
|
||||
if (val !== false) {
|
||||
return val
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse signed cookies, returning an object containing the decoded key/value
|
||||
* pairs, while removing the signed key from obj.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @param {string|array} secret
|
||||
* @return {Object}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function signedCookies (obj, secret) {
|
||||
var cookies = Object.keys(obj)
|
||||
var dec
|
||||
var key
|
||||
var ret = Object.create(null)
|
||||
var val
|
||||
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
key = cookies[i]
|
||||
val = obj[key]
|
||||
dec = signedCookie(val, secret)
|
||||
|
||||
if (val !== dec) {
|
||||
ret[key] = dec
|
||||
delete obj[key]
|
||||
}
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
115
node_modules/cookie-parser/package.json
generated
vendored
Normal file
115
node_modules/cookie-parser/package.json
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"cookie-parser@^1.4.3",
|
||||
"/root/nodejs"
|
||||
]
|
||||
],
|
||||
"_from": "cookie-parser@>=1.4.3 <2.0.0",
|
||||
"_hasShrinkwrap": false,
|
||||
"_id": "cookie-parser@1.4.5",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/cookie-parser",
|
||||
"_nodeVersion": "13.10.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "s3://npm-registry-packages",
|
||||
"tmp": "tmp/cookie-parser_1.4.5_1584245235765_0.23342003180248128"
|
||||
},
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "6.13.7",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "cookie-parser",
|
||||
"raw": "cookie-parser@^1.4.3",
|
||||
"rawSpec": "^1.4.3",
|
||||
"scope": null,
|
||||
"spec": ">=1.4.3 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.5.tgz",
|
||||
"_shasum": "3e572d4b7c0c80f9c61daf604e4336831b5d1d49",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "cookie-parser@^1.4.3",
|
||||
"_where": "/root/nodejs",
|
||||
"author": {
|
||||
"email": "tj@vision-media.ca",
|
||||
"name": "TJ Holowaychuk",
|
||||
"url": "http://tjholowaychuk.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/expressjs/cookie-parser/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"cookie": "0.4.0",
|
||||
"cookie-signature": "1.0.6"
|
||||
},
|
||||
"description": "Parse HTTP request cookies",
|
||||
"devDependencies": {
|
||||
"eslint": "6.8.0",
|
||||
"eslint-config-standard": "14.1.0",
|
||||
"eslint-plugin-import": "2.20.1",
|
||||
"eslint-plugin-markdown": "1.0.2",
|
||||
"eslint-plugin-node": "11.0.0",
|
||||
"eslint-plugin-promise": "4.2.1",
|
||||
"eslint-plugin-standard": "4.0.1",
|
||||
"istanbul": "0.4.5",
|
||||
"mocha": "7.1.0",
|
||||
"supertest": "4.0.2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"fileCount": 5,
|
||||
"integrity": "sha512-f13bPUj/gG/5mDr+xLmSxxDsB9DQiTIfhJS/sqjrmfAWiAN+x2O4i/XguTL9yDZ+/IFDanJ+5x7hC4CXT9Tdzw==",
|
||||
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeban0CRA9TVsSAnZWagAA6voQAKP4wqBgWCDULkBXhFBN\ny4b0JUFyYqbJlIyStbEPZI3bE8KD6YgC0BhPqWcSMrlQoD8iznr5tMERoPZ1\nG1dQFR7InL+G/O/nbEtx1ku4+yqHZqXLnvMkIvGCmQV4G9F79jNLhGCC52z+\niouDL7Y4BjgKMmTWU7UFyh2l+0q6Le13VjiiUxL0bO1bg1guKoKSpdbP7Jme\nP+ufvUX7trAbjyfBGr3v1t6au7a0MY18OzkN9aMxQM5QknWdEBOGFazKUtXW\n2zo3Q+hC6rJUJIuITkqgOBLuTnYfsyv+yuTGN6YFRhZZvJIWFCLnHju5fY24\npLqOQzoqVfo3dnGEGVbemXleoae8/nFXnjr50aXwm8uFlUd6N2ZzWsJ0yXq2\nrp7qNujH9TSHN8Qe47mt4Zk+0ZbwgUPw7pEv/PldFJX6Au8O+KVsVF5QAtZv\n3t6vOLAsiArNa+EhCxfY83kicxrpGNJg4tFs6aEMcvzMCCNHVwWpqdgZDo1W\nwZMIhe94TmwhIOues2z9S3nei77o6F5Ix14i3C9qRIYSAtA0X1QPaNbGdLTt\nwQB5TDdA9QC6foWojkf9FK1EUfa/pUvzX17/YfEY0/uZHl6pwPMGyt48Djzy\ntbPzCtuAQMZV/aujSYGyDJ347gBy0SY2zQZ5NjqXKewNRwiOY060u35Bjj4a\nSa32\r\n=98iH\r\n-----END PGP SIGNATURE-----\r\n",
|
||||
"shasum": "3e572d4b7c0c80f9c61daf604e4336831b5d1d49",
|
||||
"tarball": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.5.tgz",
|
||||
"unpackedSize": 11232
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"gitHead": "2fea3f123a416ca0b666bc34b4b0899df26289b7",
|
||||
"homepage": "https://github.com/expressjs/cookie-parser#readme",
|
||||
"keywords": [
|
||||
"cookie",
|
||||
"middleware"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "defunctzombie",
|
||||
"email": "shtylman@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
}
|
||||
],
|
||||
"name": "cookie-parser",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/expressjs/cookie-parser.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint --plugin markdown --ext js,md .",
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||
},
|
||||
"version": "1.4.5"
|
||||
}
|
||||
Reference in New Issue
Block a user