@cloudflare/workers-auth 0.6.11 → 0.7.0
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/dist/cf/index.d.mts +6 -6
- package/dist/cf/index.mjs +482 -5
- package/dist/{chunk-YCVYA5LL.mjs → chunk-T63LVVAX.mjs} +18 -17
- package/dist/{keyring-preference-CdaCHp2c.d.mts → keyring-preference-CWjI7ct9.d.mts} +5 -0
- package/dist/metafile-esm.json +1 -1
- package/dist/wrangler/index.d.mts +1 -2
- package/dist/wrangler/index.mjs +1 -2
- package/package.json +2 -2
package/dist/cf/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as ConfigStorage, A as AuthConfigStorage, U as UserAuthConfig, f as OAuthFlowContext, g as ProfileStore } from '../file-format-Bpmgm2Po.mjs';
|
|
2
|
-
import { C as CliDescriptor, A as AuthContext, a as CloudflareAuth, U as UserPreferences, K as KeyringPreferenceContext, S as SetKeyringPreferenceResult } from '../keyring-preference-
|
|
3
|
-
export { b as CloudflareLoginProps } from '../keyring-preference-
|
|
2
|
+
import { C as CliDescriptor, A as AuthContext, a as CloudflareAuth, U as UserPreferences, K as KeyringPreferenceContext, S as SetKeyringPreferenceResult } from '../keyring-preference-CWjI7ct9.mjs';
|
|
3
|
+
export { b as CloudflareLoginProps } from '../keyring-preference-CWjI7ct9.mjs';
|
|
4
4
|
import '@cloudflare/workers-utils';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -14,16 +14,16 @@ declare const defaultAuthConfigStorage: (profile?: string) => AuthConfigStorage;
|
|
|
14
14
|
declare const readAuthConfigFile: (profile?: string) => UserAuthConfig | undefined;
|
|
15
15
|
declare const writeAuthConfigFile: (config: UserAuthConfig, profile?: string) => void;
|
|
16
16
|
|
|
17
|
-
declare const CF_SCOPES: readonly ["openid", "offline", "user:read", "account:read", "access:read", "access:write", "agw:read", "agw:run", "agw:write", "ai:read", "ai:write", "ai-search:read", "ai-search:run", "ai-search:write", "aiaudit:read", "aiaudit:write", "aig:read", "aig:write", "auditlogs:read", "browser:read", "browser:write", "cfone:read", "cfone:write", "cloudchamber:write", "connectivity:admin", "connectivity:bind", "connectivity:read", "constellation:write", "containers:write", "d1:write", "dex:read", "dex:write", "dns_analytics:read", "dns_records:edit", "dns_records:read", "dns_settings:read", "email_routing:write", "email_sending:write", "firstpartytags:write", "images:read", "images:write", "lb:edit", "lb:read", "logpush:read", "logpush:write", "mcp_portals:read", "mcp_portals:write", "notebook-examples:read", "notification:read", "notification:write", "pages:read", "pages:write", "pipelines:read", "pipelines:setup", "pipelines:write", "query_cache:write", "queues:write", "r2_catalog:write", "radar:read", "rag:read", "rag:write", "registrar:read", "registrar:write", "secrets_store:read", "secrets_store:write", "sso-connector:read", "sso-connector:write", "ssl_certs:write", "teams:pii", "teams:read", "teams:secure_location", "teams:write", "url_scanner:read", "url_scanner:write", "vectorize:write", "workers:read", "workers:write", "workers_builds:read", "workers_builds:write", "workers_deployments:read", "workers_kv:write", "workers_observability:read", "workers_observability:write", "workers_observability_telemetry:write", "workers_routes:write", "workers_scripts:write", "workers_tail:read", "zone:read"];
|
|
17
|
+
declare const CF_REGISTERED_SCOPES: readonly ["access:read", "access:write", "account:read", "agw:read", "agw:run", "agw:write", "ai:read", "ai:write", "ai-search:read", "ai-search:run", "ai-search:write", "aiaudit:read", "aiaudit:write", "aig:read", "aig:write", "auditlogs:read", "billing:read", "billing:write", "browser:read", "browser:write", "cfone:read", "cfone:write", "cloudchamber:write", "connectivity:admin", "connectivity:bind", "connectivity:read", "constellation:write", "containers:write", "d1:write", "dex:read", "dex:write", "dns_analytics:read", "dns_records:edit", "dns_records:read", "dns_settings:read", "email_routing:read", "email_routing:write", "email_sending:read", "email_sending:write", "firstpartytags:write", "images:read", "images:write", "lb:edit", "lb:read", "logpush:read", "logpush:write", "mcp_portals:read", "mcp_portals:write", "notebook-examples:read", "notebook-managed:read", "notification:read", "notification:write", "oauth_account_ssl_and_certificates_write", "offline", "openid", "pages:read", "pages:write", "pipelines:read", "pipelines:setup", "pipelines:write", "query_cache:write", "queues:write", "r2_catalog:write", "radar:read", "rag:read", "rag:write", "registrar:read", "registrar:write", "secrets_store:read", "secrets_store:write", "sso-connector:read", "sso-connector:write", "ssl_certs:write", "teams:pii", "teams:read", "teams:secure_location", "teams:write", "url_scanner:read", "url_scanner:write", "user:read", "vectorize:write", "workers:read", "workers:write", "workers_builds:read", "workers_builds:write", "workers_deployments:read", "workers_kv:write", "workers_observability:read", "workers_observability:write", "workers_observability_telemetry:write", "workers_routes:write", "workers_scripts:write", "workers_tail:read", "zone:read", "account-analytics.read", "account-ssl-and-certificates.write", "ssl-and-certificates.read", "ssl-and-certificates.write", "registrar-domains.read", "registrar-domains.admin", "logs.read", "logs.write", "websearch.run", "snippets.read", "snippets.write", "access-acct.read", "access-acct.revoke", "access-acct.write", "access-app.read", "access-app.revoke", "access-app.write", "access-audit-log.read", "access-certificate.read", "access-certificate.write", "access-custom-page.read", "access-custom-page.write", "access-device-posture.read", "access-device-posture.write", "access-group.read", "access-group.write", "access-idp.read", "access-idp.write", "access-key.read", "access-key.write", "access-org.read", "access-org.revoke", "access-org.write", "access-policy-test.read", "access-policy-test.write", "access-policy.read", "access-policy.write", "access-population.read", "access-population.write", "access-saml-certificate.read", "access-saml-certificate.write", "access-scim-log.read", "access-seats.write", "access-service-token.read", "access-service-token.write", "access-ssh-auditing.read", "access-ssh-auditing.write", "access-tag.read", "access-tag.write", "access-users.read", "access-users.write", "access.read", "access.revoke", "access.write", "account-api-gateway.read", "account-api-gateway.write", "account-custom-asset.read", "account-custom-asset.write", "account-custom-error-rules.read", "account-custom-error-rules.write", "account-custom-pages.read", "account-custom-pages.write", "account-disable-esc.read", "account-disable-esc.write", "account-dns-settings.read", "account-dns-settings.write", "account-firewall-access-rules.read", "account-firewall-access-rules.write", "account-logs.read", "account-logs.write", "account-rule-lists.read", "account-rule-lists.write", "account-rulesets.read", "account-rulesets.write", "account-security-center-insights.read", "account-security-center-insights.write", "account-settings.read", "account-settings.write", "account-ssl-and-certificates.read", "account-waf.read", "account-waf.write", "account-waiting-rooms.read", "address-maps.read", "address-maps.write", "agent-memory.write", "agw.read", "agw.run", "agw.write", "ai-search.index", "ai-search.metadata_read", "ai-search.read", "ai-search.run", "ai-search.write", "ai.read", "ai.write", "aiaudit.read", "aiaudit.write", "aig.metadata_read", "aig.read", "aig.run", "aig.write", "analytics.read", "api-gateway.read", "api-gateway.write", "apps.write", "argotunnel.read", "argotunnel.write", "artifacts.read", "artifacts.write", "bot-management-feedback.read", "bot-management-feedback.write", "bot-management.read", "bot-management.write", "browser-rendering.read", "browser-rendering.write", "cache-settings.read", "cache-settings.write", "cache.purge", "calls.read", "calls.write", "casb.read", "casb.write", "cf-agents.read", "cf-agents.write", "challenge-widgets.read", "challenge-widgets.write", "chinanetwork-steering.read", "chinanetwork-steering.write", "cloud-connector.read", "cloud-connector.write", "cloud-email-security.read", "cloud-email-security.write", "cloudchamber.read", "cloudchamber.write", "cloudforce-one.read", "cloudforce-one.write", "config-settings.read", "config-settings.write", "connectivity-directory.admin", "connectivity-directory.bind", "connectivity-directory.read", "constellation.read", "constellation.write", "containers.read", "containers.write", "custom-errors.read", "custom-errors.write", "custom-pages.read", "custom-pages.write", "d1.metadata_read", "d1.read", "d1.write", "ddos-botnet-feed.read", "ddos-botnet-feed.write", "ddos-protection.read", "ddos-protection.write", "dls.read", "dls.write", "dns-firewall.read", "dns-firewall.write", "dns-view.read", "dns-view.write", "dns.read", "dns.write", "domain-page-shield.read", "domain-page.shield", "dynamic-redirect.read", "dynamic-redirect.write", "email-routing-account-rule.read", "email-routing-address.read", "email-routing-address.write", "email-routing-rule.read", "email-routing-rule.write", "email-routing-suppression.read", "email-routing-suppression.write", "email-security-dmarcreports.read", "email-security-dmarcreports.write", "email-sending.read", "email-sending.write", "fbm.admin", "fbm.read", "fbm.write", "field-extractor.read", "field-extractor.write", "firewall-for-ai.read", "firewall-for-ai.write", "firewall-services.read", "firewall-services.write", "flagship.evaluate", "flagship.read", "flagship.write", "fraud-detection-pii.read", "fraud-detection.read", "fraud-detection.write", "fraud-events.write", "fraud-feedback.read", "fraud-feedback.write", "healthcheck.read", "healthcheck.write", "http-applications.read", "http-applications.write", "http-ddos-managed-ruleset.read", "http-ddos-managed-ruleset.write", "images.metadata_read", "images.read", "images.write", "integration.write", "intel.read", "intel.write", "iot.read", "iot.write", "ip-prefix-bgp-on-demand.read", "ip-prefix-bgp-on-demand.write", "ip-prefix.read", "ip-prefix.write", "l4-ddos-managed-ruleset.read", "l4-ddos-managed-ruleset.write", "load-balancers-account.read", "load-balancers-account.write", "load-balancers.read", "load-balancers.write", "load-balancing-monitors-and-pools.read", "load-balancing-monitors-and-pools.write", "magic-firewall.read", "magic-firewall.write", "magic-transit.read", "magic-transit.write", "magic-wan.read", "magic-wan.write", "managed-headers.read", "managed-headers.write", "mass-url-redirects.read", "mass-url-redirects.write", "mcp-portals.read", "mcp-portals.write", "memberships.read", "memberships.write", "messaging.edit", "messaging.metadata_read", "messaging.read", "moq.read", "moq.write", "notifications.read", "notifications.write", "origin.read", "origin.write", "page-rules.read", "page-rules.write", "page-shield.read", "page.read", "page.shield", "page.write", "pages.metadata_read", "payments-gateway.read", "payments-gateway.write", "pcaps-api.read", "pcaps-api.write", "pipelines.read", "pipelines.send", "pipelines.write", "precursor.read", "precursor.write", "pubsub.read", "pubsub.write", "query-cache.read", "query-cache.write", "queues.metadata_read", "queues.read", "queues.write", "r2-catalog-sql.read", "r2-catalog.read", "r2-catalog.write", "radar.read", "rag.read", "rag.run", "rag.write", "realtime.admin", "realtime.read", "realtime.write", "registrar-sandbox-domains.admin", "registrar-sandbox-domains.read", "reports-application-security-report.read", "request-tracer.read", "resource-library.read", "resource-library.write", "resource-sharing.read", "response-compression.read", "response-compression.write", "sanitize.read", "sanitize.write", "secrets-store.read", "secrets-store.write", "select-configuration.read", "select-configuration.write", "stream.metadata_read", "stream.read", "stream.write", "tag.read", "tag.write", "teams-cds-compute-account.read", "teams-cds-compute-account.write", "teams-connector-cloudflared.monitoring", "teams-connector-cloudflared.read", "teams-connector-cloudflared.write", "teams-connector-warp.read", "teams-connector-warp.write", "teams-connectors.read", "teams-connectors.write", "teams-dex.read", "teams-dex.write", "teams-networks.read", "teams-networks.write", "teams-pii.read", "teams-resilience.read", "teams-resilience.write", "teams-secure.location", "teams.read", "teams.report", "teams.write", "transform-rules.read", "transform-rules.write", "trust-and-safety.read", "trust-and-safety.write", "url-scanner.read", "url-scanner.write", "user-details.read", "user-details.write", "vectorize.read", "vectorize.write", "waiting-rooms.read", "waiting-rooms.write", "web3-hostnames.read", "web3-hostnames.write", "websearch.metadata_read", "websearch.read", "websearch.write", "workers-ci.read", "workers-ci.write", "workers-kv-storage.metadata_read", "workers-kv-storage.read", "workers-kv-storage.write", "workers-observability-telemetry.write", "workers-observability.read", "workers-observability.write", "workers-r2-bucket-item.read", "workers-r2-bucket-item.write", "workers-r2.metadata_read", "workers-r2.read", "workers-r2.write", "workers-routes.read", "workers-routes.write", "workers-scripts.bind", "workers-scripts.read", "workers-scripts.write", "workers-tail.read", "workers_ai.metadata_read", "zaraz.edit", "zaraz.read", "zaraz.write", "zone-access.read", "zone-access.revoke", "zone-access.write", "zone-custom-asset.read", "zone-custom-asset.write", "zone-disable-esc.read", "zone-disable-esc.write", "zone-dns-settings.read", "zone-dns-settings.write", "zone-security-center-insights.read", "zone-security-center-insights.write", "zone-settings.read", "zone-settings.write", "zone-transform-rules.read", "zone-transform-rules.write", "zone-versioning.read", "zone-versioning.write", "zone-waf.read", "zone-waf.write", "zone.read", "zone.write"];
|
|
18
18
|
/**
|
|
19
|
-
* The possible keys for a cf Scope.
|
|
19
|
+
* The possible explicitly requestable keys for a cf Scope.
|
|
20
20
|
*
|
|
21
21
|
* "offline_access" is automatically included.
|
|
22
22
|
*/
|
|
23
|
-
type Scope = (typeof
|
|
23
|
+
type Scope = (typeof CF_REGISTERED_SCOPES)[number];
|
|
24
24
|
declare let DefaultScopeKeys: Scope[];
|
|
25
25
|
declare function setLoginScopeKeys(scopes: Scope[]): void;
|
|
26
|
-
declare function validateScopeKeys(scopes: string[]): scopes is
|
|
26
|
+
declare function validateScopeKeys(scopes: string[]): scopes is Scope[];
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* `CLOUDFLARE_CLIENT_ID` is the UUID of cf's registered OAuth app, used to
|
package/dist/cf/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAuthConfigFileHelpers, createPreferences, createKeyringPreference, createFileStorage, createCloudflareAuth, createCloudflareProfileStore } from '../chunk-
|
|
1
|
+
import { createAuthConfigFileHelpers, createPreferences, createKeyringPreference, createFileStorage, createCloudflareAuth, createCloudflareProfileStore } from '../chunk-T63LVVAX.mjs';
|
|
2
2
|
import '../chunk-LQW53VED.mjs';
|
|
3
3
|
import { __name } from '../chunk-O6YSETKJ.mjs';
|
|
4
4
|
import { getEnvironmentVariableFactory, getGlobalConfigPath, getCloudflareApiEnvironmentFromEnv } from '@cloudflare/workers-utils';
|
|
@@ -32,7 +32,483 @@ function getCfConfigPath() {
|
|
|
32
32
|
__name(getCfConfigPath, "getCfConfigPath");
|
|
33
33
|
|
|
34
34
|
// src/cf/scopes.ts
|
|
35
|
-
var
|
|
35
|
+
var CF_REGISTERED_SCOPES = [
|
|
36
|
+
"access:read",
|
|
37
|
+
"access:write",
|
|
38
|
+
"account:read",
|
|
39
|
+
"agw:read",
|
|
40
|
+
"agw:run",
|
|
41
|
+
"agw:write",
|
|
42
|
+
"ai:read",
|
|
43
|
+
"ai:write",
|
|
44
|
+
"ai-search:read",
|
|
45
|
+
"ai-search:run",
|
|
46
|
+
"ai-search:write",
|
|
47
|
+
"aiaudit:read",
|
|
48
|
+
"aiaudit:write",
|
|
49
|
+
"aig:read",
|
|
50
|
+
"aig:write",
|
|
51
|
+
"auditlogs:read",
|
|
52
|
+
"billing:read",
|
|
53
|
+
"billing:write",
|
|
54
|
+
"browser:read",
|
|
55
|
+
"browser:write",
|
|
56
|
+
"cfone:read",
|
|
57
|
+
"cfone:write",
|
|
58
|
+
"cloudchamber:write",
|
|
59
|
+
"connectivity:admin",
|
|
60
|
+
"connectivity:bind",
|
|
61
|
+
"connectivity:read",
|
|
62
|
+
"constellation:write",
|
|
63
|
+
"containers:write",
|
|
64
|
+
"d1:write",
|
|
65
|
+
"dex:read",
|
|
66
|
+
"dex:write",
|
|
67
|
+
"dns_analytics:read",
|
|
68
|
+
"dns_records:edit",
|
|
69
|
+
"dns_records:read",
|
|
70
|
+
"dns_settings:read",
|
|
71
|
+
"email_routing:read",
|
|
72
|
+
"email_routing:write",
|
|
73
|
+
"email_sending:read",
|
|
74
|
+
"email_sending:write",
|
|
75
|
+
"firstpartytags:write",
|
|
76
|
+
"images:read",
|
|
77
|
+
"images:write",
|
|
78
|
+
"lb:edit",
|
|
79
|
+
"lb:read",
|
|
80
|
+
"logpush:read",
|
|
81
|
+
"logpush:write",
|
|
82
|
+
"mcp_portals:read",
|
|
83
|
+
"mcp_portals:write",
|
|
84
|
+
"notebook-examples:read",
|
|
85
|
+
"notebook-managed:read",
|
|
86
|
+
"notification:read",
|
|
87
|
+
"notification:write",
|
|
88
|
+
"oauth_account_ssl_and_certificates_write",
|
|
89
|
+
"offline",
|
|
90
|
+
"openid",
|
|
91
|
+
"pages:read",
|
|
92
|
+
"pages:write",
|
|
93
|
+
"pipelines:read",
|
|
94
|
+
"pipelines:setup",
|
|
95
|
+
"pipelines:write",
|
|
96
|
+
"query_cache:write",
|
|
97
|
+
"queues:write",
|
|
98
|
+
"r2_catalog:write",
|
|
99
|
+
"radar:read",
|
|
100
|
+
"rag:read",
|
|
101
|
+
"rag:write",
|
|
102
|
+
"registrar:read",
|
|
103
|
+
"registrar:write",
|
|
104
|
+
"secrets_store:read",
|
|
105
|
+
"secrets_store:write",
|
|
106
|
+
"sso-connector:read",
|
|
107
|
+
"sso-connector:write",
|
|
108
|
+
"ssl_certs:write",
|
|
109
|
+
"teams:pii",
|
|
110
|
+
"teams:read",
|
|
111
|
+
"teams:secure_location",
|
|
112
|
+
"teams:write",
|
|
113
|
+
"url_scanner:read",
|
|
114
|
+
"url_scanner:write",
|
|
115
|
+
"user:read",
|
|
116
|
+
"vectorize:write",
|
|
117
|
+
"workers:read",
|
|
118
|
+
"workers:write",
|
|
119
|
+
"workers_builds:read",
|
|
120
|
+
"workers_builds:write",
|
|
121
|
+
"workers_deployments:read",
|
|
122
|
+
"workers_kv:write",
|
|
123
|
+
"workers_observability:read",
|
|
124
|
+
"workers_observability:write",
|
|
125
|
+
"workers_observability_telemetry:write",
|
|
126
|
+
"workers_routes:write",
|
|
127
|
+
"workers_scripts:write",
|
|
128
|
+
"workers_tail:read",
|
|
129
|
+
"zone:read",
|
|
130
|
+
"account-analytics.read",
|
|
131
|
+
"account-ssl-and-certificates.write",
|
|
132
|
+
"ssl-and-certificates.read",
|
|
133
|
+
"ssl-and-certificates.write",
|
|
134
|
+
"registrar-domains.read",
|
|
135
|
+
"registrar-domains.admin",
|
|
136
|
+
"logs.read",
|
|
137
|
+
"logs.write",
|
|
138
|
+
"websearch.run",
|
|
139
|
+
"snippets.read",
|
|
140
|
+
"snippets.write",
|
|
141
|
+
"access-acct.read",
|
|
142
|
+
"access-acct.revoke",
|
|
143
|
+
"access-acct.write",
|
|
144
|
+
"access-app.read",
|
|
145
|
+
"access-app.revoke",
|
|
146
|
+
"access-app.write",
|
|
147
|
+
"access-audit-log.read",
|
|
148
|
+
"access-certificate.read",
|
|
149
|
+
"access-certificate.write",
|
|
150
|
+
"access-custom-page.read",
|
|
151
|
+
"access-custom-page.write",
|
|
152
|
+
"access-device-posture.read",
|
|
153
|
+
"access-device-posture.write",
|
|
154
|
+
"access-group.read",
|
|
155
|
+
"access-group.write",
|
|
156
|
+
"access-idp.read",
|
|
157
|
+
"access-idp.write",
|
|
158
|
+
"access-key.read",
|
|
159
|
+
"access-key.write",
|
|
160
|
+
"access-org.read",
|
|
161
|
+
"access-org.revoke",
|
|
162
|
+
"access-org.write",
|
|
163
|
+
"access-policy-test.read",
|
|
164
|
+
"access-policy-test.write",
|
|
165
|
+
"access-policy.read",
|
|
166
|
+
"access-policy.write",
|
|
167
|
+
"access-population.read",
|
|
168
|
+
"access-population.write",
|
|
169
|
+
"access-saml-certificate.read",
|
|
170
|
+
"access-saml-certificate.write",
|
|
171
|
+
"access-scim-log.read",
|
|
172
|
+
"access-seats.write",
|
|
173
|
+
"access-service-token.read",
|
|
174
|
+
"access-service-token.write",
|
|
175
|
+
"access-ssh-auditing.read",
|
|
176
|
+
"access-ssh-auditing.write",
|
|
177
|
+
"access-tag.read",
|
|
178
|
+
"access-tag.write",
|
|
179
|
+
"access-users.read",
|
|
180
|
+
"access-users.write",
|
|
181
|
+
"access.read",
|
|
182
|
+
"access.revoke",
|
|
183
|
+
"access.write",
|
|
184
|
+
"account-api-gateway.read",
|
|
185
|
+
"account-api-gateway.write",
|
|
186
|
+
"account-custom-asset.read",
|
|
187
|
+
"account-custom-asset.write",
|
|
188
|
+
"account-custom-error-rules.read",
|
|
189
|
+
"account-custom-error-rules.write",
|
|
190
|
+
"account-custom-pages.read",
|
|
191
|
+
"account-custom-pages.write",
|
|
192
|
+
"account-disable-esc.read",
|
|
193
|
+
"account-disable-esc.write",
|
|
194
|
+
"account-dns-settings.read",
|
|
195
|
+
"account-dns-settings.write",
|
|
196
|
+
"account-firewall-access-rules.read",
|
|
197
|
+
"account-firewall-access-rules.write",
|
|
198
|
+
"account-logs.read",
|
|
199
|
+
"account-logs.write",
|
|
200
|
+
"account-rule-lists.read",
|
|
201
|
+
"account-rule-lists.write",
|
|
202
|
+
"account-rulesets.read",
|
|
203
|
+
"account-rulesets.write",
|
|
204
|
+
"account-security-center-insights.read",
|
|
205
|
+
"account-security-center-insights.write",
|
|
206
|
+
"account-settings.read",
|
|
207
|
+
"account-settings.write",
|
|
208
|
+
"account-ssl-and-certificates.read",
|
|
209
|
+
"account-waf.read",
|
|
210
|
+
"account-waf.write",
|
|
211
|
+
"account-waiting-rooms.read",
|
|
212
|
+
"address-maps.read",
|
|
213
|
+
"address-maps.write",
|
|
214
|
+
"agent-memory.write",
|
|
215
|
+
"agw.read",
|
|
216
|
+
"agw.run",
|
|
217
|
+
"agw.write",
|
|
218
|
+
"ai-search.index",
|
|
219
|
+
"ai-search.metadata_read",
|
|
220
|
+
"ai-search.read",
|
|
221
|
+
"ai-search.run",
|
|
222
|
+
"ai-search.write",
|
|
223
|
+
"ai.read",
|
|
224
|
+
"ai.write",
|
|
225
|
+
"aiaudit.read",
|
|
226
|
+
"aiaudit.write",
|
|
227
|
+
"aig.metadata_read",
|
|
228
|
+
"aig.read",
|
|
229
|
+
"aig.run",
|
|
230
|
+
"aig.write",
|
|
231
|
+
"analytics.read",
|
|
232
|
+
"api-gateway.read",
|
|
233
|
+
"api-gateway.write",
|
|
234
|
+
"apps.write",
|
|
235
|
+
"argotunnel.read",
|
|
236
|
+
"argotunnel.write",
|
|
237
|
+
"artifacts.read",
|
|
238
|
+
"artifacts.write",
|
|
239
|
+
"bot-management-feedback.read",
|
|
240
|
+
"bot-management-feedback.write",
|
|
241
|
+
"bot-management.read",
|
|
242
|
+
"bot-management.write",
|
|
243
|
+
"browser-rendering.read",
|
|
244
|
+
"browser-rendering.write",
|
|
245
|
+
"cache-settings.read",
|
|
246
|
+
"cache-settings.write",
|
|
247
|
+
"cache.purge",
|
|
248
|
+
"calls.read",
|
|
249
|
+
"calls.write",
|
|
250
|
+
"casb.read",
|
|
251
|
+
"casb.write",
|
|
252
|
+
"cf-agents.read",
|
|
253
|
+
"cf-agents.write",
|
|
254
|
+
"challenge-widgets.read",
|
|
255
|
+
"challenge-widgets.write",
|
|
256
|
+
"chinanetwork-steering.read",
|
|
257
|
+
"chinanetwork-steering.write",
|
|
258
|
+
"cloud-connector.read",
|
|
259
|
+
"cloud-connector.write",
|
|
260
|
+
"cloud-email-security.read",
|
|
261
|
+
"cloud-email-security.write",
|
|
262
|
+
"cloudchamber.read",
|
|
263
|
+
"cloudchamber.write",
|
|
264
|
+
"cloudforce-one.read",
|
|
265
|
+
"cloudforce-one.write",
|
|
266
|
+
"config-settings.read",
|
|
267
|
+
"config-settings.write",
|
|
268
|
+
"connectivity-directory.admin",
|
|
269
|
+
"connectivity-directory.bind",
|
|
270
|
+
"connectivity-directory.read",
|
|
271
|
+
"constellation.read",
|
|
272
|
+
"constellation.write",
|
|
273
|
+
"containers.read",
|
|
274
|
+
"containers.write",
|
|
275
|
+
"custom-errors.read",
|
|
276
|
+
"custom-errors.write",
|
|
277
|
+
"custom-pages.read",
|
|
278
|
+
"custom-pages.write",
|
|
279
|
+
"d1.metadata_read",
|
|
280
|
+
"d1.read",
|
|
281
|
+
"d1.write",
|
|
282
|
+
"ddos-botnet-feed.read",
|
|
283
|
+
"ddos-botnet-feed.write",
|
|
284
|
+
"ddos-protection.read",
|
|
285
|
+
"ddos-protection.write",
|
|
286
|
+
"dls.read",
|
|
287
|
+
"dls.write",
|
|
288
|
+
"dns-firewall.read",
|
|
289
|
+
"dns-firewall.write",
|
|
290
|
+
"dns-view.read",
|
|
291
|
+
"dns-view.write",
|
|
292
|
+
"dns.read",
|
|
293
|
+
"dns.write",
|
|
294
|
+
"domain-page-shield.read",
|
|
295
|
+
"domain-page.shield",
|
|
296
|
+
"dynamic-redirect.read",
|
|
297
|
+
"dynamic-redirect.write",
|
|
298
|
+
"email-routing-account-rule.read",
|
|
299
|
+
"email-routing-address.read",
|
|
300
|
+
"email-routing-address.write",
|
|
301
|
+
"email-routing-rule.read",
|
|
302
|
+
"email-routing-rule.write",
|
|
303
|
+
"email-routing-suppression.read",
|
|
304
|
+
"email-routing-suppression.write",
|
|
305
|
+
"email-security-dmarcreports.read",
|
|
306
|
+
"email-security-dmarcreports.write",
|
|
307
|
+
"email-sending.read",
|
|
308
|
+
"email-sending.write",
|
|
309
|
+
"fbm.admin",
|
|
310
|
+
"fbm.read",
|
|
311
|
+
"fbm.write",
|
|
312
|
+
"field-extractor.read",
|
|
313
|
+
"field-extractor.write",
|
|
314
|
+
"firewall-for-ai.read",
|
|
315
|
+
"firewall-for-ai.write",
|
|
316
|
+
"firewall-services.read",
|
|
317
|
+
"firewall-services.write",
|
|
318
|
+
"flagship.evaluate",
|
|
319
|
+
"flagship.read",
|
|
320
|
+
"flagship.write",
|
|
321
|
+
"fraud-detection-pii.read",
|
|
322
|
+
"fraud-detection.read",
|
|
323
|
+
"fraud-detection.write",
|
|
324
|
+
"fraud-events.write",
|
|
325
|
+
"fraud-feedback.read",
|
|
326
|
+
"fraud-feedback.write",
|
|
327
|
+
"healthcheck.read",
|
|
328
|
+
"healthcheck.write",
|
|
329
|
+
"http-applications.read",
|
|
330
|
+
"http-applications.write",
|
|
331
|
+
"http-ddos-managed-ruleset.read",
|
|
332
|
+
"http-ddos-managed-ruleset.write",
|
|
333
|
+
"images.metadata_read",
|
|
334
|
+
"images.read",
|
|
335
|
+
"images.write",
|
|
336
|
+
"integration.write",
|
|
337
|
+
"intel.read",
|
|
338
|
+
"intel.write",
|
|
339
|
+
"iot.read",
|
|
340
|
+
"iot.write",
|
|
341
|
+
"ip-prefix-bgp-on-demand.read",
|
|
342
|
+
"ip-prefix-bgp-on-demand.write",
|
|
343
|
+
"ip-prefix.read",
|
|
344
|
+
"ip-prefix.write",
|
|
345
|
+
"l4-ddos-managed-ruleset.read",
|
|
346
|
+
"l4-ddos-managed-ruleset.write",
|
|
347
|
+
"load-balancers-account.read",
|
|
348
|
+
"load-balancers-account.write",
|
|
349
|
+
"load-balancers.read",
|
|
350
|
+
"load-balancers.write",
|
|
351
|
+
"load-balancing-monitors-and-pools.read",
|
|
352
|
+
"load-balancing-monitors-and-pools.write",
|
|
353
|
+
"magic-firewall.read",
|
|
354
|
+
"magic-firewall.write",
|
|
355
|
+
"magic-transit.read",
|
|
356
|
+
"magic-transit.write",
|
|
357
|
+
"magic-wan.read",
|
|
358
|
+
"magic-wan.write",
|
|
359
|
+
"managed-headers.read",
|
|
360
|
+
"managed-headers.write",
|
|
361
|
+
"mass-url-redirects.read",
|
|
362
|
+
"mass-url-redirects.write",
|
|
363
|
+
"mcp-portals.read",
|
|
364
|
+
"mcp-portals.write",
|
|
365
|
+
"memberships.read",
|
|
366
|
+
"memberships.write",
|
|
367
|
+
"messaging.edit",
|
|
368
|
+
"messaging.metadata_read",
|
|
369
|
+
"messaging.read",
|
|
370
|
+
"moq.read",
|
|
371
|
+
"moq.write",
|
|
372
|
+
"notifications.read",
|
|
373
|
+
"notifications.write",
|
|
374
|
+
"origin.read",
|
|
375
|
+
"origin.write",
|
|
376
|
+
"page-rules.read",
|
|
377
|
+
"page-rules.write",
|
|
378
|
+
"page-shield.read",
|
|
379
|
+
"page.read",
|
|
380
|
+
"page.shield",
|
|
381
|
+
"page.write",
|
|
382
|
+
"pages.metadata_read",
|
|
383
|
+
"payments-gateway.read",
|
|
384
|
+
"payments-gateway.write",
|
|
385
|
+
"pcaps-api.read",
|
|
386
|
+
"pcaps-api.write",
|
|
387
|
+
"pipelines.read",
|
|
388
|
+
"pipelines.send",
|
|
389
|
+
"pipelines.write",
|
|
390
|
+
"precursor.read",
|
|
391
|
+
"precursor.write",
|
|
392
|
+
"pubsub.read",
|
|
393
|
+
"pubsub.write",
|
|
394
|
+
"query-cache.read",
|
|
395
|
+
"query-cache.write",
|
|
396
|
+
"queues.metadata_read",
|
|
397
|
+
"queues.read",
|
|
398
|
+
"queues.write",
|
|
399
|
+
"r2-catalog-sql.read",
|
|
400
|
+
"r2-catalog.read",
|
|
401
|
+
"r2-catalog.write",
|
|
402
|
+
"radar.read",
|
|
403
|
+
"rag.read",
|
|
404
|
+
"rag.run",
|
|
405
|
+
"rag.write",
|
|
406
|
+
"realtime.admin",
|
|
407
|
+
"realtime.read",
|
|
408
|
+
"realtime.write",
|
|
409
|
+
"registrar-sandbox-domains.admin",
|
|
410
|
+
"registrar-sandbox-domains.read",
|
|
411
|
+
"reports-application-security-report.read",
|
|
412
|
+
"request-tracer.read",
|
|
413
|
+
"resource-library.read",
|
|
414
|
+
"resource-library.write",
|
|
415
|
+
"resource-sharing.read",
|
|
416
|
+
"response-compression.read",
|
|
417
|
+
"response-compression.write",
|
|
418
|
+
"sanitize.read",
|
|
419
|
+
"sanitize.write",
|
|
420
|
+
"secrets-store.read",
|
|
421
|
+
"secrets-store.write",
|
|
422
|
+
"select-configuration.read",
|
|
423
|
+
"select-configuration.write",
|
|
424
|
+
"stream.metadata_read",
|
|
425
|
+
"stream.read",
|
|
426
|
+
"stream.write",
|
|
427
|
+
"tag.read",
|
|
428
|
+
"tag.write",
|
|
429
|
+
"teams-cds-compute-account.read",
|
|
430
|
+
"teams-cds-compute-account.write",
|
|
431
|
+
"teams-connector-cloudflared.monitoring",
|
|
432
|
+
"teams-connector-cloudflared.read",
|
|
433
|
+
"teams-connector-cloudflared.write",
|
|
434
|
+
"teams-connector-warp.read",
|
|
435
|
+
"teams-connector-warp.write",
|
|
436
|
+
"teams-connectors.read",
|
|
437
|
+
"teams-connectors.write",
|
|
438
|
+
"teams-dex.read",
|
|
439
|
+
"teams-dex.write",
|
|
440
|
+
"teams-networks.read",
|
|
441
|
+
"teams-networks.write",
|
|
442
|
+
"teams-pii.read",
|
|
443
|
+
"teams-resilience.read",
|
|
444
|
+
"teams-resilience.write",
|
|
445
|
+
"teams-secure.location",
|
|
446
|
+
"teams.read",
|
|
447
|
+
"teams.report",
|
|
448
|
+
"teams.write",
|
|
449
|
+
"transform-rules.read",
|
|
450
|
+
"transform-rules.write",
|
|
451
|
+
"trust-and-safety.read",
|
|
452
|
+
"trust-and-safety.write",
|
|
453
|
+
"url-scanner.read",
|
|
454
|
+
"url-scanner.write",
|
|
455
|
+
"user-details.read",
|
|
456
|
+
"user-details.write",
|
|
457
|
+
"vectorize.read",
|
|
458
|
+
"vectorize.write",
|
|
459
|
+
"waiting-rooms.read",
|
|
460
|
+
"waiting-rooms.write",
|
|
461
|
+
"web3-hostnames.read",
|
|
462
|
+
"web3-hostnames.write",
|
|
463
|
+
"websearch.metadata_read",
|
|
464
|
+
"websearch.read",
|
|
465
|
+
"websearch.write",
|
|
466
|
+
"workers-ci.read",
|
|
467
|
+
"workers-ci.write",
|
|
468
|
+
"workers-kv-storage.metadata_read",
|
|
469
|
+
"workers-kv-storage.read",
|
|
470
|
+
"workers-kv-storage.write",
|
|
471
|
+
"workers-observability-telemetry.write",
|
|
472
|
+
"workers-observability.read",
|
|
473
|
+
"workers-observability.write",
|
|
474
|
+
"workers-r2-bucket-item.read",
|
|
475
|
+
"workers-r2-bucket-item.write",
|
|
476
|
+
"workers-r2.metadata_read",
|
|
477
|
+
"workers-r2.read",
|
|
478
|
+
"workers-r2.write",
|
|
479
|
+
"workers-routes.read",
|
|
480
|
+
"workers-routes.write",
|
|
481
|
+
"workers-scripts.bind",
|
|
482
|
+
"workers-scripts.read",
|
|
483
|
+
"workers-scripts.write",
|
|
484
|
+
"workers-tail.read",
|
|
485
|
+
"workers_ai.metadata_read",
|
|
486
|
+
"zaraz.edit",
|
|
487
|
+
"zaraz.read",
|
|
488
|
+
"zaraz.write",
|
|
489
|
+
"zone-access.read",
|
|
490
|
+
"zone-access.revoke",
|
|
491
|
+
"zone-access.write",
|
|
492
|
+
"zone-custom-asset.read",
|
|
493
|
+
"zone-custom-asset.write",
|
|
494
|
+
"zone-disable-esc.read",
|
|
495
|
+
"zone-disable-esc.write",
|
|
496
|
+
"zone-dns-settings.read",
|
|
497
|
+
"zone-dns-settings.write",
|
|
498
|
+
"zone-security-center-insights.read",
|
|
499
|
+
"zone-security-center-insights.write",
|
|
500
|
+
"zone-settings.read",
|
|
501
|
+
"zone-settings.write",
|
|
502
|
+
"zone-transform-rules.read",
|
|
503
|
+
"zone-transform-rules.write",
|
|
504
|
+
"zone-versioning.read",
|
|
505
|
+
"zone-versioning.write",
|
|
506
|
+
"zone-waf.read",
|
|
507
|
+
"zone-waf.write",
|
|
508
|
+
"zone.read",
|
|
509
|
+
"zone.write"
|
|
510
|
+
];
|
|
511
|
+
var CF_DEFAULT_SCOPES = [
|
|
36
512
|
"openid",
|
|
37
513
|
"offline",
|
|
38
514
|
"user:read",
|
|
@@ -122,12 +598,12 @@ var CF_SCOPES = [
|
|
|
122
598
|
"workers_tail:read",
|
|
123
599
|
"zone:read"
|
|
124
600
|
];
|
|
125
|
-
var DefaultScopeKeys = [...
|
|
601
|
+
var DefaultScopeKeys = [...CF_DEFAULT_SCOPES];
|
|
126
602
|
function setLoginScopeKeys(scopes) {
|
|
127
603
|
DefaultScopeKeys = scopes;
|
|
128
604
|
}
|
|
129
605
|
__name(setLoginScopeKeys, "setLoginScopeKeys");
|
|
130
|
-
var CF_SCOPE_SET = new Set(
|
|
606
|
+
var CF_SCOPE_SET = new Set(CF_REGISTERED_SCOPES);
|
|
131
607
|
function validateScopeKeys(scopes) {
|
|
132
608
|
return scopes.every((scope) => CF_SCOPE_SET.has(scope));
|
|
133
609
|
}
|
|
@@ -166,12 +642,13 @@ var CF_CLI = {
|
|
|
166
642
|
login: "cf auth login",
|
|
167
643
|
whoami: "cf auth whoami",
|
|
168
644
|
createProfile: "cf auth create",
|
|
169
|
-
deviceLogin: "cf auth login
|
|
645
|
+
deviceLogin: "cf auth login"
|
|
170
646
|
},
|
|
171
647
|
keyringServiceName: CF_KEYRING_SERVICE_NAME,
|
|
172
648
|
clientId: getClientIdFromEnv,
|
|
173
649
|
consent: CF_CONSENT_PAGES,
|
|
174
650
|
redirectUri: CF_OAUTH_CALLBACK_URL,
|
|
651
|
+
useDeviceFlowByDefault: true,
|
|
175
652
|
// cf only supports the scoped `CLOUDFLARE_API_TOKEN` env var, not the global
|
|
176
653
|
// API key + email pair, so the global-key resolution is disabled.
|
|
177
654
|
allowGlobalAuthKey: false,
|
|
@@ -3,7 +3,7 @@ import { __name } from './chunk-O6YSETKJ.mjs';
|
|
|
3
3
|
import { existsSync, rmSync, mkdirSync, writeFileSync, chmodSync, readFileSync as readFileSync$1, readdirSync } from 'node:fs';
|
|
4
4
|
import path3 from 'node:path';
|
|
5
5
|
import { URLSearchParams } from 'node:url';
|
|
6
|
-
import { readFileSync, isNonInteractiveOrCI, createConfigCache, openInBrowser,
|
|
6
|
+
import { readFileSync, isNonInteractiveOrCI, createConfigCache, openInBrowser, fetchInternalBase, hasMorePages, throwFetchError, UserError, isCI, getCloudflareComplianceRegion } from '@cloudflare/workers-utils';
|
|
7
7
|
|
|
8
8
|
function createPreferences(getConfigPath) {
|
|
9
9
|
function getUserPreferencesPath() {
|
|
@@ -850,7 +850,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
850
850
|
return oauthFlow.requireApiToken();
|
|
851
851
|
}
|
|
852
852
|
__name(requireApiToken, "requireApiToken");
|
|
853
|
-
function
|
|
853
|
+
function withLoginDefaults(complianceConfig, props) {
|
|
854
854
|
return {
|
|
855
855
|
complianceConfig,
|
|
856
856
|
scopes: props?.scopes ?? descriptor.getDefaultScopeKeys(),
|
|
@@ -858,12 +858,12 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
858
858
|
callbackHost: props?.callbackHost,
|
|
859
859
|
callbackPort: props?.callbackPort,
|
|
860
860
|
profile: props?.profile,
|
|
861
|
-
device: props?.device
|
|
861
|
+
device: props?.device ?? descriptor.useDeviceFlowByDefault ?? false
|
|
862
862
|
};
|
|
863
863
|
}
|
|
864
|
-
__name(
|
|
864
|
+
__name(withLoginDefaults, "withLoginDefaults");
|
|
865
865
|
async function login(complianceConfig, props) {
|
|
866
|
-
return oauthFlow.login(
|
|
866
|
+
return oauthFlow.login(withLoginDefaults(complianceConfig, props));
|
|
867
867
|
}
|
|
868
868
|
__name(login, "login");
|
|
869
869
|
async function logout(profile) {
|
|
@@ -875,7 +875,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
875
875
|
return { loggedIn: true };
|
|
876
876
|
}
|
|
877
877
|
return oauthFlow.loginOrRefreshIfRequired(
|
|
878
|
-
|
|
878
|
+
withLoginDefaults(complianceConfig, props)
|
|
879
879
|
);
|
|
880
880
|
}
|
|
881
881
|
__name(loginOrRefreshIfRequired, "loginOrRefreshIfRequired");
|
|
@@ -916,15 +916,7 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
916
916
|
).account;
|
|
917
917
|
}
|
|
918
918
|
__name(getAccountFromCache, "getAccountFromCache");
|
|
919
|
-
async function fetchAccountsPaged(complianceConfig, resource) {
|
|
920
|
-
const result = await loginOrRefreshIfRequired(complianceConfig);
|
|
921
|
-
if (!result.loggedIn) {
|
|
922
|
-
throw new UserError(
|
|
923
|
-
`Not logged in. ${NOT_LOGGED_IN_ERROR_BODIES[result.reason]}${NOT_LOGGED_IN_WHOAMI_TIP}`,
|
|
924
|
-
{ telemetryMessage: "cfetch auth login required" }
|
|
925
|
-
);
|
|
926
|
-
}
|
|
927
|
-
const credentials = requireApiToken();
|
|
919
|
+
async function fetchAccountsPaged(complianceConfig, resource, credentials) {
|
|
928
920
|
const results = [];
|
|
929
921
|
let getMoreResults = true;
|
|
930
922
|
let page = 1;
|
|
@@ -958,11 +950,20 @@ Run \`${descriptor.commands.whoami}\` to check your current authentication statu
|
|
|
958
950
|
__name(fetchAccountsPaged, "fetchAccountsPaged");
|
|
959
951
|
async function fetchAllAccounts(complianceConfig, options = {}) {
|
|
960
952
|
const { throwOnEmpty = true } = options;
|
|
953
|
+
const loginResult = await loginOrRefreshIfRequired(complianceConfig);
|
|
954
|
+
if (!loginResult.loggedIn) {
|
|
955
|
+
throw new UserError(
|
|
956
|
+
`Not logged in. ${NOT_LOGGED_IN_ERROR_BODIES[loginResult.reason]}${NOT_LOGGED_IN_WHOAMI_TIP}`,
|
|
957
|
+
{ telemetryMessage: "cfetch auth login required" }
|
|
958
|
+
);
|
|
959
|
+
}
|
|
960
|
+
const credentials = requireApiToken();
|
|
961
961
|
const [accountsRes, membershipsRes] = await Promise.allSettled([
|
|
962
|
-
fetchAccountsPaged(complianceConfig, `/accounts
|
|
962
|
+
fetchAccountsPaged(complianceConfig, `/accounts`, credentials),
|
|
963
963
|
fetchAccountsPaged(
|
|
964
964
|
complianceConfig,
|
|
965
|
-
`/memberships
|
|
965
|
+
`/memberships`,
|
|
966
|
+
credentials
|
|
966
967
|
)
|
|
967
968
|
]);
|
|
968
969
|
if (accountsRes.status === "rejected") {
|
|
@@ -78,6 +78,11 @@ interface CliDescriptor {
|
|
|
78
78
|
consent: OAuthConsentPages;
|
|
79
79
|
/** The `redirect_uri` registered on the CLI's OAuth app; also the local callback URL. */
|
|
80
80
|
redirectUri: string;
|
|
81
|
+
/**
|
|
82
|
+
* Whether interactive logins use the OAuth 2.0 Device Authorization Grant
|
|
83
|
+
* unless the caller explicitly selects a flow. Defaults to `false`.
|
|
84
|
+
*/
|
|
85
|
+
useDeviceFlowByDefault?: boolean;
|
|
81
86
|
/**
|
|
82
87
|
* Whether Cloudflare Global API Key + email credentials are accepted.
|
|
83
88
|
* Defaults to `true`.
|