@nuvlore/extension-access-pagerduty 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -19
- package/vendor/extension-sso/LICENSE +0 -202
- package/vendor/extension-sso/README.md +0 -35
- package/vendor/extension-sso/commands/okta-login.md +0 -10
- package/vendor/extension-sso/package.json +0 -51
- package/vendor/extension-sso/skills/workday-okta-auth/SKILL.md +0 -20
- package/vendor/extension-sso/src/autoAuth.mjs +0 -25
- package/vendor/extension-sso/src/browserLogin.mjs +0 -1
- package/vendor/extension-sso/src/chromeCookies.mjs +0 -1
- package/vendor/extension-sso/src/cookieJar.mjs +0 -1
- package/vendor/extension-sso/src/extensionAccess.mjs +0 -173
- package/vendor/extension-sso/src/htmlSessionExtract.mjs +0 -1
- package/vendor/extension-sso/src/oktaAppAccess.mjs +0 -133
- package/vendor/extension-sso/src/oktaAppCatalog.mjs +0 -118
- package/vendor/extension-sso/src/oktaAppRead.mjs +0 -119
- package/vendor/extension-sso/src/oktaConfig.mjs +0 -12
- package/vendor/extension-sso/src/oktaSession.mjs +0 -32
- package/vendor/extension-sso/src/serviceOperations.mjs +0 -407
- package/vendor/extension-sso/src/serviceReadSearch.mjs +0 -395
- package/vendor/extension-sso/src/serviceReads.mjs +0 -109
- package/vendor/extension-sso/src/serviceRegistry.mjs +0 -497
- package/vendor/extension-sso/src/sessionAuth.mjs +0 -339
- package/vendor/extension-sso/src/sessionManager.mjs +0 -212
- package/vendor/extension-sso/src/sessionValidate.mjs +0 -74
- package/vendor/extension-sso/src/ssoConfig.mjs +0 -31
- package/vendor/extension-sso/src/ssoHttpRead.mjs +0 -292
- package/vendor/extension-sso/tools/extension-access-tools.shared.mjs +0 -16
- package/vendor/extension-sso/tools/okta-app-tools.shared.mjs +0 -5
- package/vendor/extension-sso/tools/okta-tools.shared.mjs +0 -18
- package/vendor/extension-sso/tools/workday_extension_read.mjs +0 -51
- package/vendor/extension-sso/tools/workday_extension_read_access.mjs +0 -65
- package/vendor/extension-sso/tools/workday_list_extension_access.mjs +0 -39
- package/vendor/extension-sso/tools/workday_list_okta_apps.mjs +0 -18
- package/vendor/extension-sso/tools/workday_list_service_operations.mjs +0 -41
- package/vendor/extension-sso/tools/workday_list_service_read_search_capabilities.mjs +0 -34
- package/vendor/extension-sso/tools/workday_list_services.mjs +0 -31
- package/vendor/extension-sso/tools/workday_okta_app_probe_all.mjs +0 -24
- package/vendor/extension-sso/tools/workday_okta_app_read.mjs +0 -30
- package/vendor/extension-sso/tools/workday_okta_app_read_access.mjs +0 -25
- package/vendor/extension-sso/tools/workday_okta_auth_header.mjs +0 -58
- package/vendor/extension-sso/tools/workday_okta_login.mjs +0 -65
- package/vendor/extension-sso/tools/workday_okta_open_app.mjs +0 -63
- package/vendor/extension-sso/tools/workday_okta_open_service.mjs +0 -63
- package/vendor/extension-sso/tools/workday_okta_status.mjs +0 -35
- package/vendor/extension-sso/tools/workday_service_auth.mjs +0 -65
- package/vendor/extension-sso/tools/workday_service_operation_read.mjs +0 -51
- package/vendor/extension-sso/tools/workday_service_read.mjs +0 -56
- package/vendor/extension-sso/tools/workday_service_search.mjs +0 -62
- package/vendor/extension-sso/tools/workday_sso_cookie_header.mjs +0 -59
- package/vendor/extension-sso/vendor/extension-browser-sso/LICENSE +0 -202
- package/vendor/extension-sso/vendor/extension-browser-sso/README.md +0 -16
- package/vendor/extension-sso/vendor/extension-browser-sso/package.json +0 -47
- package/vendor/extension-sso/vendor/extension-browser-sso/src/autoAuth.mjs +0 -47
- package/vendor/extension-sso/vendor/extension-browser-sso/src/browserHttpRead.mjs +0 -76
- package/vendor/extension-sso/vendor/extension-browser-sso/src/browserLogin.mjs +0 -24
- package/vendor/extension-sso/vendor/extension-browser-sso/src/chromeCookies.mjs +0 -192
- package/vendor/extension-sso/vendor/extension-browser-sso/src/cookieJar.mjs +0 -132
- package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/devops-data-paths.mjs +0 -222
- package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/devops-diagnostics.mjs +0 -440
- package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/enterprise-api-read.mjs +0 -180
- package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/read-only-command-pack.mjs +0 -1
- package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/read-only-plan.mjs +0 -45
- package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/read-only-shell-policy.d.mts +0 -26
- package/vendor/extension-sso/vendor/extension-browser-sso/src/extensions/toolkit/read-only-shell-policy.mjs +0 -170
- package/vendor/extension-sso/vendor/extension-browser-sso/src/htmlSessionExtract.mjs +0 -64
- package/vendor/extension-sso/vendor/extension-read-only-toolkit/LICENSE +0 -202
- package/vendor/extension-sso/vendor/extension-read-only-toolkit/README.md +0 -29
- package/vendor/extension-sso/vendor/extension-read-only-toolkit/package.json +0 -43
- package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/devops-data-paths.mjs +0 -222
- package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/devops-diagnostics.mjs +0 -440
- package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/enterprise-api-read.mjs +0 -180
- package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/read-only-command-pack.mjs +0 -1
- package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/read-only-plan.mjs +0 -45
- package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/read-only-shell-policy.d.mts +0 -26
- package/vendor/extension-sso/vendor/extension-read-only-toolkit/src/read-only-shell-policy.mjs +0 -170
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Apache License
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
http://www.apache.org/licenses/
|
|
5
|
-
|
|
6
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
-
|
|
8
|
-
1. Definitions.
|
|
9
|
-
|
|
10
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
-
|
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
-
the copyright owner that is granting the License.
|
|
15
|
-
|
|
16
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
-
other entities that control, are controlled by, or are under common
|
|
18
|
-
control with that entity. For the purposes of this definition,
|
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
-
direction or management of such entity, whether by contract or
|
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
-
|
|
24
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
-
exercising permissions granted by this License.
|
|
26
|
-
|
|
27
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
-
including but not limited to software source code, documentation
|
|
29
|
-
source, and configuration files.
|
|
30
|
-
|
|
31
|
-
"Object" form shall mean any form resulting from mechanical
|
|
32
|
-
transformation or translation of a Source form, including but
|
|
33
|
-
not limited to compiled object code, generated documentation,
|
|
34
|
-
and conversions to other media types.
|
|
35
|
-
|
|
36
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
-
Object form, made available under the License, as indicated by a
|
|
38
|
-
copyright notice that is included in or attached to the work
|
|
39
|
-
(an example is provided in the Appendix below).
|
|
40
|
-
|
|
41
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
-
form, that is based on (or derived from) the Work and for which the
|
|
43
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
-
the Work and Derivative Works thereof.
|
|
48
|
-
|
|
49
|
-
"Contribution" shall mean any work of authorship, including
|
|
50
|
-
the original version of the Work and any modifications or additions
|
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
-
|
|
63
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
-
subsequently incorporated within the Work.
|
|
66
|
-
|
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
73
|
-
|
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
-
where such license applies only to those patent claims licensable
|
|
80
|
-
by such Contributor that are necessarily infringed by their
|
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a
|
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
-
or contributory patent infringement, then any patent licenses
|
|
87
|
-
granted to You under this License for that Work shall terminate
|
|
88
|
-
as of the date such litigation is filed.
|
|
89
|
-
|
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
-
modifications, and in Source or Object form, provided that You
|
|
93
|
-
meet the following conditions:
|
|
94
|
-
|
|
95
|
-
(a) You must give any other recipients of the Work or
|
|
96
|
-
Derivative Works a copy of this License; and
|
|
97
|
-
|
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
|
99
|
-
stating that You changed the files; and
|
|
100
|
-
|
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
|
103
|
-
attribution notices from the Source form of the Work,
|
|
104
|
-
excluding those notices that do not pertain to any part of
|
|
105
|
-
the Derivative Works; and
|
|
106
|
-
|
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
|
109
|
-
include a readable copy of the attribution notices contained
|
|
110
|
-
within such NOTICE file, excluding those notices that do not
|
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
|
112
|
-
of the following places: within a NOTICE text file distributed
|
|
113
|
-
as part of the Derivative Works; within the Source form or
|
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
|
115
|
-
within a display generated by the Derivative Works, if and
|
|
116
|
-
wherever such third-party notices normally appear. The contents
|
|
117
|
-
of the NOTICE file are for informational purposes only and
|
|
118
|
-
do not modify the License. You may add Your own attribution
|
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
-
that such additional attribution notices cannot be construed
|
|
122
|
-
as modifying the License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
-
|
|
181
|
-
To apply the Apache License to your work, attach the following
|
|
182
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
-
replaced with your own identifying information. (Don't include
|
|
184
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
-
comment syntax for the file format. We also recommend that a
|
|
186
|
-
file or class name and description of purpose be included on the
|
|
187
|
-
same "printed page" as the copyright notice for easier
|
|
188
|
-
identification within third-party archives.
|
|
189
|
-
|
|
190
|
-
Copyright [yyyy] [name of copyright owner]
|
|
191
|
-
|
|
192
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
-
you may not use this file except in compliance with the License.
|
|
194
|
-
You may obtain a copy of the License at
|
|
195
|
-
|
|
196
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
-
|
|
198
|
-
Unless required by applicable law or agreed to in writing, software
|
|
199
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
-
See the License for the specific language governing permissions and
|
|
202
|
-
limitations under the License.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# @nuvlore/extension-browser-sso
|
|
2
|
-
|
|
3
|
-
Generic browser cookie SSO primitives for Nuvlore read-only HTTP GET.
|
|
4
|
-
|
|
5
|
-
## Exports
|
|
6
|
-
|
|
7
|
-
- `auto-auth` — auto-auth flags and retry policy
|
|
8
|
-
- `chrome-cookies` — Chrome cookie import
|
|
9
|
-
- `cookie-jar` — cookie jar persistence
|
|
10
|
-
- `html-session-extract` — HTML login detection
|
|
11
|
-
- `browser-login` — open browser for auth
|
|
12
|
-
- `browser-http-read` — generic `browserReadGet`
|
|
13
|
-
|
|
14
|
-
Products supply domain catalogs and `resolveCookieHeader` wiring.
|
|
15
|
-
|
|
16
|
-
Migrated from the Eldwin browser SSO extension with the package and repository renamed for Nuvlore.
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nuvlore/extension-browser-sso",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"description": "Generic browser cookie SSO session helpers for Nuvlore.",
|
|
5
|
-
"license": "Apache-2.0",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"exports": {
|
|
8
|
-
"./auto-auth": "./src/autoAuth.mjs",
|
|
9
|
-
"./chrome-cookies": "./src/chromeCookies.mjs",
|
|
10
|
-
"./cookie-jar": "./src/cookieJar.mjs",
|
|
11
|
-
"./html-session-extract": "./src/htmlSessionExtract.mjs",
|
|
12
|
-
"./browser-login": "./src/browserLogin.mjs",
|
|
13
|
-
"./browser-http-read": "./src/browserHttpRead.mjs"
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"LICENSE",
|
|
17
|
-
"README.md",
|
|
18
|
-
"src"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"test": "npm run test:unit && npm run test:integration",
|
|
22
|
-
"test:unit": "vitest run test/*.test.ts",
|
|
23
|
-
"test:integration": "vitest run test/integration/*.test.ts"
|
|
24
|
-
},
|
|
25
|
-
"agentRuntimeDistribution": {
|
|
26
|
-
"visibility": "private",
|
|
27
|
-
"group": "browser-sso",
|
|
28
|
-
"serviceGrouping": "single-service",
|
|
29
|
-
"publicService": false,
|
|
30
|
-
"rationale": "Library extension: browser cookie session primitives for read-only HTTP GET."
|
|
31
|
-
},
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"yaml": "^2.8.1",
|
|
34
|
-
"zod": "^4.1.12"
|
|
35
|
-
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"vitest": "^3.1.3"
|
|
38
|
-
},
|
|
39
|
-
"repository": {
|
|
40
|
-
"type": "git",
|
|
41
|
-
"url": "git+https://github.com/nuvlore/extension-browser-sso.git"
|
|
42
|
-
},
|
|
43
|
-
"homepage": "https://github.com/nuvlore/extension-browser-sso#readme",
|
|
44
|
-
"bugs": {
|
|
45
|
-
"url": "https://github.com/nuvlore/extension-browser-sso/issues"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Okta auto-auth defaults.
|
|
3
|
-
* When session is missing or stale, open Chrome so the user can sign in.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export function isAutoAuthEnabled(env = process.env) {
|
|
7
|
-
const workdayFlag = env.WORKDAY_SSO_AUTO_AUTH?.trim();
|
|
8
|
-
const browserFlag = env.BROWSER_SSO_AUTO_AUTH?.trim();
|
|
9
|
-
return (workdayFlag || browserFlag)?.toLowerCase() !== "false";
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/** Normalize auto-auth flags for any Okta read/session path. */
|
|
13
|
-
export function resolveAutoAuthOptions(options = {}) {
|
|
14
|
-
const env = options.env ?? process.env;
|
|
15
|
-
const probeOnly = options.probeOnly === true;
|
|
16
|
-
const autoAuth = probeOnly ? false : (options.autoAuth ?? isAutoAuthEnabled(env));
|
|
17
|
-
const openBrowserOnMissing =
|
|
18
|
-
probeOnly ? false : (options.openBrowserOnMissing ?? autoAuth);
|
|
19
|
-
return {
|
|
20
|
-
...options,
|
|
21
|
-
env,
|
|
22
|
-
autoAuth,
|
|
23
|
-
openBrowserOnMissing,
|
|
24
|
-
probeOnly
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function isAuthStatusResponse(status) {
|
|
29
|
-
return status === 401 || status === 403;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function shouldRetryAuthAfterFailure(error, options = {}) {
|
|
33
|
-
const auth = resolveAutoAuthOptions(options);
|
|
34
|
-
if (auth.probeOnly || auth.openBrowserOnMissing === false || auth._retriedAuth) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
if (error && typeof error === "object" && "status" in error) {
|
|
38
|
-
return isAuthStatusResponse(Number(error.status));
|
|
39
|
-
}
|
|
40
|
-
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
41
|
-
return (
|
|
42
|
-
/\b(401|403)\b/.test(message) ||
|
|
43
|
-
/session not ready|no cookies|not authenticated|requires reauthentication|reauthentication required|reauthenticate/i.test(
|
|
44
|
-
message
|
|
45
|
-
)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { buildRequestUrl, normalizeBaseUrl, parseResponseBody } from "./extensions/toolkit/enterprise-api-read.mjs";
|
|
2
|
-
import { assertNonHtmlApiResponse } from "./extensions/toolkit/devops-diagnostics.mjs";
|
|
3
|
-
import { resolveAutoAuthOptions, shouldRetryAuthAfterFailure } from "./autoAuth.mjs";
|
|
4
|
-
|
|
5
|
-
export function assertReadOnlyGet(input = {}) {
|
|
6
|
-
const method = String(input.method || "GET").toUpperCase();
|
|
7
|
-
if (method !== "GET") {
|
|
8
|
-
throw new Error(`Read-only browser SSO: HTTP method ${method} is not allowed.`);
|
|
9
|
-
}
|
|
10
|
-
const restPath = String(input.restPath || input.path || "");
|
|
11
|
-
if (/^https?:\/\//i.test(restPath)) {
|
|
12
|
-
throw new Error("Use restPath relative to baseUrl, not an absolute URL.");
|
|
13
|
-
}
|
|
14
|
-
if (restPath.includes("..")) {
|
|
15
|
-
throw new Error("restPath cannot contain parent directory traversal.");
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Generic cookie-backed GET read. Caller supplies resolveCookieHeader({ baseUrl, domains }).
|
|
21
|
-
*/
|
|
22
|
-
export async function browserReadGet(input = {}, options = {}) {
|
|
23
|
-
assertReadOnlyGet(input);
|
|
24
|
-
const authOptions = resolveAutoAuthOptions(options);
|
|
25
|
-
const fetchImpl = authOptions.fetchImpl ?? globalThis.fetch;
|
|
26
|
-
const baseUrl = normalizeBaseUrl(input.baseUrl);
|
|
27
|
-
if (!baseUrl) throw new Error("baseUrl is required for browserReadGet.");
|
|
28
|
-
const restPath = String(input.restPath || input.path || "").trim();
|
|
29
|
-
if (!restPath) throw new Error("restPath is required.");
|
|
30
|
-
const resolveCookieHeader = options.resolveCookieHeader;
|
|
31
|
-
if (typeof resolveCookieHeader !== "function") {
|
|
32
|
-
throw new Error("resolveCookieHeader option is required.");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function once() {
|
|
36
|
-
const cookie = await resolveCookieHeader({ ...input, baseUrl, ...authOptions });
|
|
37
|
-
if (!cookie) throw new Error("No browser cookies available for this request.");
|
|
38
|
-
const url = buildRequestUrl(baseUrl, restPath, input.query);
|
|
39
|
-
const response = await fetchImpl(url, {
|
|
40
|
-
method: "GET",
|
|
41
|
-
headers: {
|
|
42
|
-
accept: input.accept ?? "application/json,text/html",
|
|
43
|
-
cookie,
|
|
44
|
-
"user-agent": input.userAgent ?? "Mozilla/5.0 eldwin-browser-sso/0.1",
|
|
45
|
-
...(input.headers ?? {})
|
|
46
|
-
},
|
|
47
|
-
redirect: input.followRedirects ? "follow" : "manual"
|
|
48
|
-
});
|
|
49
|
-
const text = await response.text();
|
|
50
|
-
if (!authOptions.allowHtml) assertNonHtmlApiResponse(input.serviceName ?? "Browser SSO", text);
|
|
51
|
-
const data = parseResponseBody(text);
|
|
52
|
-
if (!response.ok && !authOptions.allowHtml) {
|
|
53
|
-
const error = new Error(`Browser SSO read failed (${response.status}) at ${restPath}`);
|
|
54
|
-
error.status = response.status;
|
|
55
|
-
throw error;
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
readOnly: true,
|
|
59
|
-
method: "GET",
|
|
60
|
-
baseUrl,
|
|
61
|
-
restPath,
|
|
62
|
-
url: url.toString(),
|
|
63
|
-
status: response.status,
|
|
64
|
-
contentType: response.headers.get("content-type"),
|
|
65
|
-
data
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
try {
|
|
70
|
-
return await once();
|
|
71
|
-
} catch (error) {
|
|
72
|
-
if (!shouldRetryAuthAfterFailure(error, authOptions)) throw error;
|
|
73
|
-
if (typeof options.onRetryAuth === "function") await options.onRetryAuth();
|
|
74
|
-
return once();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { execFile } from "node:child_process";
|
|
2
|
-
import { promisify } from "node:util";
|
|
3
|
-
|
|
4
|
-
const execFileAsync = promisify(execFile);
|
|
5
|
-
|
|
6
|
-
export async function openBrowser(url, options = {}) {
|
|
7
|
-
if (process.platform === "darwin") {
|
|
8
|
-
const chromeProfile = options.chromeProfile?.trim();
|
|
9
|
-
const args = chromeProfile
|
|
10
|
-
? ["-a", "Google Chrome", url, "--args", `--profile-directory=${chromeProfile}`]
|
|
11
|
-
: ["-a", "Google Chrome", url];
|
|
12
|
-
await execFileAsync("open", args).catch(async () => {
|
|
13
|
-
await execFileAsync("open", [url]);
|
|
14
|
-
});
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
await execFileAsync("xdg-open", [url]).catch(async () => {
|
|
18
|
-
await execFileAsync("open", [url]);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export async function waitFor(ms) {
|
|
23
|
-
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
24
|
-
}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { execFile, execFileSync } from "node:child_process";
|
|
2
|
-
import { createDecipheriv, pbkdf2Sync } from "node:crypto";
|
|
3
|
-
import { copyFileSync, existsSync, mkdtempSync, readdirSync, rmSync } from "node:fs";
|
|
4
|
-
import { homedir, tmpdir } from "node:os";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
import { promisify } from "node:util";
|
|
7
|
-
|
|
8
|
-
const execFileAsync = promisify(execFile);
|
|
9
|
-
export const CHROME_COOKIE_COMMAND_TIMEOUT_MS = 10000;
|
|
10
|
-
export const CHROME_PROFILE_SCAN_TIMEOUT_MS = 5000;
|
|
11
|
-
|
|
12
|
-
const resolvedChromeCookiesPathCache = new Map();
|
|
13
|
-
|
|
14
|
-
function getChromeEncryptionKey() {
|
|
15
|
-
const password = execFileSync(
|
|
16
|
-
"security",
|
|
17
|
-
["find-generic-password", "-w", "-s", "Chrome Safe Storage", "-a", "Chrome"],
|
|
18
|
-
{ encoding: "utf8", timeout: CHROME_COOKIE_COMMAND_TIMEOUT_MS }
|
|
19
|
-
).trim();
|
|
20
|
-
return pbkdf2Sync(password, "saltysalt", 1003, 16, "sha1");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function normalizeDecryptedValue(plain) {
|
|
24
|
-
if (!plain?.length) return "";
|
|
25
|
-
const asUtf8 = plain.toString("utf8");
|
|
26
|
-
if (/^[\x20-\x7E]+$/.test(asUtf8)) return asUtf8;
|
|
27
|
-
if (plain.length > 32) {
|
|
28
|
-
const trimmed = plain.slice(32).toString("utf8");
|
|
29
|
-
if (trimmed) return trimmed;
|
|
30
|
-
}
|
|
31
|
-
return asUtf8;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function decryptChromeCookie(encryptedValue, key) {
|
|
35
|
-
if (!encryptedValue || encryptedValue.length === 0) return "";
|
|
36
|
-
const prefix = encryptedValue.slice(0, 3).toString("utf8");
|
|
37
|
-
if (prefix === "v10") {
|
|
38
|
-
const iv = Buffer.alloc(16, " ");
|
|
39
|
-
const ciphertext = encryptedValue.slice(3);
|
|
40
|
-
const decipher = createDecipheriv("aes-128-cbc", key, iv);
|
|
41
|
-
const plain = Buffer.concat([decipher.update(ciphertext), decipher.final()]);
|
|
42
|
-
return normalizeDecryptedValue(plain);
|
|
43
|
-
}
|
|
44
|
-
if (prefix === "v11") {
|
|
45
|
-
const iv = encryptedValue.slice(3, 15);
|
|
46
|
-
const payload = encryptedValue.slice(15);
|
|
47
|
-
const tag = payload.slice(-16);
|
|
48
|
-
const ciphertext = payload.slice(0, -16);
|
|
49
|
-
const decipher = createDecipheriv("aes-128-gcm", key, iv);
|
|
50
|
-
decipher.setAuthTag(tag);
|
|
51
|
-
const plain = Buffer.concat([decipher.update(ciphertext), decipher.final()]);
|
|
52
|
-
return normalizeDecryptedValue(plain);
|
|
53
|
-
}
|
|
54
|
-
return normalizeDecryptedValue(encryptedValue);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function chromeExpiryToUnix(expiresUtc) {
|
|
58
|
-
if (!expiresUtc) return undefined;
|
|
59
|
-
const value = Number(expiresUtc);
|
|
60
|
-
if (!Number.isFinite(value) || value <= 0) return undefined;
|
|
61
|
-
return Math.floor(value / 1_000_000 - 11_644_473_600);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async function querySqlite(dbPath, sql) {
|
|
65
|
-
try {
|
|
66
|
-
const { stdout } = await execFileAsync(
|
|
67
|
-
"sqlite3",
|
|
68
|
-
["-separator", "\t", "-noheader", dbPath, sql],
|
|
69
|
-
{ maxBuffer: 8 * 1024 * 1024, timeout: CHROME_COOKIE_COMMAND_TIMEOUT_MS }
|
|
70
|
-
);
|
|
71
|
-
return stdout.trim();
|
|
72
|
-
} catch {
|
|
73
|
-
const script = `import sqlite3,sys; con=sqlite3.connect(sys.argv[1]); cur=con.cursor(); cur.execute(sys.argv[2]); print('\\n'.join('\\t'.join(str(c) for c in row) for row in cur.fetchall()))`;
|
|
74
|
-
const { stdout } = await execFileAsync("python3", ["-c", script, dbPath, sql], {
|
|
75
|
-
maxBuffer: 8 * 1024 * 1024,
|
|
76
|
-
timeout: CHROME_COOKIE_COMMAND_TIMEOUT_MS
|
|
77
|
-
});
|
|
78
|
-
return stdout.trim();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export async function readChromeCookies(cookiesPath, hostPatterns = []) {
|
|
83
|
-
if (!existsSync(cookiesPath)) {
|
|
84
|
-
return [];
|
|
85
|
-
}
|
|
86
|
-
if (process.platform !== "darwin") {
|
|
87
|
-
throw new Error("Chrome cookie import is supported on macOS only for now.");
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const tempDir = mkdtempSync(join(tmpdir(), "eldwin-chrome-"));
|
|
91
|
-
const tempDb = join(tempDir, "Cookies");
|
|
92
|
-
copyFileSync(cookiesPath, tempDb);
|
|
93
|
-
|
|
94
|
-
try {
|
|
95
|
-
const clauses = hostPatterns
|
|
96
|
-
.filter(Boolean)
|
|
97
|
-
.map((pattern) => `host_key LIKE '${pattern.replaceAll("'", "''")}'`);
|
|
98
|
-
const where = clauses.length ? `WHERE ${clauses.join(" OR ")}` : "";
|
|
99
|
-
const rows = await querySqlite(
|
|
100
|
-
tempDb,
|
|
101
|
-
`SELECT host_key, name, path, is_secure, is_httponly, expires_utc, hex(encrypted_value) FROM cookies ${where}`
|
|
102
|
-
);
|
|
103
|
-
if (!rows) return [];
|
|
104
|
-
|
|
105
|
-
const key = getChromeEncryptionKey();
|
|
106
|
-
const cookies = [];
|
|
107
|
-
for (const line of rows.split("\n")) {
|
|
108
|
-
if (!line) continue;
|
|
109
|
-
const [hostKey, name, path, isSecure, isHttpOnly, expiresUtc, encryptedHex] = line.split("\t");
|
|
110
|
-
if (!encryptedHex) continue;
|
|
111
|
-
const encryptedValue = Buffer.from(encryptedHex, "hex");
|
|
112
|
-
const value = decryptChromeCookie(encryptedValue, key);
|
|
113
|
-
if (!value) continue;
|
|
114
|
-
cookies.push({
|
|
115
|
-
domain: hostKey,
|
|
116
|
-
name,
|
|
117
|
-
value,
|
|
118
|
-
path: path || "/",
|
|
119
|
-
secure: isSecure === "1",
|
|
120
|
-
httpOnly: isHttpOnly === "1",
|
|
121
|
-
expires: chromeExpiryToUnix(expiresUtc)
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
return cookies;
|
|
125
|
-
} finally {
|
|
126
|
-
rmSync(tempDir, { recursive: true, force: true });
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function resolveChromeCookiesPath(config) {
|
|
131
|
-
if (existsSync(config.chromeCookiesPath)) {
|
|
132
|
-
return config.chromeCookiesPath;
|
|
133
|
-
}
|
|
134
|
-
if (config.chromeProfileExplicit) {
|
|
135
|
-
return config.chromeCookiesPath;
|
|
136
|
-
}
|
|
137
|
-
const cacheKey = `${config.domain ?? config.ssoDomain ?? ""}\0${config.chromeCookiesPath}`;
|
|
138
|
-
const cachedPath = resolvedChromeCookiesPathCache.get(cacheKey);
|
|
139
|
-
if (cachedPath && existsSync(cachedPath)) return cachedPath;
|
|
140
|
-
|
|
141
|
-
const chromeRoot = join(homedir(), "Library", "Application Support", "Google", "Chrome");
|
|
142
|
-
if (!existsSync(chromeRoot)) return config.chromeCookiesPath;
|
|
143
|
-
|
|
144
|
-
let bestPath = config.chromeCookiesPath;
|
|
145
|
-
let bestCount = 0;
|
|
146
|
-
for (const entry of readdirSync(chromeRoot)) {
|
|
147
|
-
if (entry !== "Default" && !entry.startsWith("Profile")) continue;
|
|
148
|
-
const candidate = join(chromeRoot, entry, "Cookies");
|
|
149
|
-
if (!existsSync(candidate)) continue;
|
|
150
|
-
try {
|
|
151
|
-
const domain = config.domain ?? config.ssoDomain;
|
|
152
|
-
const query = domain
|
|
153
|
-
? (() => {
|
|
154
|
-
const patterns = hostPatternsForDomains([domain]);
|
|
155
|
-
const conditions = patterns.map(
|
|
156
|
-
(pattern) => `host_key LIKE '${pattern.replace(/'/g, "''")}'`
|
|
157
|
-
);
|
|
158
|
-
return `SELECT count(*) FROM cookies WHERE ${conditions.join(" OR ")}`;
|
|
159
|
-
})()
|
|
160
|
-
: "SELECT count(*) FROM cookies";
|
|
161
|
-
const count = Number(
|
|
162
|
-
execFileSync("sqlite3", ["-separator", "\t", "-noheader", candidate, query], {
|
|
163
|
-
timeout: CHROME_PROFILE_SCAN_TIMEOUT_MS
|
|
164
|
-
})
|
|
165
|
-
.toString()
|
|
166
|
-
.trim()
|
|
167
|
-
);
|
|
168
|
-
if (count > bestCount) {
|
|
169
|
-
bestCount = count;
|
|
170
|
-
bestPath = candidate;
|
|
171
|
-
}
|
|
172
|
-
} catch {
|
|
173
|
-
// ignore unreadable profiles
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
if (bestCount > 0) resolvedChromeCookiesPathCache.set(cacheKey, bestPath);
|
|
177
|
-
return bestPath;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export function clearChromeCookiesPathCache() {
|
|
181
|
-
resolvedChromeCookiesPathCache.clear();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export function hostPatternsForDomains(domains) {
|
|
185
|
-
const patterns = new Set();
|
|
186
|
-
for (const domain of domains) {
|
|
187
|
-
const bare = domain.replace(/^\./, "");
|
|
188
|
-
patterns.add(`%${bare}`);
|
|
189
|
-
patterns.add(`%.${bare}`);
|
|
190
|
-
}
|
|
191
|
-
return [...patterns];
|
|
192
|
-
}
|