@lunora/auth 1.0.0-alpha.233 → 1.0.0-alpha.235
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/cimd-workers.d.mts +32 -0
- package/dist/cimd-workers.d.ts +32 -0
- package/package.json +5 -5
package/dist/cimd-workers.d.mts
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Cloudflare Workers transport for `cimd()` (Client ID Metadata Documents).
|
|
3
|
+
*
|
|
4
|
+
* `@better-auth/cimd` fetches a URL the client hands it — the `client_id` itself,
|
|
5
|
+
* and any `jwks_uri` the document names — so the fetch is server-side request
|
|
6
|
+
* forgery waiting to happen unless the transport keeps it on the public internet.
|
|
7
|
+
* The plugin therefore makes the application supply that transport, and asks it to
|
|
8
|
+
* resolve the host once, reject special-use addresses, pin the connection and
|
|
9
|
+
* refuse redirects.
|
|
10
|
+
*
|
|
11
|
+
* A Worker cannot pin a connection or see the resolved address. What it can do is
|
|
12
|
+
* run with the global_fetch_strictly_public compatibility flag, under which every
|
|
13
|
+
* global `fetch` goes out to the public internet and never to a private or
|
|
14
|
+
* special-use address, the Worker's own zone included. That is the guarantee
|
|
15
|
+
* Cloudflare's own `@cloudflare/workers-oauth-provider` builds its CIMD support on,
|
|
16
|
+
* and the one this transport requires: {@link workersCimdFetch} refuses to build
|
|
17
|
+
* without the flag, so a misconfigured deploy fails at startup instead of quietly
|
|
18
|
+
* fetching attacker-chosen internal URLs.
|
|
19
|
+
*
|
|
20
|
+
* It is weaker than the letter of cimd's contract — there is no DNS pinning, so a
|
|
21
|
+
* rebinding host still reaches *some* public address. An origin allowlist (the
|
|
22
|
+
* isMetadataDocumentUrlAllowed option) narrows that to hosts you trust, but it only
|
|
23
|
+
* gates the `client_id` fetch: oauth-provider fetches a document's `jwks_uri`
|
|
24
|
+
* through this same transport without consulting it. Add `jwks_uri` to cimd's
|
|
25
|
+
* originBoundFields so it must share the allowlisted `client_id` origin.
|
|
26
|
+
*
|
|
27
|
+
* On Node, use the default export of `@lunora/auth/cimd/node`, which
|
|
28
|
+
* does pin the connection.
|
|
29
|
+
*
|
|
30
|
+
* Kept off the package root (and out of `./plugins`) because it is Workers-only:
|
|
31
|
+
* the flag probe means nothing on any other runtime.
|
|
32
|
+
*/
|
|
1
33
|
import { ClientMetadataResourceFetch } from '@better-auth/oauth-provider';
|
|
2
34
|
/**
|
|
3
35
|
* Build the `fetchClientMetadataResource` transport for `cimd()` on Cloudflare
|
package/dist/cimd-workers.d.ts
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Cloudflare Workers transport for `cimd()` (Client ID Metadata Documents).
|
|
3
|
+
*
|
|
4
|
+
* `@better-auth/cimd` fetches a URL the client hands it — the `client_id` itself,
|
|
5
|
+
* and any `jwks_uri` the document names — so the fetch is server-side request
|
|
6
|
+
* forgery waiting to happen unless the transport keeps it on the public internet.
|
|
7
|
+
* The plugin therefore makes the application supply that transport, and asks it to
|
|
8
|
+
* resolve the host once, reject special-use addresses, pin the connection and
|
|
9
|
+
* refuse redirects.
|
|
10
|
+
*
|
|
11
|
+
* A Worker cannot pin a connection or see the resolved address. What it can do is
|
|
12
|
+
* run with the global_fetch_strictly_public compatibility flag, under which every
|
|
13
|
+
* global `fetch` goes out to the public internet and never to a private or
|
|
14
|
+
* special-use address, the Worker's own zone included. That is the guarantee
|
|
15
|
+
* Cloudflare's own `@cloudflare/workers-oauth-provider` builds its CIMD support on,
|
|
16
|
+
* and the one this transport requires: {@link workersCimdFetch} refuses to build
|
|
17
|
+
* without the flag, so a misconfigured deploy fails at startup instead of quietly
|
|
18
|
+
* fetching attacker-chosen internal URLs.
|
|
19
|
+
*
|
|
20
|
+
* It is weaker than the letter of cimd's contract — there is no DNS pinning, so a
|
|
21
|
+
* rebinding host still reaches *some* public address. An origin allowlist (the
|
|
22
|
+
* isMetadataDocumentUrlAllowed option) narrows that to hosts you trust, but it only
|
|
23
|
+
* gates the `client_id` fetch: oauth-provider fetches a document's `jwks_uri`
|
|
24
|
+
* through this same transport without consulting it. Add `jwks_uri` to cimd's
|
|
25
|
+
* originBoundFields so it must share the allowlisted `client_id` origin.
|
|
26
|
+
*
|
|
27
|
+
* On Node, use the default export of `@lunora/auth/cimd/node`, which
|
|
28
|
+
* does pin the connection.
|
|
29
|
+
*
|
|
30
|
+
* Kept off the package root (and out of `./plugins`) because it is Workers-only:
|
|
31
|
+
* the flag probe means nothing on any other runtime.
|
|
32
|
+
*/
|
|
1
33
|
import { ClientMetadataResourceFetch } from '@better-auth/oauth-provider';
|
|
2
34
|
/**
|
|
3
35
|
* Build the `fetchClientMetadataResource` transport for `cimd()` on Cloudflare
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/auth",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.235",
|
|
4
4
|
"description": "Auth for Lunora — a thin better-auth wrapper: email/password, OAuth, plugins, D1-backed",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auth",
|
|
@@ -117,11 +117,11 @@
|
|
|
117
117
|
"@better-auth/passkey": "1.7.7",
|
|
118
118
|
"@better-auth/scim": "1.7.7",
|
|
119
119
|
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
120
|
-
"@lunora/values": "1.0.0-alpha.
|
|
120
|
+
"@lunora/values": "1.0.0-alpha.82",
|
|
121
121
|
"@lunora/wire": "1.0.0-alpha.2",
|
|
122
|
-
"@visulima/disposable-email-domains": "
|
|
123
|
-
"@visulima/email-verifier": "1.0.
|
|
124
|
-
"@visulima/free-email-domains": "
|
|
122
|
+
"@visulima/disposable-email-domains": "2.0.10",
|
|
123
|
+
"@visulima/email-verifier": "1.0.54",
|
|
124
|
+
"@visulima/free-email-domains": "2.0.0",
|
|
125
125
|
"@visulima/redact": "5.0.0"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|