@atlasauth/nextjs 0.8.0 → 0.9.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/CHANGELOG.md +14 -0
- package/README.md +37 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mount.d.ts +67 -0
- package/dist/mount.js +128 -0
- package/dist/mount.js.map +1 -0
- package/dist/proxy.d.ts +30 -1
- package/dist/proxy.js +71 -3
- package/dist/proxy.js.map +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.js +5 -0
- package/dist/server.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.9.0 — 2026-11-03
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `createMountHandler({ upstream?, proxySecret?, basePath?, fetchImpl? })`: App Router handlers (`GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `HEAD`) that serve the Atlas Frontend API under a path of your app (a path mount). Reads `ATLAS_UPSTREAM` and `ATLAS_PROXY_SECRET` by default. Also exported from `@atlasauth/nextjs/server`.
|
|
10
|
+
- `createVerifyHandler({ verifyToken? })`: the `/.well-known/atlas-verify/[token]` file for claiming the mount (`ATLAS_VERIFY_TOKEN`).
|
|
11
|
+
- `atlasProxy({ csrf: true | { secret?, mountBasePath? } })`: session-bound CSRF tokens for signed-in browsers; unsafe methods without a valid token get 403 `CSRF_TOKEN_INVALID`. `proxyCsrfToken(request)`, the `x-atlas-csrf-token` forwarded header and `ForwardedAuth.csrfToken`.
|
|
12
|
+
|
|
13
|
+
## 0.8.1 — 2026-10-28
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Next.js 15 edge `middleware.ts` builds again: the middleware no longer pulls `node:crypto` into the edge bundle (via `@atlasauth/backend` 0.27.1).
|
|
18
|
+
|
|
5
19
|
## 0.8.0 — 2026-10-25
|
|
6
20
|
|
|
7
21
|
### Added
|
package/README.md
CHANGED
|
@@ -104,6 +104,43 @@ const initialState = await getAtlasInitialState();
|
|
|
104
104
|
|
|
105
105
|
`getAtlasInitialState()` fetches the instance's public sign-in data (`/v1/appearance` and `/v1/client/environment`) on the server, cached for 60 seconds (`revalidate`). With it, `<SignIn />` renders styled and with its social buttons in the server HTML. It reads `ATLAS_PUBLISHABLE_KEY` and `ATLAS_FRONTEND_API` (or their `NEXT_PUBLIC_` forms) and never throws: anything it can't fetch within `timeoutMs` (1500 ms) is left for the browser.
|
|
106
106
|
|
|
107
|
+
## CSRF protection
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
const atlas = atlasProxy({ ...config, csrf: true });
|
|
111
|
+
export async function proxy(req: NextRequest) {
|
|
112
|
+
return (await atlas(req)) ?? withAtlasHeaders(req, NextResponse.next());
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
For a signed-in browser the proxy keeps a token bound to the session in the `__atlas_csrf` cookie, and refuses a `POST`, `PUT`, `PATCH` or `DELETE` without it with `403` (`CSRF_TOKEN_INVALID`). Send the token in the `x-atlas-csrf` header (read it from the cookie) or as an `atlas_csrf` form field. In a server component, `readAtlasHeaders(await headers()).csrfToken` gives it for rendering a form.
|
|
117
|
+
|
|
118
|
+
- Requests with `Authorization: Bearer`, signed-out requests and your path mount (`mountBasePath`, default `ATLAS_BASE_PATH` or `/atlas`) are exempt.
|
|
119
|
+
- The secret is `ATLAS_CSRF_SECRET`, or derived from `ATLAS_SECRET_KEY`. Use the same one with `verifyCsrf` from `@atlasauth/backend` in your own handlers.
|
|
120
|
+
- `withAtlasHeaders` sets the cookie, so call it on the response your proxy returns.
|
|
121
|
+
|
|
122
|
+
## Frontend API on your own domain (path mount)
|
|
123
|
+
|
|
124
|
+
Serve Atlas under a path of your app, with no DNS record and no reverse proxy of your own. Claim the host with `method: "path"` and a `base_path` such as `/atlas`, then add two route handlers:
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
// app/atlas/[[...path]]/route.ts
|
|
128
|
+
import { createMountHandler } from '@atlasauth/nextjs/server';
|
|
129
|
+
export const { GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD } = createMountHandler({ basePath: '/atlas' });
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
// app/.well-known/atlas-verify/[token]/route.ts
|
|
134
|
+
import { createVerifyHandler } from '@atlasauth/nextjs/server';
|
|
135
|
+
export const { GET } = createVerifyHandler();
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Set `ATLAS_UPSTREAM` (your instance's Frontend API host, from the domain's `instructions.upstream`), `ATLAS_PROXY_SECRET` (from `POST /v1/instance/proxy_secret`) and `ATLAS_VERIFY_TOKEN` (the domain's `verification.token`).
|
|
139
|
+
|
|
140
|
+
Use a base path without a leading underscore, such as `/atlas`. The App Router treats folders starting with `_` as private and never routes them, so the default `/__atlas` doesn't work in Next.js.
|
|
141
|
+
|
|
142
|
+
The handler forwards the method, path, query and body, sets `X-Atlas-Forwarded-Host`, `X-Atlas-Proxy-Secret`, `X-Atlas-Client-IP`, `X-Forwarded-For` and `X-Forwarded-Proto` itself (never from the browser), and returns every `Set-Cookie` and redirect unchanged. Both handlers are also exported from `@atlasauth/nextjs`.
|
|
143
|
+
|
|
107
144
|
## Routing rules
|
|
108
145
|
|
|
109
146
|
- Routes are protected unless they match `publicRoutes`. `protectedRoutes` wins over `publicRoutes`.
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -18,4 +18,5 @@ __exportStar(require("./matcher"), exports);
|
|
|
18
18
|
__exportStar(require("./middleware"), exports);
|
|
19
19
|
__exportStar(require("./proxy"), exports);
|
|
20
20
|
__exportStar(require("./access-token"), exports);
|
|
21
|
+
__exportStar(require("./mount"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,+CAA6B;AAC7B,0CAAwB;AACxB,iDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,+CAA6B;AAC7B,0CAAwB;AACxB,iDAA+B;AAC/B,0CAAwB"}
|
package/dist/mount.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serve the Atlas Frontend API under a path of your Next.js app (a path mount),
|
|
3
|
+
* with no reverse proxy of your own: a catch-all App Router route forwards
|
|
4
|
+
* `/<base>/…` to your instance's Frontend API host with the headers Atlas needs.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* // app/atlas/[[...path]]/route.ts
|
|
8
|
+
* import { createMountHandler } from '@atlasauth/nextjs';
|
|
9
|
+
* export const { GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD } = createMountHandler({ basePath: '/atlas' });
|
|
10
|
+
*
|
|
11
|
+
* // app/.well-known/atlas-verify/[token]/route.ts
|
|
12
|
+
* import { createVerifyHandler } from '@atlasauth/nextjs';
|
|
13
|
+
* export const { GET } = createVerifyHandler();
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Use a base path without a leading underscore (`/atlas`, not `/__atlas`): the
|
|
17
|
+
* App Router treats `_folder` as private and never routes it.
|
|
18
|
+
*
|
|
19
|
+
* Web-standard only (`fetch`, `Headers`, `Response`), so it runs on the Node.js
|
|
20
|
+
* and Edge runtimes.
|
|
21
|
+
*/
|
|
22
|
+
export interface AtlasMountOptions {
|
|
23
|
+
/** Your instance's Frontend API host (`instructions.upstream` of the domain). Default `ATLAS_UPSTREAM`. */
|
|
24
|
+
upstream?: string;
|
|
25
|
+
/** The instance proxy secret. Default `ATLAS_PROXY_SECRET`. */
|
|
26
|
+
proxySecret?: string;
|
|
27
|
+
/** The domain verification token (for {@link createVerifyHandler}). Default `ATLAS_VERIFY_TOKEN`. */
|
|
28
|
+
verifyToken?: string;
|
|
29
|
+
/** The mount's `base_path`, as registered with Atlas. Default `/atlas`. */
|
|
30
|
+
basePath?: string;
|
|
31
|
+
fetchImpl?: typeof fetch;
|
|
32
|
+
}
|
|
33
|
+
type Handler = (request: Request) => Promise<Response>;
|
|
34
|
+
export interface AtlasMountHandlers {
|
|
35
|
+
GET: Handler;
|
|
36
|
+
POST: Handler;
|
|
37
|
+
PUT: Handler;
|
|
38
|
+
PATCH: Handler;
|
|
39
|
+
DELETE: Handler;
|
|
40
|
+
OPTIONS: Handler;
|
|
41
|
+
HEAD: Handler;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* App Router handlers that forward the mount to Atlas: method, path (base
|
|
45
|
+
* included: Atlas reads the prefix from it), query and streamed body unchanged;
|
|
46
|
+
* hop-by-hop headers dropped; `X-Atlas-Forwarded-Host`, `X-Atlas-Proxy-Secret`,
|
|
47
|
+
* `X-Atlas-Client-IP`, `X-Forwarded-For` and `X-Forwarded-Proto` set from the
|
|
48
|
+
* request (never passed on from the browser). The response keeps its status,
|
|
49
|
+
* headers and EVERY `Set-Cookie`; redirects are returned, not followed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createMountHandler(options?: AtlasMountOptions): AtlasMountHandlers;
|
|
52
|
+
type VerifyContext = {
|
|
53
|
+
params: {
|
|
54
|
+
token?: string | string[];
|
|
55
|
+
} | Promise<{
|
|
56
|
+
token?: string | string[];
|
|
57
|
+
}>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The domain-verification file for `app/.well-known/atlas-verify/[token]/route.ts`:
|
|
61
|
+
* 200 `text/plain` with the token when it equals `ATLAS_VERIFY_TOKEN`
|
|
62
|
+
* (or `verifyToken`), else 404.
|
|
63
|
+
*/
|
|
64
|
+
export declare function createVerifyHandler(options?: Pick<AtlasMountOptions, 'verifyToken'>): {
|
|
65
|
+
GET: (request: Request, context?: VerifyContext) => Promise<Response>;
|
|
66
|
+
};
|
|
67
|
+
export {};
|
package/dist/mount.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Serve the Atlas Frontend API under a path of your Next.js app (a path mount),
|
|
4
|
+
* with no reverse proxy of your own: a catch-all App Router route forwards
|
|
5
|
+
* `/<base>/…` to your instance's Frontend API host with the headers Atlas needs.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* // app/atlas/[[...path]]/route.ts
|
|
9
|
+
* import { createMountHandler } from '@atlasauth/nextjs';
|
|
10
|
+
* export const { GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD } = createMountHandler({ basePath: '/atlas' });
|
|
11
|
+
*
|
|
12
|
+
* // app/.well-known/atlas-verify/[token]/route.ts
|
|
13
|
+
* import { createVerifyHandler } from '@atlasauth/nextjs';
|
|
14
|
+
* export const { GET } = createVerifyHandler();
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Use a base path without a leading underscore (`/atlas`, not `/__atlas`): the
|
|
18
|
+
* App Router treats `_folder` as private and never routes it.
|
|
19
|
+
*
|
|
20
|
+
* Web-standard only (`fetch`, `Headers`, `Response`), so it runs on the Node.js
|
|
21
|
+
* and Edge runtimes.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.createMountHandler = createMountHandler;
|
|
25
|
+
exports.createVerifyHandler = createVerifyHandler;
|
|
26
|
+
function readEnv() {
|
|
27
|
+
return globalThis.process?.env ?? {};
|
|
28
|
+
}
|
|
29
|
+
const HOP_BY_HOP = new Set(['connection', 'keep-alive', 'transfer-encoding', 'upgrade', 'te', 'trailer', 'host', 'content-length']);
|
|
30
|
+
const dropRequestHeader = (name) => HOP_BY_HOP.has(name) || name.startsWith('proxy-') || name.startsWith('x-atlas-') || name.startsWith('x-forwarded-') || name === 'forwarded' || name === 'x-real-ip';
|
|
31
|
+
const DROP_RESPONSE = new Set(['connection', 'keep-alive', 'transfer-encoding', 'upgrade', 'te', 'trailer', 'content-encoding', 'content-length', 'set-cookie']);
|
|
32
|
+
const NULL_BODY_STATUS = new Set([101, 204, 205, 304]);
|
|
33
|
+
function setCookies(headers) {
|
|
34
|
+
const h = headers;
|
|
35
|
+
if (typeof h.getSetCookie === 'function')
|
|
36
|
+
return h.getSetCookie();
|
|
37
|
+
const single = headers.get('set-cookie');
|
|
38
|
+
return single ? [single] : [];
|
|
39
|
+
}
|
|
40
|
+
function clientIp(headers) {
|
|
41
|
+
const xff = headers.get('x-forwarded-for')?.split(',')[0]?.trim();
|
|
42
|
+
return xff || headers.get('x-real-ip')?.trim() || undefined;
|
|
43
|
+
}
|
|
44
|
+
/** `/atlas`, normalised: one leading slash, no trailing slash. */
|
|
45
|
+
function normaliseBase(raw) {
|
|
46
|
+
const base = `/${raw.trim().replace(/^\/+|\/+$/g, '')}`;
|
|
47
|
+
if (base === '/')
|
|
48
|
+
throw new Error('@atlasauth/nextjs createMountHandler: basePath must not be "/"');
|
|
49
|
+
return base;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* App Router handlers that forward the mount to Atlas: method, path (base
|
|
53
|
+
* included: Atlas reads the prefix from it), query and streamed body unchanged;
|
|
54
|
+
* hop-by-hop headers dropped; `X-Atlas-Forwarded-Host`, `X-Atlas-Proxy-Secret`,
|
|
55
|
+
* `X-Atlas-Client-IP`, `X-Forwarded-For` and `X-Forwarded-Proto` set from the
|
|
56
|
+
* request (never passed on from the browser). The response keeps its status,
|
|
57
|
+
* headers and EVERY `Set-Cookie`; redirects are returned, not followed.
|
|
58
|
+
*/
|
|
59
|
+
function createMountHandler(options = {}) {
|
|
60
|
+
const handle = async (request) => {
|
|
61
|
+
const env = readEnv();
|
|
62
|
+
const upstream = options.upstream ?? env.ATLAS_UPSTREAM;
|
|
63
|
+
const proxySecret = options.proxySecret ?? env.ATLAS_PROXY_SECRET;
|
|
64
|
+
if (!upstream)
|
|
65
|
+
throw new Error('@atlasauth/nextjs createMountHandler: set ATLAS_UPSTREAM (your Frontend API host).');
|
|
66
|
+
if (!proxySecret)
|
|
67
|
+
throw new Error('@atlasauth/nextjs createMountHandler: set ATLAS_PROXY_SECRET (POST /v1/instance/proxy_secret).');
|
|
68
|
+
const base = normaliseBase(options.basePath ?? '/atlas');
|
|
69
|
+
const url = new URL(request.url);
|
|
70
|
+
if (url.pathname !== base && !url.pathname.startsWith(`${base}/`)) {
|
|
71
|
+
return new Response('Not found', { status: 404 });
|
|
72
|
+
}
|
|
73
|
+
const origin = new URL(/^https?:\/\//i.test(upstream) ? upstream : `https://${upstream}`).origin;
|
|
74
|
+
const target = `${origin}${url.pathname}${url.search}`;
|
|
75
|
+
const headers = new Headers();
|
|
76
|
+
request.headers.forEach((value, key) => {
|
|
77
|
+
if (!dropRequestHeader(key.toLowerCase()))
|
|
78
|
+
headers.set(key, value);
|
|
79
|
+
});
|
|
80
|
+
headers.set('x-atlas-forwarded-host', request.headers.get('host') ?? url.host);
|
|
81
|
+
headers.set('x-atlas-proxy-secret', proxySecret);
|
|
82
|
+
const ip = clientIp(request.headers);
|
|
83
|
+
if (ip) {
|
|
84
|
+
headers.set('x-atlas-client-ip', ip);
|
|
85
|
+
headers.set('x-forwarded-for', ip);
|
|
86
|
+
}
|
|
87
|
+
headers.set('x-forwarded-proto', request.headers.get('x-forwarded-proto')?.split(',')[0]?.trim() || url.protocol.replace(':', ''));
|
|
88
|
+
const method = request.method.toUpperCase();
|
|
89
|
+
const hasBody = method !== 'GET' && method !== 'HEAD' && request.body !== null;
|
|
90
|
+
const res = await (options.fetchImpl ?? fetch)(target, {
|
|
91
|
+
method,
|
|
92
|
+
headers,
|
|
93
|
+
body: hasBody ? request.body : undefined,
|
|
94
|
+
redirect: 'manual',
|
|
95
|
+
// Required by fetch to stream a request body.
|
|
96
|
+
...(hasBody ? { duplex: 'half' } : {}),
|
|
97
|
+
});
|
|
98
|
+
const out = new Headers();
|
|
99
|
+
res.headers.forEach((value, key) => {
|
|
100
|
+
if (!DROP_RESPONSE.has(key.toLowerCase()))
|
|
101
|
+
out.append(key, value);
|
|
102
|
+
});
|
|
103
|
+
for (const cookie of setCookies(res.headers))
|
|
104
|
+
out.append('set-cookie', cookie);
|
|
105
|
+
const body = method === 'HEAD' || NULL_BODY_STATUS.has(res.status) ? null : res.body;
|
|
106
|
+
return new Response(body, { status: res.status, statusText: res.statusText, headers: out });
|
|
107
|
+
};
|
|
108
|
+
return { GET: handle, POST: handle, PUT: handle, PATCH: handle, DELETE: handle, OPTIONS: handle, HEAD: handle };
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The domain-verification file for `app/.well-known/atlas-verify/[token]/route.ts`:
|
|
112
|
+
* 200 `text/plain` with the token when it equals `ATLAS_VERIFY_TOKEN`
|
|
113
|
+
* (or `verifyToken`), else 404.
|
|
114
|
+
*/
|
|
115
|
+
function createVerifyHandler(options = {}) {
|
|
116
|
+
return {
|
|
117
|
+
async GET(request, context) {
|
|
118
|
+
const expected = options.verifyToken ?? readEnv().ATLAS_VERIFY_TOKEN;
|
|
119
|
+
const fromParams = context ? (await context.params).token : undefined;
|
|
120
|
+
const token = (Array.isArray(fromParams) ? fromParams[0] : fromParams) ??
|
|
121
|
+
decodeURIComponent(new URL(request.url).pathname.split('/').filter(Boolean).pop() ?? '');
|
|
122
|
+
if (!expected || token !== expected)
|
|
123
|
+
return new Response('Not found', { status: 404 });
|
|
124
|
+
return new Response(token, { status: 200, headers: { 'content-type': 'text/plain; charset=utf-8', 'cache-control': 'no-store' } });
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=mount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,2BAA2B,EAAE,eAAe,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;QACrI,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/proxy.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export declare const ATLAS_AUTH_HEADERS: {
|
|
|
31
31
|
readonly sessionId: "x-atlas-session-id";
|
|
32
32
|
readonly orgId: "x-atlas-org-id";
|
|
33
33
|
readonly orgRole: "x-atlas-org-role";
|
|
34
|
+
/** With `csrf`: the CSRF token valid for this session, to render into forms (`atlas_csrf`). */
|
|
35
|
+
readonly csrfToken: "x-atlas-csrf-token";
|
|
34
36
|
};
|
|
35
37
|
/** What `atlasProxy` needs from a request: a `NextRequest` satisfies it. */
|
|
36
38
|
export interface ProxyRequest extends EdgeRequest {
|
|
@@ -46,18 +48,43 @@ export interface HeaderCarryingResponse {
|
|
|
46
48
|
headers: Headers;
|
|
47
49
|
}
|
|
48
50
|
export type AtlasProxy = (request: ProxyRequest) => Promise<Response | null>;
|
|
51
|
+
/** Options for {@link AtlasProxyOptions.csrf}. */
|
|
52
|
+
export interface AtlasProxyCsrfOptions {
|
|
53
|
+
/**
|
|
54
|
+
* The HMAC secret (16+ characters). Default `ATLAS_CSRF_SECRET`, else derived
|
|
55
|
+
* from `ATLAS_SECRET_KEY` (HKDF), so `verifyCsrf` in your own handlers can use
|
|
56
|
+
* the same one.
|
|
57
|
+
*/
|
|
58
|
+
secret?: string;
|
|
59
|
+
/** Your Frontend API path mount, which Atlas protects itself. Default `ATLAS_BASE_PATH` or `/atlas`. */
|
|
60
|
+
mountBasePath?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface AtlasProxyOptions extends AtlasMiddlewareOptions {
|
|
63
|
+
/**
|
|
64
|
+
* CSRF protection for signed-in browsers. The proxy keeps a session-bound
|
|
65
|
+
* token in the `__atlas_csrf` cookie (readable by your JS) and refuses a
|
|
66
|
+
* POST / PUT / PATCH / DELETE with 403 unless it carries the same token in
|
|
67
|
+
* the `x-atlas-csrf` header or an `atlas_csrf` form field. Requests with
|
|
68
|
+
* `Authorization: Bearer`, signed-out requests and the mount base path are
|
|
69
|
+
* exempt. The cookie is set by {@link withAtlasHeaders}; server components
|
|
70
|
+
* read the token from the `x-atlas-csrf-token` request header.
|
|
71
|
+
*/
|
|
72
|
+
csrf?: boolean | AtlasProxyCsrfOptions;
|
|
73
|
+
}
|
|
49
74
|
/**
|
|
50
75
|
* The Next.js 16 `proxy.ts` entry for Atlas. Same options, same decisions as
|
|
51
76
|
* `atlasMiddleware` (they share one engine) — only the calling convention
|
|
52
77
|
* differs: it takes just the request and resolves to `Response | null`.
|
|
53
78
|
*/
|
|
54
|
-
export declare function atlasProxy(options:
|
|
79
|
+
export declare function atlasProxy(options: AtlasProxyOptions): AtlasProxy;
|
|
55
80
|
/**
|
|
56
81
|
* The auth state the proxy resolved for this request (signed-out if the proxy
|
|
57
82
|
* hasn't run on it). For extra checks inside `proxy.ts` itself — a role gate on
|
|
58
83
|
* `/admin`, say — without verifying the token again.
|
|
59
84
|
*/
|
|
60
85
|
export declare function proxyAuth(request: object): AuthState;
|
|
86
|
+
/** The CSRF token `atlasProxy({ csrf })` holds for this request (null without `csrf` or when signed out). */
|
|
87
|
+
export declare function proxyCsrfToken(request: object): string | null;
|
|
61
88
|
/**
|
|
62
89
|
* Forward the verified session to the app as `x-atlas-*` REQUEST headers on a
|
|
63
90
|
* response produced by any later step of the chain (`NextResponse.next()`, a
|
|
@@ -84,6 +111,8 @@ export interface ForwardedAuth {
|
|
|
84
111
|
sessionId: string | null;
|
|
85
112
|
orgId: string | null;
|
|
86
113
|
orgRole: string | null;
|
|
114
|
+
/** With `atlasProxy({ csrf })`: the token to render as the `atlas_csrf` form field. */
|
|
115
|
+
csrfToken: string | null;
|
|
87
116
|
}
|
|
88
117
|
/**
|
|
89
118
|
* Read the `x-atlas-*` headers the proxy forwarded (e.g. from `await headers()`
|
package/dist/proxy.js
CHANGED
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ATLAS_AUTH_HEADERS = void 0;
|
|
4
4
|
exports.atlasProxy = atlasProxy;
|
|
5
5
|
exports.proxyAuth = proxyAuth;
|
|
6
|
+
exports.proxyCsrfToken = proxyCsrfToken;
|
|
6
7
|
exports.withAtlasHeaders = withAtlasHeaders;
|
|
7
8
|
exports.readAtlasHeaders = readAtlasHeaders;
|
|
9
|
+
const backend_1 = require("@atlasauth/backend");
|
|
8
10
|
const middleware_1 = require("./middleware");
|
|
9
11
|
/**
|
|
10
12
|
* Next.js 16 renamed `middleware.ts` to `proxy.ts` (exporting `proxy` or a
|
|
@@ -38,6 +40,8 @@ exports.ATLAS_AUTH_HEADERS = {
|
|
|
38
40
|
sessionId: 'x-atlas-session-id',
|
|
39
41
|
orgId: 'x-atlas-org-id',
|
|
40
42
|
orgRole: 'x-atlas-org-role',
|
|
43
|
+
/** With `csrf`: the CSRF token valid for this session, to render into forms (`atlas_csrf`). */
|
|
44
|
+
csrfToken: 'x-atlas-csrf-token',
|
|
41
45
|
};
|
|
42
46
|
const ATLAS_HEADER_PREFIX = 'x-atlas-';
|
|
43
47
|
const OVERRIDE_LIST = 'x-middleware-override-headers';
|
|
@@ -45,6 +49,53 @@ const OVERRIDE_PREFIX = 'x-middleware-request-';
|
|
|
45
49
|
/** Auth state per request, recorded by the proxy for `withAtlasHeaders` /
|
|
46
50
|
* `proxyAuth`. Weak, so a finished request's state is collected with it. */
|
|
47
51
|
const resolved = new WeakMap();
|
|
52
|
+
/** The CSRF token per request, and whether the cookie must be (re)set. */
|
|
53
|
+
const csrfState = new WeakMap();
|
|
54
|
+
const UNSAFE_METHODS = new Set(['POST', 'PUT', 'PATCH', 'DELETE']);
|
|
55
|
+
function readEnv() {
|
|
56
|
+
return globalThis.process?.env ?? {};
|
|
57
|
+
}
|
|
58
|
+
function csrfCookie(token, secure) {
|
|
59
|
+
return `${backend_1.CSRF_COOKIE}=${encodeURIComponent(token)}; Path=/; SameSite=Lax${secure ? '; Secure' : ''}`;
|
|
60
|
+
}
|
|
61
|
+
function underBase(pathname, base) {
|
|
62
|
+
return pathname === base || pathname.startsWith(`${base}/`);
|
|
63
|
+
}
|
|
64
|
+
/** The CSRF gate: a 403 to return, or null after recording the request's token. */
|
|
65
|
+
function createCsrfGate(option) {
|
|
66
|
+
const config = option === true ? {} : option;
|
|
67
|
+
let secret;
|
|
68
|
+
return async function gate(request, auth) {
|
|
69
|
+
if (!auth.sessionId)
|
|
70
|
+
return null;
|
|
71
|
+
if (request.headers.get('authorization')?.startsWith('Bearer '))
|
|
72
|
+
return null;
|
|
73
|
+
const env = readEnv();
|
|
74
|
+
const base = `/${(config.mountBasePath ?? env.ATLAS_BASE_PATH ?? '/atlas').replace(/^\/+|\/+$/g, '')}`;
|
|
75
|
+
if (underBase(request.nextUrl.pathname, base))
|
|
76
|
+
return null;
|
|
77
|
+
if (!secret) {
|
|
78
|
+
secret = config.secret ?? env.ATLAS_CSRF_SECRET ?? (env.ATLAS_SECRET_KEY ? (0, backend_1.deriveCsrfSecret)(env.ATLAS_SECRET_KEY) : undefined);
|
|
79
|
+
if (!secret)
|
|
80
|
+
throw new Error('@atlasauth/nextjs atlasProxy({ csrf }): set ATLAS_CSRF_SECRET or ATLAS_SECRET_KEY.');
|
|
81
|
+
}
|
|
82
|
+
const opts = { sid: auth.sessionId, secret };
|
|
83
|
+
const secure = !(request.url ?? '').startsWith('http:');
|
|
84
|
+
const existing = (0, backend_1.readCookieValue)(request.headers.get('cookie'), backend_1.CSRF_COOKIE);
|
|
85
|
+
const state = existing && (0, backend_1.checkCsrfToken)(existing, opts)
|
|
86
|
+
? { token: existing, setCookie: false, secure }
|
|
87
|
+
: { token: (0, backend_1.csrfToken)(opts), setCookie: true, secure };
|
|
88
|
+
csrfState.set(request, state);
|
|
89
|
+
if (!UNSAFE_METHODS.has((request.method ?? 'GET').toUpperCase()))
|
|
90
|
+
return null;
|
|
91
|
+
if (await (0, backend_1.verifyCsrf)(request, opts))
|
|
92
|
+
return null;
|
|
93
|
+
const headers = new Headers({ 'content-type': 'application/json' });
|
|
94
|
+
if (state.setCookie)
|
|
95
|
+
headers.append('set-cookie', csrfCookie(state.token, secure));
|
|
96
|
+
return new Response(JSON.stringify({ errors: [{ code: 'CSRF_TOKEN_INVALID' }] }), { status: 403, headers });
|
|
97
|
+
};
|
|
98
|
+
}
|
|
48
99
|
function serializeCookie({ name, value, options }) {
|
|
49
100
|
// Same encoding Next's `response.cookies.set` applies, so readers agree.
|
|
50
101
|
const parts = [`${name}=${encodeURIComponent(value)}`];
|
|
@@ -70,12 +121,13 @@ function serializeCookie({ name, value, options }) {
|
|
|
70
121
|
*/
|
|
71
122
|
function atlasProxy(options) {
|
|
72
123
|
const decide = (0, middleware_1.createAtlasDecider)(options);
|
|
124
|
+
const csrfGate = options.csrf ? createCsrfGate(options.csrf) : null;
|
|
73
125
|
return async function proxy(request) {
|
|
74
126
|
const decision = await decide(request);
|
|
75
127
|
resolved.set(request, decision.auth);
|
|
76
128
|
switch (decision.kind) {
|
|
77
129
|
case 'continue':
|
|
78
|
-
return null;
|
|
130
|
+
return csrfGate ? csrfGate(request, decision.auth) : null;
|
|
79
131
|
case 'unauthorized':
|
|
80
132
|
return new Response(JSON.stringify(middleware_1.UNAUTHENTICATED_BODY), {
|
|
81
133
|
status: 401,
|
|
@@ -100,7 +152,11 @@ function atlasProxy(options) {
|
|
|
100
152
|
function proxyAuth(request) {
|
|
101
153
|
return resolved.get(request) ?? middleware_1.SIGNED_OUT;
|
|
102
154
|
}
|
|
103
|
-
|
|
155
|
+
/** The CSRF token `atlasProxy({ csrf })` holds for this request (null without `csrf` or when signed out). */
|
|
156
|
+
function proxyCsrfToken(request) {
|
|
157
|
+
return csrfState.get(request)?.token ?? null;
|
|
158
|
+
}
|
|
159
|
+
function authHeaderValues(auth, csrf) {
|
|
104
160
|
const values = [
|
|
105
161
|
[exports.ATLAS_AUTH_HEADERS.status, auth.userId ? 'signed-in' : 'signed-out'],
|
|
106
162
|
];
|
|
@@ -112,6 +168,8 @@ function authHeaderValues(auth) {
|
|
|
112
168
|
values.push([exports.ATLAS_AUTH_HEADERS.orgId, auth.orgId]);
|
|
113
169
|
if (auth.orgRole)
|
|
114
170
|
values.push([exports.ATLAS_AUTH_HEADERS.orgRole, auth.orgRole]);
|
|
171
|
+
if (csrf)
|
|
172
|
+
values.push([exports.ATLAS_AUTH_HEADERS.csrfToken, csrf]);
|
|
115
173
|
return values;
|
|
116
174
|
}
|
|
117
175
|
/**
|
|
@@ -133,6 +191,15 @@ function authHeaderValues(auth) {
|
|
|
133
191
|
* signed-out if it didn't run.
|
|
134
192
|
*/
|
|
135
193
|
function withAtlasHeaders(request, response, auth = proxyAuth(request)) {
|
|
194
|
+
const csrf = csrfState.get(request);
|
|
195
|
+
if (csrf?.setCookie) {
|
|
196
|
+
try {
|
|
197
|
+
response.headers.append('set-cookie', csrfCookie(csrf.token, csrf.secure));
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
// Immutable headers (a bare `Response.redirect`): the next response sets it.
|
|
201
|
+
}
|
|
202
|
+
}
|
|
136
203
|
const continues = response.headers.has('x-middleware-next') || response.headers.has('x-middleware-rewrite');
|
|
137
204
|
if (!continues)
|
|
138
205
|
return response;
|
|
@@ -164,7 +231,7 @@ function withAtlasHeaders(request, response, auth = proxyAuth(request)) {
|
|
|
164
231
|
response.headers.set(`${OVERRIDE_PREFIX}${name}`, value);
|
|
165
232
|
});
|
|
166
233
|
}
|
|
167
|
-
for (const [name, value] of authHeaderValues(auth)) {
|
|
234
|
+
for (const [name, value] of authHeaderValues(auth, csrf?.token)) {
|
|
168
235
|
names.add(name);
|
|
169
236
|
response.headers.set(`${OVERRIDE_PREFIX}${name}`, value);
|
|
170
237
|
}
|
|
@@ -186,6 +253,7 @@ function readAtlasHeaders(headers) {
|
|
|
186
253
|
sessionId: signedIn ? headers.get(exports.ATLAS_AUTH_HEADERS.sessionId) : null,
|
|
187
254
|
orgId: signedIn ? headers.get(exports.ATLAS_AUTH_HEADERS.orgId) : null,
|
|
188
255
|
orgRole: signedIn ? headers.get(exports.ATLAS_AUTH_HEADERS.orgRole) : null,
|
|
256
|
+
csrfToken: signedIn ? headers.get(exports.ATLAS_AUTH_HEADERS.csrfToken) : null,
|
|
189
257
|
};
|
|
190
258
|
}
|
|
191
259
|
//# sourceMappingURL=proxy.js.map
|
package/dist/proxy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":";;;AA2KA,gCA2BC;AAOD,8BAEC;AAGD,wCAEC;AAgCD,4CAiDC;AAmBD,4CAWC;AAnUD,gDAO4B;AAC5B,6CAQsB;AAEtB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;iDACiD;AACpC,QAAA,kBAAkB,GAAG;IAChC,MAAM,EAAE,qBAAqB;IAC7B,MAAM,EAAE,iBAAiB;IACzB,SAAS,EAAE,oBAAoB;IAC/B,KAAK,EAAE,gBAAgB;IACvB,OAAO,EAAE,kBAAkB;IAC3B,+FAA+F;IAC/F,SAAS,EAAE,oBAAoB;CACvB,CAAC;AAEX,MAAM,mBAAmB,GAAG,UAAU,CAAC;AACvC,MAAM,aAAa,GAAG,+BAA+B,CAAC;AACtD,MAAM,eAAe,GAAG,uBAAuB,CAAC;AA4ChD;6EAC6E;AAC7E,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAqB,CAAC;AAClD,0EAA0E;AAC1E,MAAM,SAAS,GAAG,IAAI,OAAO,EAAkE,CAAC;AAEhG,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEnE,SAAS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AAC,CAAC,IAAI;QACtE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,0BAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI;QAC9D,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,0BAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;QAClE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,0BAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI;KACvE,CAAC;AACJ,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -105,3 +105,5 @@ export declare function getAtlasInitialState(options?: {
|
|
|
105
105
|
}, env?: Env): Promise<AtlasInitialState>;
|
|
106
106
|
export type { AtlasClient, AtlasClientConfig } from '@atlasauth/backend';
|
|
107
107
|
export type { AuthState, CurrentUser, EdgeRequest } from './middleware';
|
|
108
|
+
export { createMountHandler, createVerifyHandler } from './mount';
|
|
109
|
+
export type { AtlasMountHandlers, AtlasMountOptions } from './mount';
|
package/dist/server.js
CHANGED
|
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.createVerifyHandler = exports.createMountHandler = void 0;
|
|
36
37
|
exports.configFromEnv = configFromEnv;
|
|
37
38
|
exports.backendConfigFromEnv = backendConfigFromEnv;
|
|
38
39
|
exports.atlasClient = atlasClient;
|
|
@@ -249,4 +250,8 @@ async function getAtlasInitialState(options = {}, env = readEnv()) {
|
|
|
249
250
|
state.environment = environment;
|
|
250
251
|
return state;
|
|
251
252
|
}
|
|
253
|
+
// The Frontend API path mount and its domain-verification file, for route handlers.
|
|
254
|
+
var mount_1 = require("./mount");
|
|
255
|
+
Object.defineProperty(exports, "createMountHandler", { enumerable: true, get: function () { return mount_1.createMountHandler; } });
|
|
256
|
+
Object.defineProperty(exports, "createVerifyHandler", { enumerable: true, get: function () { return mount_1.createVerifyHandler; } });
|
|
252
257
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,sCA6BC;AAOD,oDAOC;AAOD,kCAUC;AAsBD,4CAsBC;AA2DD,oBAGC;AAMD,kCAGC;AAsBD,oDA0CC;AAlSD;;;;;;;;;;;;;;GAcG;AACH,gDAI4B;AAC5B,6CAMsB;AAItB,mFAAmF;AACnF,SAAS,OAAO;IACd,OAAQ,UAA0C,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;AACxE,CAAC;AAED,6CAA6C;AAC7C,SAAS,IAAI,CAAC,GAAQ,EAAE,GAAG,KAAwB;IACjD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE;YAAE,OAAO,KAAK,CAAC;IACxD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,MAAW,OAAO,EAAE;IAChD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,gBAAgB,EAAE,4BAA4B,CAAC,CAAC;IAC1E,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,0BAA0B,CAAC,CAAC;IACrE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,mFAAmF,CACpF,CAAC;IACJ,CAAC;IACD,IA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|
19
19
|
"./package.json": "./package.json"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@atlasauth/backend": "0.
|
|
22
|
+
"@atlasauth/backend": "0.35.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"next": ">=13.4"
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"typescript": "^5.6.3",
|
|
34
34
|
"vitest": "^2.1.4",
|
|
35
|
+
"esbuild": "^0.21.5",
|
|
35
36
|
"jose": "^5.9.6",
|
|
36
37
|
"next": "^15.0.0"
|
|
37
38
|
},
|