@tinkoff-react-bui/animation 0.0.1-security → 3.8612.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of @tinkoff-react-bui/animation might be problematic. Click here for more details.

@@ -0,0 +1,123 @@
1
+ 0.4.0 / 2019-05-15
2
+ ==================
3
+
4
+ * Add `SameSite=None` support
5
+
6
+ 0.3.1 / 2016-05-26
7
+ ==================
8
+
9
+ * Fix `sameSite: true` to work with draft-7 clients
10
+ - `true` now sends `SameSite=Strict` instead of `SameSite`
11
+
12
+ 0.3.0 / 2016-05-26
13
+ ==================
14
+
15
+ * Add `sameSite` option
16
+ - Replaces `firstPartyOnly` option, never implemented by browsers
17
+ * Improve error message when `encode` is not a function
18
+ * Improve error message when `expires` is not a `Date`
19
+
20
+ 0.2.4 / 2016-05-20
21
+ ==================
22
+
23
+ * perf: enable strict mode
24
+ * perf: use for loop in parse
25
+ * perf: use string concatination for serialization
26
+
27
+ 0.2.3 / 2015-10-25
28
+ ==================
29
+
30
+ * Fix cookie `Max-Age` to never be a floating point number
31
+
32
+ 0.2.2 / 2015-09-17
33
+ ==================
34
+
35
+ * Fix regression when setting empty cookie value
36
+ - Ease the new restriction, which is just basic header-level validation
37
+ * Fix typo in invalid value errors
38
+
39
+ 0.2.1 / 2015-09-17
40
+ ==================
41
+
42
+ * Throw on invalid values provided to `serialize`
43
+ - Ensures the resulting string is a valid HTTP header value
44
+
45
+ 0.2.0 / 2015-08-13
46
+ ==================
47
+
48
+ * Add `firstPartyOnly` option
49
+ * Throw better error for invalid argument to parse
50
+ * perf: hoist regular expression
51
+
52
+ 0.1.5 / 2015-09-17
53
+ ==================
54
+
55
+ * Fix regression when setting empty cookie value
56
+ - Ease the new restriction, which is just basic header-level validation
57
+ * Fix typo in invalid value errors
58
+
59
+ 0.1.4 / 2015-09-17
60
+ ==================
61
+
62
+ * Throw better error for invalid argument to parse
63
+ * Throw on invalid values provided to `serialize`
64
+ - Ensures the resulting string is a valid HTTP header value
65
+
66
+ 0.1.3 / 2015-05-19
67
+ ==================
68
+
69
+ * Reduce the scope of try-catch deopt
70
+ * Remove argument reassignments
71
+
72
+ 0.1.2 / 2014-04-16
73
+ ==================
74
+
75
+ * Remove unnecessary files from npm package
76
+
77
+ 0.1.1 / 2014-02-23
78
+ ==================
79
+
80
+ * Fix bad parse when cookie value contained a comma
81
+ * Fix support for `maxAge` of `0`
82
+
83
+ 0.1.0 / 2013-05-01
84
+ ==================
85
+
86
+ * Add `decode` option
87
+ * Add `encode` option
88
+
89
+ 0.0.6 / 2013-04-08
90
+ ==================
91
+
92
+ * Ignore cookie parts missing `=`
93
+
94
+ 0.0.5 / 2012-10-29
95
+ ==================
96
+
97
+ * Return raw cookie value if value unescape errors
98
+
99
+ 0.0.4 / 2012-06-21
100
+ ==================
101
+
102
+ * Use encode/decodeURIComponent for cookie encoding/decoding
103
+ - Improve server/client interoperability
104
+
105
+ 0.0.3 / 2012-06-06
106
+ ==================
107
+
108
+ * Only escape special characters per the cookie RFC
109
+
110
+ 0.0.2 / 2012-06-01
111
+ ==================
112
+
113
+ * Fix `maxAge` option to not throw error
114
+
115
+ 0.0.1 / 2012-05-28
116
+ ==================
117
+
118
+ * Add more tests
119
+
120
+ 0.0.0 / 2012-05-28
121
+ ==================
122
+
123
+ * Initial release
@@ -0,0 +1,24 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
4
+ Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ 'Software'), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
@@ -0,0 +1,253 @@
1
+ # cookie
2
+
3
+ [![NPM Version][npm-version-image]][npm-url]
4
+ [![NPM Downloads][npm-downloads-image]][npm-url]
5
+ [![Node.js Version][node-version-image]][node-version-url]
6
+ [![Build Status][travis-image]][travis-url]
7
+ [![Test Coverage][coveralls-image]][coveralls-url]
8
+
9
+ Basic HTTP cookie parser and serializer for HTTP servers.
10
+
11
+ ## Installation
12
+
13
+ ```sh
14
+ $ npm install cookie
15
+ ```
16
+
17
+ ## API
18
+
19
+ ```js
20
+ var cookie = require('cookie');
21
+ ```
22
+
23
+ ### cookie.parse(str, options)
24
+
25
+ Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs.
26
+ The `str` argument is the string representing a `Cookie` header value and `options` is an
27
+ optional object containing additional parsing options.
28
+
29
+ ```js
30
+ var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2');
31
+ // { foo: 'bar', equation: 'E=mc^2' }
32
+ ```
33
+
34
+ #### Options
35
+
36
+ `cookie.parse` accepts these properties in the options object.
37
+
38
+ ##### decode
39
+
40
+ Specifies a function that will be used to decode a cookie's value. Since the value of a cookie
41
+ has a limited character set (and must be a simple string), this function can be used to decode
42
+ a previously-encoded cookie value into a JavaScript string or other object.
43
+
44
+ The default function is the global `decodeURIComponent`, which will decode any URL-encoded
45
+ sequences into their byte representations.
46
+
47
+ **note** if an error is thrown from this function, the original, non-decoded cookie value will
48
+ be returned as the cookie's value.
49
+
50
+ ### cookie.serialize(name, value, options)
51
+
52
+ Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the
53
+ name for the cookie, the `value` argument is the value to set the cookie to, and the `options`
54
+ argument is an optional object containing additional serialization options.
55
+
56
+ ```js
57
+ var setCookie = cookie.serialize('foo', 'bar');
58
+ // foo=bar
59
+ ```
60
+
61
+ #### Options
62
+
63
+ `cookie.serialize` accepts these properties in the options object.
64
+
65
+ ##### domain
66
+
67
+ Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6265-5.2.3]. By default, no
68
+ domain is set, and most clients will consider the cookie to apply to only the current domain.
69
+
70
+ ##### encode
71
+
72
+ Specifies a function that will be used to encode a cookie's value. Since value of a cookie
73
+ has a limited character set (and must be a simple string), this function can be used to encode
74
+ a value into a string suited for a cookie's value.
75
+
76
+ The default function is the global `encodeURIComponent`, which will encode a JavaScript string
77
+ into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range.
78
+
79
+ ##### expires
80
+
81
+ Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6265-5.2.1].
82
+ By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and
83
+ will delete it on a condition like exiting a web browser application.
84
+
85
+ **note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and
86
+ `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
87
+ so if both are set, they should point to the same date and time.
88
+
89
+ ##### httpOnly
90
+
91
+ Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6265-5.2.6]. When truthy,
92
+ the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set.
93
+
94
+ **note** be careful when setting this to `true`, as compliant clients will not allow client-side
95
+ JavaScript to see the cookie in `document.cookie`.
96
+
97
+ ##### maxAge
98
+
99
+ Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6265-5.2.2].
100
+ The given number will be converted to an integer by rounding down. By default, no maximum age is set.
101
+
102
+ **note** the [cookie storage model specification][rfc-6265-5.3] states that if both `expires` and
103
+ `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
104
+ so if both are set, they should point to the same date and time.
105
+
106
+ ##### path
107
+
108
+ Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6265-5.2.4]. By default, the path
109
+ is considered the ["default path"][rfc-6265-5.1.4].
110
+
111
+ ##### sameSite
112
+
113
+ Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][rfc-6265bis-03-4.1.2.7].
114
+
115
+ - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
116
+ - `false` will not set the `SameSite` attribute.
117
+ - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
118
+ - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.
119
+ - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
120
+
121
+ More information about the different enforcement levels can be found in
122
+ [the specification][rfc-6265bis-03-4.1.2.7].
123
+
124
+ **note** This is an attribute that has not yet been fully standardized, and may change in the future.
125
+ This also means many clients may ignore this attribute until they understand it.
126
+
127
+ ##### secure
128
+
129
+ Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6265-5.2.5]. When truthy,
130
+ the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
131
+
132
+ **note** be careful when setting this to `true`, as compliant clients will not send the cookie back to
133
+ the server in the future if the browser does not have an HTTPS connection.
134
+
135
+ ## Example
136
+
137
+ The following example uses this module in conjunction with the Node.js core HTTP server
138
+ to prompt a user for their name and display it back on future visits.
139
+
140
+ ```js
141
+ var cookie = require('cookie');
142
+ var escapeHtml = require('escape-html');
143
+ var http = require('http');
144
+ var url = require('url');
145
+
146
+ function onRequest(req, res) {
147
+ // Parse the query string
148
+ var query = url.parse(req.url, true, true).query;
149
+
150
+ if (query && query.name) {
151
+ // Set a new cookie with the name
152
+ res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), {
153
+ httpOnly: true,
154
+ maxAge: 60 * 60 * 24 * 7 // 1 week
155
+ }));
156
+
157
+ // Redirect back after setting cookie
158
+ res.statusCode = 302;
159
+ res.setHeader('Location', req.headers.referer || '/');
160
+ res.end();
161
+ return;
162
+ }
163
+
164
+ // Parse the cookies on the request
165
+ var cookies = cookie.parse(req.headers.cookie || '');
166
+
167
+ // Get the visitor name set in the cookie
168
+ var name = cookies.name;
169
+
170
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8');
171
+
172
+ if (name) {
173
+ res.write('<p>Welcome back, <b>' + escapeHtml(name) + '</b>!</p>');
174
+ } else {
175
+ res.write('<p>Hello, new visitor!</p>');
176
+ }
177
+
178
+ res.write('<form method="GET">');
179
+ res.write('<input placeholder="enter your name" name="name"> <input type="submit" value="Set Name">');
180
+ res.end('</form>');
181
+ }
182
+
183
+ http.createServer(onRequest).listen(3000);
184
+ ```
185
+
186
+ ## Testing
187
+
188
+ ```sh
189
+ $ npm test
190
+ ```
191
+
192
+ ## Benchmark
193
+
194
+ ```
195
+ $ npm run bench
196
+
197
+ > cookie@0.3.1 bench cookie
198
+ > node benchmark/index.js
199
+
200
+ http_parser@2.8.0
201
+ node@6.14.2
202
+ v8@5.1.281.111
203
+ uv@1.16.1
204
+ zlib@1.2.11
205
+ ares@1.10.1-DEV
206
+ icu@58.2
207
+ modules@48
208
+ napi@3
209
+ openssl@1.0.2o
210
+
211
+ > node benchmark/parse.js
212
+
213
+ cookie.parse
214
+
215
+ 6 tests completed.
216
+
217
+ simple x 1,200,691 ops/sec ±1.12% (189 runs sampled)
218
+ decode x 1,012,994 ops/sec ±0.97% (186 runs sampled)
219
+ unquote x 1,074,174 ops/sec ±2.43% (186 runs sampled)
220
+ duplicates x 438,424 ops/sec ±2.17% (184 runs sampled)
221
+ 10 cookies x 147,154 ops/sec ±1.01% (186 runs sampled)
222
+ 100 cookies x 14,274 ops/sec ±1.07% (187 runs sampled)
223
+ ```
224
+
225
+ ## References
226
+
227
+ - [RFC 6265: HTTP State Management Mechanism][rfc-6265]
228
+ - [Same-site Cookies][rfc-6265bis-03-4.1.2.7]
229
+
230
+ [rfc-6265bis-03-4.1.2.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7
231
+ [rfc-6265]: https://tools.ietf.org/html/rfc6265
232
+ [rfc-6265-5.1.4]: https://tools.ietf.org/html/rfc6265#section-5.1.4
233
+ [rfc-6265-5.2.1]: https://tools.ietf.org/html/rfc6265#section-5.2.1
234
+ [rfc-6265-5.2.2]: https://tools.ietf.org/html/rfc6265#section-5.2.2
235
+ [rfc-6265-5.2.3]: https://tools.ietf.org/html/rfc6265#section-5.2.3
236
+ [rfc-6265-5.2.4]: https://tools.ietf.org/html/rfc6265#section-5.2.4
237
+ [rfc-6265-5.2.5]: https://tools.ietf.org/html/rfc6265#section-5.2.5
238
+ [rfc-6265-5.2.6]: https://tools.ietf.org/html/rfc6265#section-5.2.6
239
+ [rfc-6265-5.3]: https://tools.ietf.org/html/rfc6265#section-5.3
240
+
241
+ ## License
242
+
243
+ [MIT](LICENSE)
244
+
245
+ [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/cookie/master
246
+ [coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master
247
+ [node-version-image]: https://badgen.net/npm/node/cookie
248
+ [node-version-url]: https://nodejs.org/en/download
249
+ [npm-downloads-image]: https://badgen.net/npm/dm/cookie
250
+ [npm-url]: https://npmjs.org/package/cookie
251
+ [npm-version-image]: https://badgen.net/npm/v/cookie
252
+ [travis-image]: https://badgen.net/travis/jshttp/cookie/master
253
+ [travis-url]: https://travis-ci.org/jshttp/cookie
@@ -0,0 +1,198 @@
1
+ /*!
2
+ * cookie
3
+ * Copyright(c) 2012-2014 Roman Shtylman
4
+ * Copyright(c) 2015 Douglas Christopher Wilson
5
+ * MIT Licensed
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ /**
11
+ * Module exports.
12
+ * @public
13
+ */
14
+
15
+ exports.parse = parse;
16
+ exports.serialize = serialize;
17
+
18
+ /**
19
+ * Module variables.
20
+ * @private
21
+ */
22
+
23
+ var decode = decodeURIComponent;
24
+ var encode = encodeURIComponent;
25
+ var pairSplitRegExp = /; */;
26
+
27
+ /**
28
+ * RegExp to match field-content in RFC 7230 sec 3.2
29
+ *
30
+ * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
31
+ * field-vchar = VCHAR / obs-text
32
+ * obs-text = %x80-FF
33
+ */
34
+
35
+ var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
36
+
37
+ /**
38
+ * Parse a cookie header.
39
+ *
40
+ * Parse the given cookie header string into an object
41
+ * The object has the various cookies as keys(names) => values
42
+ *
43
+ * @param {string} str
44
+ * @param {object} [options]
45
+ * @return {object}
46
+ * @public
47
+ */
48
+
49
+ function parse(str, options) {
50
+ if (typeof str !== 'string') {
51
+ throw new TypeError('argument str must be a string');
52
+ }
53
+
54
+ var obj = {}
55
+ var opt = options || {};
56
+ var pairs = str.split(pairSplitRegExp);
57
+ var dec = opt.decode || decode;
58
+
59
+ for (var i = 0; i < pairs.length; i++) {
60
+ var pair = pairs[i];
61
+ var eq_idx = pair.indexOf('=');
62
+
63
+ // skip things that don't look like key=value
64
+ if (eq_idx < 0) {
65
+ continue;
66
+ }
67
+
68
+ var key = pair.substr(0, eq_idx).trim()
69
+ var val = pair.substr(++eq_idx, pair.length).trim();
70
+
71
+ // quoted values
72
+ if ('"' == val[0]) {
73
+ val = val.slice(1, -1);
74
+ }
75
+
76
+ // only assign once
77
+ if (undefined == obj[key]) {
78
+ obj[key] = tryDecode(val, dec);
79
+ }
80
+ }
81
+
82
+ return obj;
83
+ }
84
+
85
+ /**
86
+ * Serialize data into a cookie header.
87
+ *
88
+ * Serialize the a name value pair into a cookie string suitable for
89
+ * http headers. An optional options object specified cookie parameters.
90
+ *
91
+ * serialize('foo', 'bar', { httpOnly: true })
92
+ * => "foo=bar; httpOnly"
93
+ *
94
+ * @param {string} name
95
+ * @param {string} val
96
+ * @param {object} [options]
97
+ * @return {string}
98
+ * @public
99
+ */
100
+
101
+ function serialize(name, val, options) {
102
+ var opt = options || {};
103
+ var enc = opt.encode || encode;
104
+
105
+ if (typeof enc !== 'function') {
106
+ throw new TypeError('option encode is invalid');
107
+ }
108
+
109
+ if (!fieldContentRegExp.test(name)) {
110
+ throw new TypeError('argument name is invalid');
111
+ }
112
+
113
+ var value = enc(val);
114
+
115
+ if (value && !fieldContentRegExp.test(value)) {
116
+ throw new TypeError('argument val is invalid');
117
+ }
118
+
119
+ var str = name + '=' + value;
120
+
121
+ if (null != opt.maxAge) {
122
+ var maxAge = opt.maxAge - 0;
123
+ if (isNaN(maxAge)) throw new Error('maxAge should be a Number');
124
+ str += '; Max-Age=' + Math.floor(maxAge);
125
+ }
126
+
127
+ if (opt.domain) {
128
+ if (!fieldContentRegExp.test(opt.domain)) {
129
+ throw new TypeError('option domain is invalid');
130
+ }
131
+
132
+ str += '; Domain=' + opt.domain;
133
+ }
134
+
135
+ if (opt.path) {
136
+ if (!fieldContentRegExp.test(opt.path)) {
137
+ throw new TypeError('option path is invalid');
138
+ }
139
+
140
+ str += '; Path=' + opt.path;
141
+ }
142
+
143
+ if (opt.expires) {
144
+ if (typeof opt.expires.toUTCString !== 'function') {
145
+ throw new TypeError('option expires is invalid');
146
+ }
147
+
148
+ str += '; Expires=' + opt.expires.toUTCString();
149
+ }
150
+
151
+ if (opt.httpOnly) {
152
+ str += '; HttpOnly';
153
+ }
154
+
155
+ if (opt.secure) {
156
+ str += '; Secure';
157
+ }
158
+
159
+ if (opt.sameSite) {
160
+ var sameSite = typeof opt.sameSite === 'string'
161
+ ? opt.sameSite.toLowerCase() : opt.sameSite;
162
+
163
+ switch (sameSite) {
164
+ case true:
165
+ str += '; SameSite=Strict';
166
+ break;
167
+ case 'lax':
168
+ str += '; SameSite=Lax';
169
+ break;
170
+ case 'strict':
171
+ str += '; SameSite=Strict';
172
+ break;
173
+ case 'none':
174
+ str += '; SameSite=None';
175
+ break;
176
+ default:
177
+ throw new TypeError('option sameSite is invalid');
178
+ }
179
+ }
180
+
181
+ return str;
182
+ }
183
+
184
+ /**
185
+ * Try decoding a string using a decoding function.
186
+ *
187
+ * @param {string} str
188
+ * @param {function} decode
189
+ * @private
190
+ */
191
+
192
+ function tryDecode(str, decode) {
193
+ try {
194
+ return decode(str);
195
+ } catch (e) {
196
+ return str;
197
+ }
198
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "cookie",
3
+ "description": "HTTP server cookie parsing and serialization",
4
+ "version": "0.4.0",
5
+ "author": "Roman Shtylman <shtylman@gmail.com>",
6
+ "contributors": [
7
+ "Douglas Christopher Wilson <doug@somethingdoug.com>"
8
+ ],
9
+ "license": "MIT",
10
+ "keywords": [
11
+ "cookie",
12
+ "cookies"
13
+ ],
14
+ "repository": "jshttp/cookie",
15
+ "devDependencies": {
16
+ "beautify-benchmark": "0.2.4",
17
+ "benchmark": "2.1.4",
18
+ "eslint": "5.16.0",
19
+ "eslint-plugin-markdown": "1.0.0",
20
+ "istanbul": "0.4.5",
21
+ "mocha": "6.1.4"
22
+ },
23
+ "files": [
24
+ "HISTORY.md",
25
+ "LICENSE",
26
+ "README.md",
27
+ "index.js"
28
+ ],
29
+ "engines": {
30
+ "node": ">= 0.6"
31
+ },
32
+ "scripts": {
33
+ "bench": "node benchmark/index.js",
34
+ "lint": "eslint --plugin markdown --ext js,md .",
35
+ "test": "mocha --reporter spec --bail --check-leaks test/",
36
+ "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
37
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
38
+ "version": "node scripts/version-history.js && git add HISTORY.md"
39
+ }
40
+ }