Skip to content

Commit 3c1bfe1

Browse files
committed
Identify basic auth & digest auth in authorization header
1 parent e5d4e59 commit 3c1bfe1

10 files changed

Lines changed: 361 additions & 33 deletions

File tree

package-lock.json

Lines changed: 0 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"framer-motion": "^10.16.4",
2121
"fuse.js": "^6.6.2",
2222
"genson-js": "^0.0.8",
23-
"http-auth-utils": "^5.0.1",
2423
"lodash": "^4.17.21",
2524
"openapi3-ts": "^4.1.2",
2625
"radix3": "^1.1.0",

resources/dist.zip

-9.8 KB
Binary file not shown.

src/lib/__fixtures__/basic.ts

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
const basic: chrome.devtools.network.Request = {
2+
getContent() {},
3+
_priority: "High",
4+
_resourceType: "fetch",
5+
cache: {},
6+
connection: "14048",
7+
request: {
8+
method: "GET",
9+
url: "https://httpbin.org/basic-auth/d/d",
10+
httpVersion: "http/2.0",
11+
headers: [
12+
{
13+
name: "authorization",
14+
value: "Basic ZDpk",
15+
},
16+
],
17+
queryString: [],
18+
cookies: [],
19+
headersSize: -1,
20+
bodySize: 0,
21+
},
22+
response: {
23+
status: 200,
24+
statusText: "OK",
25+
httpVersion: "http/2.0",
26+
headers: [
27+
{
28+
name: "access-control-allow-credentials",
29+
value: "true",
30+
},
31+
{
32+
name: "access-control-allow-origin",
33+
value: "*",
34+
},
35+
{
36+
name: "content-length",
37+
value: "44",
38+
},
39+
{
40+
name: "content-type",
41+
value: "application/json",
42+
},
43+
{
44+
name: "date",
45+
value: "Mon, 30 Oct 2023 07:51:43 GMT",
46+
},
47+
{
48+
name: "server",
49+
value: "gunicorn/19.9.0",
50+
},
51+
],
52+
cookies: [],
53+
content: {
54+
size: 44,
55+
mimeType: "application/json",
56+
},
57+
redirectURL: "",
58+
headersSize: -1,
59+
bodySize: -1,
60+
_transferSize: 184,
61+
},
62+
serverIPAddress: "54.83.187.171",
63+
startedDateTime: "2023-10-30T07:51:43.115Z",
64+
time: 428.73000000250715,
65+
timings: {
66+
blocked: 123.52900002598763,
67+
dns: 0.012999999999991019,
68+
ssl: 104.29100000000003,
69+
connect: 204.75600000000003,
70+
send: 0.6009999999999991,
71+
wait: 98.76400000092758,
72+
receive: 1.066999975591898,
73+
},
74+
};
75+
76+
export default basic;

src/lib/__fixtures__/digest.ts

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
const bearer: chrome.devtools.network.Request = {
2+
getContent() {},
3+
cache: {},
4+
_resourceType: "xhr",
5+
connection: "194622",
6+
pageref: "page_3",
7+
request: {
8+
method: "GET",
9+
url: "https://api.example.co/api/board/644efa113e96ce003e4082be/jobs/644efa113e96ce003e4082c9",
10+
httpVersion: "http/2.0",
11+
headers: [
12+
{
13+
name: ":authority",
14+
value: "api.example.com",
15+
},
16+
{
17+
name: ":method",
18+
value: "GET",
19+
},
20+
{
21+
name: ":path",
22+
value:
23+
"/api/board/644efa113e96ce003e4082be/jobs/644efa113e96ce003e4082c9",
24+
},
25+
{
26+
name: ":scheme",
27+
value: "https",
28+
},
29+
{
30+
name: "accept",
31+
value: "application/json, text/plain, */*",
32+
},
33+
{
34+
name: "accept-encoding",
35+
value: "gzip, deflate, br",
36+
},
37+
{
38+
name: "accept-language",
39+
value: "en-GB,en-US;q=0.9,en;q=0.8",
40+
},
41+
{
42+
name: "authorization",
43+
value:
44+
"Digest username=\"Mufasa\", realm=\"testrealm@host.com\", nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", uri=\"/dir/index.html\",",
45+
},
46+
{
47+
name: "cache-control",
48+
value: "no-cache",
49+
},
50+
{
51+
name: "origin",
52+
value: "https://example.com",
53+
},
54+
{
55+
name: "pragma",
56+
value: "no-cache",
57+
},
58+
{
59+
name: "referer",
60+
value: "https://example.com/",
61+
},
62+
{
63+
name: "sec-ch-ua",
64+
value:
65+
'"Chromium";v="118", "Google Chrome";v="118", "Not=A?Brand";v="99"',
66+
},
67+
{
68+
name: "sec-ch-ua-mobile",
69+
value: "?0",
70+
},
71+
{
72+
name: "sec-ch-ua-platform",
73+
value: '"macOS"',
74+
},
75+
{
76+
name: "sec-fetch-dest",
77+
value: "empty",
78+
},
79+
{
80+
name: "sec-fetch-mode",
81+
value: "cors",
82+
},
83+
{
84+
name: "sec-fetch-site",
85+
value: "same-site",
86+
},
87+
{
88+
name: "user-agent",
89+
value:
90+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
91+
},
92+
],
93+
queryString: [],
94+
cookies: [],
95+
headersSize: -1,
96+
bodySize: 0,
97+
},
98+
response: {
99+
status: 200,
100+
statusText: "OK",
101+
httpVersion: "http/2.0",
102+
headers: [
103+
{
104+
name: "access-control-allow-credentials",
105+
value: "true",
106+
},
107+
{
108+
name: "access-control-allow-origin",
109+
value: "https://example.com",
110+
},
111+
{
112+
name: "cf-cache-status",
113+
value: "DYNAMIC",
114+
},
115+
{
116+
name: "cf-ray",
117+
value: "81d960dbbcd539fb-YYZ",
118+
},
119+
{
120+
name: "content-encoding",
121+
value: "br",
122+
},
123+
{
124+
name: "content-type",
125+
value: "application/json; charset=utf-8",
126+
},
127+
{
128+
name: "date",
129+
value: "Sun, 29 Oct 2023 06:31:55 GMT",
130+
},
131+
{
132+
name: "etag",
133+
value: 'W/"RWY0ZNBvNXEP0LB2sU80EQ=="',
134+
},
135+
{
136+
name: "nel",
137+
value:
138+
'{"report_to":"heroku-nel","max_age":3600,"success_fraction":0.005,"failure_fraction":0.05,"response_headers":["Via"]}',
139+
},
140+
{
141+
name: "report-to",
142+
value:
143+
'{"group":"heroku-nel","max_age":3600,"endpoints":[{"url":"https://nel.heroku.com/reports?ts=1698561115&sid=929419e7-33ea-4e2f-85f0-7d8b7cd5cbd6&s=L3cRSWh4mrStaCTqmkJOwhEZcdhCjn2tyQStcNUdWRE%3D"}]}',
144+
},
145+
{
146+
name: "reporting-endpoints",
147+
value:
148+
"heroku-nel=https://nel.heroku.com/reports?ts=1698561115&sid=929419e7-33ea-4e2f-85f0-7d8b7cd5cbd6&s=L3cRSWh4mrStaCTqmkJOwhEZcdhCjn2tyQStcNUdWRE%3D",
149+
},
150+
{
151+
name: "server",
152+
value: "cloudflare",
153+
},
154+
{
155+
name: "strict-transport-security",
156+
value: "max-age=2592000; includeSubDomains",
157+
},
158+
{
159+
name: "vary",
160+
value: "Origin, Accept-Encoding",
161+
},
162+
{
163+
name: "via",
164+
value: "1.1 vegur",
165+
},
166+
{
167+
name: "x-content-type-options",
168+
value: "nosniff",
169+
},
170+
{
171+
name: "x-powered-by",
172+
value: "Express",
173+
},
174+
{
175+
name: "x-ratelimit-limit",
176+
value: "3000",
177+
},
178+
{
179+
name: "x-ratelimit-remaining",
180+
value: "2999",
181+
},
182+
{
183+
name: "x-ratelimit-reset",
184+
value: "1698561155",
185+
},
186+
],
187+
cookies: [],
188+
content: {
189+
size: 18097,
190+
mimeType: "application/json",
191+
},
192+
redirectURL: "",
193+
headersSize: -1,
194+
bodySize: -1,
195+
_transferSize: 5955,
196+
},
197+
serverIPAddress: "104.26.14.205",
198+
startedDateTime: "2023-10-29T06:31:54.137Z",
199+
time: 790.8520000055432,
200+
timings: {
201+
blocked: 462.0410000013709,
202+
dns: -1,
203+
ssl: -1,
204+
connect: -1,
205+
send: 0.14100000000000001,
206+
wait: 327.99000000679865,
207+
receive: 0.6799999973736703,
208+
},
209+
};
210+
211+
export default bearer;

src/lib/__fixtures__/post.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ const post: chrome.devtools.network.Request = {
3535
name: "anonymousid",
3636
value: "aa",
3737
},
38-
{
39-
name: "authorization",
40-
value: "Basic aa==",
41-
},
4238
{
4339
name: "content-length",
4440
value: "6798",

src/lib/endpoints-to-oai31.helpers.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import { Authentication, AuthType } from "../utils/authentication";
1616

1717
export const createSecuritySchemeTypes = (auth?: Authentication): SecuritySchemeObject | undefined => {
1818
if (!auth) return;
19-
if (auth.authType === AuthType.BEARER) {
19+
const isBearer = auth.authType === AuthType.BEARER;
20+
const isBasic = auth.authType === AuthType.BASIC;
21+
const isDigest = auth.authType === AuthType.DIGEST;
22+
if (isBearer || isBasic || isDigest) {
2023
const securitySchemeObject: SecuritySchemeObject = {
2124
type: auth.type,
2225
in: auth.in,

0 commit comments

Comments
 (0)