@cloudflare/workers-auth 0.9.4 → 0.10.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 +4 -4
- package/dist/cf/index.mjs +3 -2
- package/dist/{chunk-RV27PEH3.mjs → chunk-FT2NMTJB.mjs} +50 -19
- package/dist/{chunk-2JQZNT7W.mjs → chunk-VVLCNASF.mjs} +7 -2
- package/dist/{file-format-Dlt3H3sW.d.mts → file-format-hS8cJZA7.d.mts} +3 -1
- package/dist/index.d.mts +19 -4
- package/dist/index.mjs +1 -1
- package/dist/{keyring-preference-B8dU564W.d.mts → keyring-preference-dD49DWOI.d.mts} +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/wrangler/index.d.mts +4 -2
- package/dist/wrangler/index.mjs +4 -2
- package/package.json +3 -3
package/dist/cf/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as ConfigStorage, A as AuthConfigStorage, U as UserAuthConfig, f as OAuthFlowContext, g as ProfileStore } from '../file-format-
|
|
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-
|
|
1
|
+
import { a as ConfigStorage, A as AuthConfigStorage, U as UserAuthConfig, f as OAuthFlowContext, g as ProfileStore } from '../file-format-hS8cJZA7.mjs';
|
|
2
|
+
import { C as CliDescriptor, A as AuthContext, a as CloudflareAuth, U as UserPreferences, K as KeyringPreferenceContext, S as SetKeyringPreferenceResult } from '../keyring-preference-dD49DWOI.mjs';
|
|
3
|
+
export { b as CloudflareLoginProps } from '../keyring-preference-dD49DWOI.mjs';
|
|
4
4
|
import '@cloudflare/workers-utils';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -14,7 +14,7 @@ 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_CLIENT_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"];
|
|
17
|
+
declare const CF_CLIENT_REGISTERED_SCOPES: readonly ["access:read", "access:write", "account:read", "account_api_tokens:create", "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
|
type ClientRegisteredScope = (typeof CF_CLIENT_REGISTERED_SCOPES)[number];
|
|
19
19
|
declare const CF_REGISTERED_BUT_UNGRANTABLE_SCOPES: readonly ["billing:read", "billing:write", "email_routing:read", "email_sending:read", "notebook-managed:read", "oauth_account_ssl_and_certificates_write"];
|
|
20
20
|
type UngrantableScope = (typeof CF_REGISTERED_BUT_UNGRANTABLE_SCOPES)[number];
|
package/dist/cf/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import { createAuthConfigFileHelpers, createPreferences, createKeyringPreference, createFileStorage, createCloudflareAuth, createCloudflareProfileStore } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
2
|
+
import { createAuthConfigFileHelpers, createPreferences, createKeyringPreference, createFileStorage, createCloudflareAuth, createCloudflareProfileStore } from '../chunk-VVLCNASF.mjs';
|
|
3
|
+
import '../chunk-FT2NMTJB.mjs';
|
|
4
4
|
import { __name } from '../chunk-VAZEJK55.mjs';
|
|
5
5
|
import { getEnvironmentVariableFactory, getGlobalConfigPath, getCloudflareApiEnvironmentFromEnv } from '@cloudflare/workers-utils';
|
|
6
6
|
import path from 'node:path';
|
|
@@ -39,6 +39,7 @@ var CF_CLIENT_REGISTERED_SCOPES = [
|
|
|
39
39
|
"access:read",
|
|
40
40
|
"access:write",
|
|
41
41
|
"account:read",
|
|
42
|
+
"account_api_tokens:create",
|
|
42
43
|
"agw:read",
|
|
43
44
|
"agw:run",
|
|
44
45
|
"agw:write",
|
|
@@ -164,6 +164,14 @@ var getCloudflareAuthUseKeyringFromEnv = getBooleanEnvironmentVariableFactory({
|
|
|
164
164
|
});
|
|
165
165
|
var headersCache = {};
|
|
166
166
|
var usesAccessCache = /* @__PURE__ */ new Map();
|
|
167
|
+
function buildProbeUrl(domain, previewToken) {
|
|
168
|
+
const url2 = new URL(`https://${domain}`);
|
|
169
|
+
if (previewToken) {
|
|
170
|
+
url2.searchParams.set("cf_workers_preview_token", previewToken);
|
|
171
|
+
}
|
|
172
|
+
return url2.toString();
|
|
173
|
+
}
|
|
174
|
+
__name(buildProbeUrl, "buildProbeUrl");
|
|
167
175
|
function clearAccessCaches() {
|
|
168
176
|
for (const key of Object.keys(headersCache)) {
|
|
169
177
|
delete headersCache[key];
|
|
@@ -171,15 +179,16 @@ function clearAccessCaches() {
|
|
|
171
179
|
usesAccessCache.clear();
|
|
172
180
|
}
|
|
173
181
|
__name(clearAccessCaches, "clearAccessCaches");
|
|
174
|
-
async function domainUsesAccess(domain, logger) {
|
|
182
|
+
async function domainUsesAccess(domain, logger, previewToken) {
|
|
175
183
|
logger.debug("Checking if domain has Access enabled:", domain);
|
|
176
|
-
|
|
184
|
+
const cacheKey = JSON.stringify([domain, Boolean(previewToken)]);
|
|
185
|
+
if (usesAccessCache.has(cacheKey)) {
|
|
177
186
|
logger.debug(
|
|
178
187
|
"Using cached Access switch for:",
|
|
179
188
|
domain,
|
|
180
|
-
usesAccessCache.get(
|
|
189
|
+
usesAccessCache.get(cacheKey)
|
|
181
190
|
);
|
|
182
|
-
return usesAccessCache.get(
|
|
191
|
+
return usesAccessCache.get(cacheKey) ?? false;
|
|
183
192
|
}
|
|
184
193
|
logger.debug("Access switch not cached for:", domain);
|
|
185
194
|
try {
|
|
@@ -187,17 +196,19 @@ async function domainUsesAccess(domain, logger) {
|
|
|
187
196
|
const cancel = setTimeout(() => {
|
|
188
197
|
controller.abort();
|
|
189
198
|
}, 1e3);
|
|
190
|
-
const output = await fetch(
|
|
199
|
+
const output = await fetch(buildProbeUrl(domain, previewToken), {
|
|
191
200
|
redirect: "manual",
|
|
192
201
|
signal: controller.signal
|
|
193
202
|
});
|
|
194
203
|
clearTimeout(cancel);
|
|
195
204
|
const usesAccess = !!(output.status === 302 && output.headers.get("location")?.includes("cloudflareaccess.com"));
|
|
196
|
-
|
|
197
|
-
|
|
205
|
+
if (usesAccess || !previewToken) {
|
|
206
|
+
logger.debug("Caching access switch for:", domain);
|
|
207
|
+
usesAccessCache.set(cacheKey, usesAccess);
|
|
208
|
+
}
|
|
198
209
|
return usesAccess;
|
|
199
210
|
} catch {
|
|
200
|
-
|
|
211
|
+
logger.debug("Access probe failed for:", domain);
|
|
201
212
|
return false;
|
|
202
213
|
}
|
|
203
214
|
}
|
|
@@ -218,7 +229,7 @@ async function getAccessHeaders(domain, options) {
|
|
|
218
229
|
`Both CLOUDFLARE_ACCESS_CLIENT_ID and CLOUDFLARE_ACCESS_CLIENT_SECRET must be set to use Access Service Token authentication. Only ${clientId !== void 0 ? "CLOUDFLARE_ACCESS_CLIENT_ID" : "CLOUDFLARE_ACCESS_CLIENT_SECRET"} was found.`
|
|
219
230
|
);
|
|
220
231
|
}
|
|
221
|
-
if (!await domainUsesAccess(domain, logger)) {
|
|
232
|
+
if (!await domainUsesAccess(domain, logger, options.previewToken)) {
|
|
222
233
|
return {};
|
|
223
234
|
}
|
|
224
235
|
logger.debug("Getting Access headers for domain:", domain);
|
|
@@ -237,7 +248,10 @@ See https://developers.cloudflare.com/cloudflare-one/access-controls/service-cre
|
|
|
237
248
|
);
|
|
238
249
|
}
|
|
239
250
|
logger.debug("Spawning cloudflared to get Access token for domain:");
|
|
240
|
-
const output = await spawnCloudflaredAccessLogin(
|
|
251
|
+
const output = await spawnCloudflaredAccessLogin(
|
|
252
|
+
buildProbeUrl(domain, options.previewToken),
|
|
253
|
+
options.signal
|
|
254
|
+
);
|
|
241
255
|
if (output.error) {
|
|
242
256
|
throw new UserError(
|
|
243
257
|
"To use Wrangler with Cloudflare Access, please install `cloudflared` from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation",
|
|
@@ -256,9 +270,11 @@ See https://developers.cloudflare.com/cloudflare-one/access-controls/service-cre
|
|
|
256
270
|
throw new Error("Failed to authenticate with Cloudflare Access");
|
|
257
271
|
}
|
|
258
272
|
__name(getAccessHeaders, "getAccessHeaders");
|
|
259
|
-
function spawnCloudflaredAccessLogin(
|
|
273
|
+
function spawnCloudflaredAccessLogin(loginTarget, signal) {
|
|
260
274
|
return new Promise((resolve, reject) => {
|
|
261
|
-
const child = spawn("cloudflared", ["access", "login",
|
|
275
|
+
const child = spawn("cloudflared", ["access", "login", loginTarget], {
|
|
276
|
+
signal
|
|
277
|
+
});
|
|
262
278
|
const stdoutChunks = [];
|
|
263
279
|
child.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
|
|
264
280
|
child.stderr.resume();
|
|
@@ -734,6 +750,14 @@ var ErrorUnknown = class extends ErrorOAuth2 {
|
|
|
734
750
|
return "ErrorUnknown";
|
|
735
751
|
}
|
|
736
752
|
};
|
|
753
|
+
var ErrorAuthServerUnreachable = class extends ErrorOAuth2 {
|
|
754
|
+
static {
|
|
755
|
+
__name(this, "ErrorAuthServerUnreachable");
|
|
756
|
+
}
|
|
757
|
+
toString() {
|
|
758
|
+
return "ErrorAuthServerUnreachable";
|
|
759
|
+
}
|
|
760
|
+
};
|
|
737
761
|
var ErrorNoAuthCode = class extends ErrorOAuth2 {
|
|
738
762
|
static {
|
|
739
763
|
__name(this, "ErrorNoAuthCode");
|
|
@@ -1134,7 +1158,12 @@ async function fetchAuthToken(body, logger, isNonInteractiveOrCI2) {
|
|
|
1134
1158
|
return response;
|
|
1135
1159
|
} catch (e) {
|
|
1136
1160
|
logger.debug("Failed to fetch auth token:", e);
|
|
1137
|
-
|
|
1161
|
+
const cause = e?.cause;
|
|
1162
|
+
const code = typeof cause?.code === "string" ? ` (${cause.code})` : "";
|
|
1163
|
+
throw new ErrorAuthServerUnreachable(
|
|
1164
|
+
`Could not reach the Cloudflare auth server at ${getTokenUrlFromEnv()}${code}.`,
|
|
1165
|
+
{ cause: e, telemetryMessage: "user oauth token endpoint unreachable" }
|
|
1166
|
+
);
|
|
1138
1167
|
}
|
|
1139
1168
|
}
|
|
1140
1169
|
__name(fetchAuthToken, "fetchAuthToken");
|
|
@@ -1780,12 +1809,12 @@ function createOAuthFlow(ctx) {
|
|
|
1780
1809
|
refresh_token,
|
|
1781
1810
|
scopes
|
|
1782
1811
|
});
|
|
1783
|
-
return
|
|
1812
|
+
return "refreshed";
|
|
1784
1813
|
} catch (e) {
|
|
1785
1814
|
ctx.logger.debug(
|
|
1786
1815
|
`Token refresh failed: ${e instanceof Error ? e.message : String(e)}`
|
|
1787
1816
|
);
|
|
1788
|
-
return
|
|
1817
|
+
return e instanceof ErrorAuthServerUnreachable ? "unreachable" : "rejected";
|
|
1789
1818
|
}
|
|
1790
1819
|
}
|
|
1791
1820
|
__name(refreshToken, "refreshToken");
|
|
@@ -1809,10 +1838,13 @@ function createOAuthFlow(ctx) {
|
|
|
1809
1838
|
}
|
|
1810
1839
|
return { loggedIn: false, reason: "no-credentials-login-failed" };
|
|
1811
1840
|
} else if (isRefreshNeeded(props.profile)) {
|
|
1812
|
-
const
|
|
1813
|
-
if (
|
|
1841
|
+
const refreshed = await refreshToken(props.profile);
|
|
1842
|
+
if (refreshed === "refreshed") {
|
|
1814
1843
|
return { loggedIn: true };
|
|
1815
1844
|
}
|
|
1845
|
+
if (refreshed === "unreachable") {
|
|
1846
|
+
return { loggedIn: false, reason: "token-refresh-unreachable" };
|
|
1847
|
+
}
|
|
1816
1848
|
if (ctx.isNonInteractiveOrCI()) {
|
|
1817
1849
|
return {
|
|
1818
1850
|
loggedIn: false,
|
|
@@ -1870,8 +1902,7 @@ function createOAuthFlow(ctx) {
|
|
|
1870
1902
|
}
|
|
1871
1903
|
const expired = stored.accessToken && /* @__PURE__ */ new Date() >= new Date(stored.accessToken.expiry);
|
|
1872
1904
|
if (expired) {
|
|
1873
|
-
|
|
1874
|
-
if (!didRefresh) {
|
|
1905
|
+
if (await refreshToken() !== "refreshed") {
|
|
1875
1906
|
return void 0;
|
|
1876
1907
|
}
|
|
1877
1908
|
stored = readStoredAuthState({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import { stringifyFile, parseFile, dedent, createCredentialStorageContext, createOAuthFlow, getAuthFromEnv, createProfileStore, validateAccountId, getCloudflareAccountIdFromEnv, getAuthConfigFilePath, getEncryptedAuthConfigFilePath, scrubEncryptedCredentials, validateProfileName, getCloudflareAuthUseKeyringFromEnv } from './chunk-
|
|
2
|
+
import { stringifyFile, parseFile, dedent, createCredentialStorageContext, createOAuthFlow, getAuthFromEnv, createProfileStore, validateAccountId, getCloudflareAccountIdFromEnv, getAuthConfigFilePath, getEncryptedAuthConfigFilePath, scrubEncryptedCredentials, validateProfileName, getCloudflareAuthUseKeyringFromEnv } from './chunk-FT2NMTJB.mjs';
|
|
3
3
|
import { __name } from './chunk-VAZEJK55.mjs';
|
|
4
4
|
import { existsSync, rmSync, mkdirSync, writeFileSync, chmodSync, readFileSync as readFileSync$1, readdirSync } from 'node:fs';
|
|
5
5
|
import path3 from 'node:path';
|
|
@@ -765,7 +765,8 @@ function notLoggedInErrorBodies(loginCommand) {
|
|
|
765
765
|
"no-credentials-non-interactive": `Could not authenticate because no credentials were found and the environment is non-interactive. Set a CLOUDFLARE_API_TOKEN environment variable or run \`${loginCommand}\` in an interactive terminal first.`,
|
|
766
766
|
"no-credentials-login-failed": `No credentials were found and the login attempt was unsuccessful. Run \`${loginCommand}\` to try again.`,
|
|
767
767
|
"token-expired-non-interactive": `Your auth token has expired and could not be refreshed, and the environment is non-interactive. Run \`${loginCommand}\` in an interactive terminal or set a CLOUDFLARE_API_TOKEN.`,
|
|
768
|
-
"token-expired-login-failed": `Your auth token has expired and could not be refreshed, and the login attempt was unsuccessful. Run \`${loginCommand}\` to try again
|
|
768
|
+
"token-expired-login-failed": `Your auth token has expired and could not be refreshed, and the login attempt was unsuccessful. Run \`${loginCommand}\` to try again.`,
|
|
769
|
+
"token-refresh-unreachable": `Your auth token has expired and could not be refreshed because the Cloudflare auth server could not be reached. This is usually a network problem (connectivity, proxy, or IPv6), not an invalid login: your stored credentials were left unchanged. Check your connection and try again.`
|
|
769
770
|
};
|
|
770
771
|
}
|
|
771
772
|
__name(notLoggedInErrorBodies, "notLoggedInErrorBodies");
|
|
@@ -1103,6 +1104,10 @@ ${accounts.map(
|
|
|
1103
1104
|
`In a non-interactive environment, it's necessary to set a CLOUDFLARE_API_TOKEN environment variable for ${cliName} to work. Please go to https://developers.cloudflare.com/fundamentals/api/get-started/create-token/ for instructions on how to create an api token, and assign its value to CLOUDFLARE_API_TOKEN.`,
|
|
1104
1105
|
{ telemetryMessage: "user auth missing api token non interactive" }
|
|
1105
1106
|
);
|
|
1107
|
+
} else if (result.reason === "token-refresh-unreachable") {
|
|
1108
|
+
throw new UserError(NOT_LOGGED_IN_ERROR_BODIES[result.reason], {
|
|
1109
|
+
telemetryMessage: "user auth token refresh unreachable"
|
|
1110
|
+
});
|
|
1106
1111
|
} else {
|
|
1107
1112
|
throw new UserError("Did not login, quitting...", {
|
|
1108
1113
|
telemetryMessage: "user login cancelled"
|
|
@@ -248,7 +248,9 @@ type LoginOrRefreshFailureReason =
|
|
|
248
248
|
/** the stored token has expired, refresh failed, and the environment is non-interactive so a browser login cannot be started. */
|
|
249
249
|
| "token-expired-non-interactive"
|
|
250
250
|
/** the stored token has expired, refresh failed, and the interactive login attempt was unsuccessful. */
|
|
251
|
-
| "token-expired-login-failed"
|
|
251
|
+
| "token-expired-login-failed"
|
|
252
|
+
/** the stored token has expired and the auth server could not be reached to refresh it; the stored credentials were left untouched and no login was attempted. */
|
|
253
|
+
| "token-refresh-unreachable";
|
|
252
254
|
/**
|
|
253
255
|
* Discriminated union returned by {@link OAuthFlowAPI.loginOrRefreshIfRequired}.
|
|
254
256
|
*
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as OAuthFlowLogger, U as UserAuthConfig, A as AuthConfigStorage, C as CredentialStore, F as FileFormat } from './file-format-
|
|
2
|
-
export { a as ConfigStorage, D as DeactivateDirectoryResult, b as DirectoryBindingOperations, c as DirectoryBindingsStorage, L as LoginOrRefreshFailureReason, d as LoginOrRefreshResult, e as LoginProps, f as OAuthFlowContext, P as ProfileConfigOperations, g as ProfileStore, T as TemporaryAccountRequest, h as TemporaryPreviewAccount, i as createOAuthFlow, j as createProfileStore, k as generateAuthUrl, l as generateRandomState, v as validateProfileName } from './file-format-
|
|
1
|
+
import { O as OAuthFlowLogger, U as UserAuthConfig, A as AuthConfigStorage, C as CredentialStore, F as FileFormat } from './file-format-hS8cJZA7.mjs';
|
|
2
|
+
export { a as ConfigStorage, D as DeactivateDirectoryResult, b as DirectoryBindingOperations, c as DirectoryBindingsStorage, L as LoginOrRefreshFailureReason, d as LoginOrRefreshResult, e as LoginProps, f as OAuthFlowContext, P as ProfileConfigOperations, g as ProfileStore, T as TemporaryAccountRequest, h as TemporaryPreviewAccount, i as createOAuthFlow, j as createProfileStore, k as generateAuthUrl, l as generateRandomState, v as validateProfileName } from './file-format-hS8cJZA7.mjs';
|
|
3
3
|
import { ApiCredentials } from '@cloudflare/workers-utils';
|
|
4
4
|
import { SpawnSyncReturns } from 'node:child_process';
|
|
5
5
|
|
|
@@ -42,14 +42,23 @@ declare function clearAccessCaches(): void;
|
|
|
42
42
|
* A 302 to `cloudflareaccess.com` is the canonical signal. Service-auth-only
|
|
43
43
|
* Access applications return a hard 403 instead and are therefore not detected
|
|
44
44
|
* here — see {@link getAccessHeaders} for how this is handled.
|
|
45
|
+
*
|
|
46
|
+
* When `previewToken` is supplied it is added as the `cf_workers_preview_token`
|
|
47
|
+
* query parameter so the probe activates an unpublished worker's edge-preview
|
|
48
|
+
* route (otherwise the anonymous probe 404s and Access is never triggered). The
|
|
49
|
+
* cache is keyed on whether a token was supplied so token-authenticated and
|
|
50
|
+
* anonymous probes of the same host don't poison each other.
|
|
45
51
|
*/
|
|
46
|
-
declare function domainUsesAccess(domain: string, logger: OAuthFlowLogger): Promise<boolean>;
|
|
52
|
+
declare function domainUsesAccess(domain: string, logger: OAuthFlowLogger, previewToken?: string): Promise<boolean>;
|
|
47
53
|
/**
|
|
48
54
|
* Get the headers needed to authenticate with an Access-protected domain.
|
|
49
55
|
*
|
|
50
56
|
* @param domain The hostname of the Access-protected domain (e.g. `"example.com"`).
|
|
51
57
|
* @param options logger + an `isNonInteractiveOrCI` predicate used to
|
|
52
|
-
* produce an actionable error in CI
|
|
58
|
+
* produce an actionable error in CI (both default to no-op / `false`), plus an
|
|
59
|
+
* optional `previewToken` that is added as the `cf_workers_preview_token`
|
|
60
|
+
* query parameter when probing for Access and when invoking `cloudflared
|
|
61
|
+
* access login`, so detection works on unpublished `<name>.workers.dev` hosts.
|
|
53
62
|
* @returns
|
|
54
63
|
* - Service token headers (`CF-Access-Client-Id` + `CF-Access-Client-Secret`) if env vars are set
|
|
55
64
|
* - A `Cookie: CF_Authorization=...` header if obtained via `cloudflared` (interactive only)
|
|
@@ -64,6 +73,12 @@ declare function getAccessHeaders(domain: string, options: {
|
|
|
64
73
|
isNonInteractiveOrCI?: () => boolean;
|
|
65
74
|
/** Aborts a pending `cloudflared` authorization and kills its process. */
|
|
66
75
|
signal?: AbortSignal;
|
|
76
|
+
/**
|
|
77
|
+
* Workers preview token forwarded to the Access probe and to
|
|
78
|
+
* `cloudflared access login` so detection works on unpublished
|
|
79
|
+
* `<name>.workers.dev` hosts.
|
|
80
|
+
*/
|
|
81
|
+
previewToken?: string;
|
|
67
82
|
}): Promise<Record<string, string>>;
|
|
68
83
|
|
|
69
84
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
export { EncryptedFileCredentialStore, FileCredentialStore, LinuxSecretToolKeyProvider, MacSecurityKeyProvider, NapiKeyringKeyProvider, PINNED_KEYRING_VERSION, PKCE_CHARSET, TEMPORARY_TERMS_NOTICE, TEMPORARY_TERMS_PROMPT, clearAccessCaches, clearCredentialStorageState, createCredentialStorageContext, createOAuthFlow, createProfileStore, decryptString, domainUsesAccess, encryptString, findKeyringBinding, generateAuthUrl, generateKey, generateRandomState, generateVerificationUrl, getAccessHeaders, getAuthConfigFilePath, getAuthFromEnv, getAuthUrlFromEnv, getCloudflareAPITokenFromEnv, getCloudflareAccountIdFromEnv, getCloudflareAuthUseKeyringFromEnv, getCloudflareGlobalAuthEmailFromEnv, getCloudflareGlobalAuthKeyFromEnv, getEncryptedAuthConfigFilePath, getKeyringAccountName, getKeyringInstallDir, installKeyringBindingSync, parseEncryptedEnvelope, probeSecretTool, readStoredAuthState, resetCredentialStorageState, resolveKeyProvider, scrubEncryptedCredentials, setKeyProviderFactoryForTesting, setKeyringEntryFactory, setLinuxSecretToolRunner, setMacSecurityCommandRunner, setNpmRunner, validateProfileName } from './chunk-
|
|
2
|
+
export { EncryptedFileCredentialStore, FileCredentialStore, LinuxSecretToolKeyProvider, MacSecurityKeyProvider, NapiKeyringKeyProvider, PINNED_KEYRING_VERSION, PKCE_CHARSET, TEMPORARY_TERMS_NOTICE, TEMPORARY_TERMS_PROMPT, clearAccessCaches, clearCredentialStorageState, createCredentialStorageContext, createOAuthFlow, createProfileStore, decryptString, domainUsesAccess, encryptString, findKeyringBinding, generateAuthUrl, generateKey, generateRandomState, generateVerificationUrl, getAccessHeaders, getAuthConfigFilePath, getAuthFromEnv, getAuthUrlFromEnv, getCloudflareAPITokenFromEnv, getCloudflareAccountIdFromEnv, getCloudflareAuthUseKeyringFromEnv, getCloudflareGlobalAuthEmailFromEnv, getCloudflareGlobalAuthKeyFromEnv, getEncryptedAuthConfigFilePath, getKeyringAccountName, getKeyringInstallDir, installKeyringBindingSync, parseEncryptedEnvelope, probeSecretTool, readStoredAuthState, resetCredentialStorageState, resolveKeyProvider, scrubEncryptedCredentials, setKeyProviderFactoryForTesting, setKeyringEntryFactory, setLinuxSecretToolRunner, setMacSecurityCommandRunner, setNpmRunner, validateProfileName } from './chunk-FT2NMTJB.mjs';
|
|
3
3
|
import './chunk-VAZEJK55.mjs';
|
|
4
4
|
|
|
5
5
|
createRequire(import.meta.url || (typeof __filename === "string" ? __filename : "/"));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as OAuthFlowContext, m as OAuthConsentPages, F as FileFormat, C as CredentialStore, T as TemporaryAccountRequest, d as LoginOrRefreshResult, U as UserAuthConfig } from './file-format-
|
|
1
|
+
import { f as OAuthFlowContext, m as OAuthConsentPages, F as FileFormat, C as CredentialStore, T as TemporaryAccountRequest, d as LoginOrRefreshResult, U as UserAuthConfig } from './file-format-hS8cJZA7.mjs';
|
|
2
2
|
import { ApiCredentials, ComplianceConfig } from '@cloudflare/workers-utils';
|
|
3
3
|
|
|
4
4
|
/** Minimal shape of the interactive `select` prompt's options for account selection. */
|