Skip to content

Commit ec6f68e

Browse files
authored
Custom request headers (#636)
* make async `prepareRequestOptions` * get custom request headers with `options.getSigHeaders` * request custom headers when `options.sig` * catch error in `getSigHeaders` * log getSigHeaders error * update user agent workaround * tests: allow use getSigHeaders * use getSigHeaders * debugger: use `getSigHeaders` * bugfix import * bugfix `options undefined` * fix user agent assign priority * Update audit.log * remove debug log * remove debug log
1 parent fd6bcaa commit ec6f68e

6 files changed

Lines changed: 264 additions & 132 deletions

File tree

audit.log

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,72 @@
1-
No known vulnerabilities found
1+
┌─────────────────────┬────────────────────────────────────────────────────────┐
2+
│ high │ path-to-regexp vulnerable to Denial of Service via │
3+
│ │ sequential optional groups │
4+
├─────────────────────┼────────────────────────────────────────────────────────┤
5+
│ Package │ path-to-regexp │
6+
├─────────────────────┼────────────────────────────────────────────────────────┤
7+
│ Vulnerable versions │ >=8.0.0 <8.4.0 │
8+
├─────────────────────┼────────────────────────────────────────────────────────┤
9+
│ Patched versions │ >=8.4.0 │
10+
├─────────────────────┼────────────────────────────────────────────────────────┤
11+
│ Paths │ .>express>router>path-to-regexp │
12+
├─────────────────────┼────────────────────────────────────────────────────────┤
13+
│ More info │ https://github.com/advisories/GHSA-j3q9-mxjg-w52f │
14+
└─────────────────────┴────────────────────────────────────────────────────────┘
15+
┌─────────────────────┬────────────────────────────────────────────────────────┐
16+
│ moderate │ Serialize JavaScript has CPU Exhaustion Denial of │
17+
│ │ Service via crafted array-like objects │
18+
├─────────────────────┼────────────────────────────────────────────────────────┤
19+
│ Package │ serialize-javascript │
20+
├─────────────────────┼────────────────────────────────────────────────────────┤
21+
│ Vulnerable versions │ <7.0.5 │
22+
├─────────────────────┼────────────────────────────────────────────────────────┤
23+
│ Patched versions │ >=7.0.5 │
24+
├─────────────────────┼────────────────────────────────────────────────────────┤
25+
│ Paths │ .>mocha>serialize-javascript │
26+
├─────────────────────┼────────────────────────────────────────────────────────┤
27+
│ More info │ https://github.com/advisories/GHSA-qj8w-gfj5-8c6v │
28+
└─────────────────────┴────────────────────────────────────────────────────────┘
29+
┌─────────────────────┬────────────────────────────────────────────────────────┐
30+
│ moderate │ brace-expansion: Zero-step sequence causes process │
31+
│ │ hang and memory exhaustion │
32+
├─────────────────────┼────────────────────────────────────────────────────────┤
33+
│ Package │ brace-expansion │
34+
├─────────────────────┼────────────────────────────────────────────────────────┤
35+
│ Vulnerable versions │ >=2.0.0 <2.0.3 │
36+
├─────────────────────┼────────────────────────────────────────────────────────┤
37+
│ Patched versions │ >=2.0.3 │
38+
├─────────────────────┼────────────────────────────────────────────────────────┤
39+
│ Paths │ .>mocha>minimatch>brace-expansion │
40+
├─────────────────────┼────────────────────────────────────────────────────────┤
41+
│ More info │ https://github.com/advisories/GHSA-f886-m6hf-6m8v │
42+
└─────────────────────┴────────────────────────────────────────────────────────┘
43+
┌─────────────────────┬────────────────────────────────────────────────────────┐
44+
│ moderate │ brace-expansion: Zero-step sequence causes process │
45+
│ │ hang and memory exhaustion │
46+
├─────────────────────┼────────────────────────────────────────────────────────┤
47+
│ Package │ brace-expansion │
48+
├─────────────────────┼────────────────────────────────────────────────────────┤
49+
│ Vulnerable versions │ >=4.0.0 <5.0.5 │
50+
├─────────────────────┼────────────────────────────────────────────────────────┤
51+
│ Patched versions │ >=5.0.5 │
52+
├─────────────────────┼────────────────────────────────────────────────────────┤
53+
│ Paths │ .>mocha>glob>minimatch>brace-expansion │
54+
├─────────────────────┼────────────────────────────────────────────────────────┤
55+
│ More info │ https://github.com/advisories/GHSA-f886-m6hf-6m8v │
56+
└─────────────────────┴────────────────────────────────────────────────────────┘
57+
┌─────────────────────┬────────────────────────────────────────────────────────┐
58+
│ moderate │ path-to-regexp vulnerable to Regular Expression Denial │
59+
│ │ of Service via multiple wildcards │
60+
├─────────────────────┼────────────────────────────────────────────────────────┤
61+
│ Package │ path-to-regexp │
62+
├─────────────────────┼────────────────────────────────────────────────────────┤
63+
│ Vulnerable versions │ >=8.0.0 <8.4.0 │
64+
├─────────────────────┼────────────────────────────────────────────────────────┤
65+
│ Patched versions │ >=8.4.0 │
66+
├─────────────────────┼────────────────────────────────────────────────────────┤
67+
│ Paths │ .>express>router>path-to-regexp │
68+
├─────────────────────┼────────────────────────────────────────────────────────┤
69+
│ More info │ https://github.com/advisories/GHSA-27v5-c462-wpq7 │
70+
└─────────────────────┴────────────────────────────────────────────────────────┘
71+
5 vulnerabilities found
72+
Severity: 4 moderate | 1 high

lib/request.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,13 @@ export default function(options, iframely_options, callback) {
152152
});
153153
}
154154

155-
if (!options.headers || !options.headers['User-Agent']) {
156-
options.headers = options.headers || {};
157-
options.headers['User-Agent'] = CONFIG.USER_AGENT;
158-
}
159-
160155
iframely_options.registerFetch({
161156
source: 'api',
162157
url: options.uri
163158
});
164159

165-
fetchData(utils.prepareRequestOptions(options, iframely_options))
160+
utils.prepareRequestOptions(options, iframely_options)
161+
.then(request_options => fetchData(request_options))
166162
.then(result => {
167163
finish(null, result);
168164
})

0 commit comments

Comments
 (0)