@coralreefventures/site-tools 0.3.0 → 0.4.1
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/README.md +59 -7
- package/dist/bin/reef-door-bundle.js +19 -1
- package/dist/bin/reef-door-bundle.js.map +1 -1
- package/dist/bin/reef-lighthouse.js +8 -4
- package/dist/bin/reef-lighthouse.js.map +1 -1
- package/dist/door/config.d.ts +5 -1
- package/dist/door/config.d.ts.map +1 -1
- package/dist/door/config.js +3 -0
- package/dist/door/config.js.map +1 -1
- package/dist/door/package.d.ts +16 -0
- package/dist/door/package.d.ts.map +1 -1
- package/dist/door/package.js +47 -2
- package/dist/door/package.js.map +1 -1
- package/dist/door/page.d.ts +70 -0
- package/dist/door/page.d.ts.map +1 -0
- package/dist/door/page.js +171 -0
- package/dist/door/page.js.map +1 -0
- package/dist/door/server.d.ts +24 -3
- package/dist/door/server.d.ts.map +1 -1
- package/dist/door/server.js +85 -13
- package/dist/door/server.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/lighthouse.d.ts +16 -1
- package/dist/lighthouse.d.ts.map +1 -1
- package/dist/lighthouse.js +39 -8
- package/dist/lighthouse.js.map +1 -1
- package/package.json +1 -1
- package/src/bin/reef-door-bundle.ts +19 -1
- package/src/bin/reef-lighthouse.ts +8 -4
- package/src/door/config.ts +6 -1
- package/src/door/package.ts +57 -2
- package/src/door/page.ts +218 -0
- package/src/door/server.ts +92 -12
- package/src/index.ts +10 -0
- package/src/lighthouse.ts +69 -11
package/README.md
CHANGED
|
@@ -6,8 +6,9 @@ products' scripts go. The third locks a site behind the door.
|
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
8
|
reef-serve [--root out] [--port 3140]
|
|
9
|
-
reef-lighthouse [--root out] [--reports lighthouse] [--port 3160] [--threshold 90] [--chrome <path>] [path ...]
|
|
9
|
+
reef-lighthouse [--root out] [--reports lighthouse] [--port 3160] [--threshold 90] [--retries 2] [--chrome <path>] [path ...]
|
|
10
10
|
reef-door-bundle --site <id> [--out out] --door-url <url> --hosts <h1,h2> --jwks-url <url> [--signout-chain id=host,...]
|
|
11
|
+
[--name <display name>] [--mark <file>] [--mark-dark <file>] [--accent #rrggbb] [--accent-dark #rrggbb]
|
|
11
12
|
```
|
|
12
13
|
|
|
13
14
|
`reef-serve` serves the export the way Amplify does, for Playwright and Lighthouse: a directory answers with its
|
|
@@ -21,7 +22,10 @@ webServer: { command: `pnpm exec reef-serve --port ${port}`, port },
|
|
|
21
22
|
|
|
22
23
|
`reef-lighthouse` is the merge gate: Lighthouse on every page in the export's sitemap (or the paths given), with its
|
|
23
24
|
default mobile emulation, each of performance, accessibility, best practices and SEO at the threshold or above. A
|
|
24
|
-
page under it
|
|
25
|
+
page under it is measured again, up to `--retries` more times (2 by default), and the median of its runs decides:
|
|
26
|
+
a performance score swings a few points between runs of the same page on a shared runner, and one low run should
|
|
27
|
+
not fail a gate three runs would pass, while a page every run finds low still fails. A page under it then fails the
|
|
28
|
+
run and leaves its last report in `--reports`. Lighthouse itself is not a dependency, because it
|
|
25
29
|
bundles axe-core (MPL-2.0), which is outside the family's licence allowlist; it runs through `pnpm dlx`, pinned
|
|
26
30
|
(`--lighthouse-version`). Chrome is Playwright's Chromium when `@playwright/test` is installed beside this package,
|
|
27
31
|
or `--chrome`.
|
|
@@ -54,14 +58,25 @@ listening on port 3000. For every request, in order:
|
|
|
54
58
|
4. `POST /_door` takes the door's ticket from a form body: an ES256 JWS whose `kid` is in the JWKS, issued by the door
|
|
55
59
|
for this exact host, unexpired and living at most an hour, bound to the `__Host-crv_door_state` cookie, and naming
|
|
56
60
|
the same canonical `next` as the form. It becomes the `__Host-crv_door` cookie (`HttpOnly; Secure; SameSite=Lax`,
|
|
57
|
-
for the ticket's remaining life) and a 303 to `next
|
|
58
|
-
|
|
61
|
+
for the ticket's remaining life) and a 303 to `next`, and sets `__Host-crv_door_seen=1` (`HttpOnly; Secure;
|
|
62
|
+
SameSite=Lax`, 30 days), a marker with no identity in it that this browser has had a session here. Anything wrong is a 303 back to the door with `?error=ticket`.
|
|
63
|
+
`GET /_door/signin?next=<path>` starts a sign-in: it runs `next` through Canonical next (a missing, repeated or
|
|
64
|
+
refused one becomes `/`), sets a fresh 32-byte `__Host-crv_door_state` cookie (`SameSite=None`, ten minutes) and
|
|
65
|
+
answers a 302 to the door with `site`, `host`, `next` and `state`. The coming-soon page's button links here. Only a
|
|
66
|
+
top-level navigation starts one (a navigation, or a request without `Sec-Fetch-*` headers that accepts HTML, and
|
|
67
|
+
`Sec-Fetch-Dest: document` when sent); an image, a frame or a fetch gets an empty 401 and no cookie, so another
|
|
68
|
+
site cannot overwrite a visitor's state mid-sign-in.
|
|
69
|
+
5. `/_door/signout?then=<id>` clears all three cookies and goes on by a fixed map: to the gate of the site `<id>` in
|
|
59
70
|
`--signout-chain`, naming the site after it, or, for anything else (`door`, the last stop), to the door's
|
|
60
71
|
`/signout/`. It never redirects to a URL from the query.
|
|
61
72
|
6. With a valid session the export is served as Amplify maps it, HTML and `.txt` as `private, no-store` and
|
|
62
73
|
`/_next/static/**` as `private, max-age=31536000, immutable`.
|
|
63
|
-
7. Without one, a page load
|
|
64
|
-
anything else gets an empty 401.
|
|
74
|
+
7. Without one, a page load (a navigation, or a request without `Sec-Fetch-*` headers that accepts HTML) gets the
|
|
75
|
+
coming-soon page, below, as a 401; anything else gets an empty 401. Neither sets a cookie. The exception is a
|
|
76
|
+
top-level page load carrying the seen marker: an invitee whose hour is up is sent straight to the door (a fresh
|
|
77
|
+
state cookie and the 302 `/_door/signin` gives), which issues a new ticket at once while its own sign-in lives, so
|
|
78
|
+
renewal stays silent. The marker opens nothing; a fetch carrying it still gets the empty 401. Both 401s carry
|
|
79
|
+
`WWW-Authenticate: Cookie realm="<id>", form-action="/_door/signin", cookie-name="__Host-crv_door"`.
|
|
65
80
|
8. An exception is an empty 500. The gate fails closed.
|
|
66
81
|
|
|
67
82
|
Every response carries `X-Robots-Tag: noindex, nofollow`, HSTS, `nosniff`, `X-Frame-Options: DENY` and a
|
|
@@ -69,6 +84,43 @@ Every response carries `X-Robots-Tag: noindex, nofollow`, HSTS, `nosniff`, `X-Fr
|
|
|
69
84
|
it as path and query, and refusing it if it leaves the origin or holds a backslash or control character
|
|
70
85
|
(`canonicalNext`, exported, so the door's ticket issuer can run the same steps).
|
|
71
86
|
|
|
87
|
+
### The coming-soon page
|
|
88
|
+
|
|
89
|
+
What a visitor without a session sees on the product's own domain: the product's mark and name, "<Name> is coming
|
|
90
|
+
soon.", "Open for now to invited guests.", a "Have an invitation? Sign in" button to `/_door/signin` carrying the
|
|
91
|
+
request's canonical next (so sign-in happens at the door and the ticket brings the invitee back to the page they asked
|
|
92
|
+
for), and a "Get involved" link to `<door>/get-involved/?site=<id>`.
|
|
93
|
+
|
|
94
|
+
It is the gate's own HTML and carries nothing of the site: one inline stylesheet, the mark as a `data:` URI, no
|
|
95
|
+
script, no request to anywhere. It is built once when the gate starts and is the same bytes for every path except the
|
|
96
|
+
`next` its button carries. Its headers are the gate's security headers, `X-Robots-Tag: noindex, nofollow`,
|
|
97
|
+
`Cache-Control: no-store`, and a Content-Security-Policy that allows exactly that: `default-src 'none'; style-src
|
|
98
|
+
'sha256-<its stylesheet>'; img-src data:` (the last only with a mark), and `base-uri`, `form-action` and
|
|
99
|
+
`frame-ancestors` all `'none'`. HEAD gets the same headers and no body. It follows `prefers-color-scheme`, reads at
|
|
100
|
+
320px, and every color pair meets WCAG AA.
|
|
101
|
+
|
|
102
|
+
**Why 401.** No request without a session gets a 2xx, so the leak check and any probe can tell a locked site from an
|
|
103
|
+
open one by status alone. A 200 would read as the site itself to a crawler or an uptime monitor, and a 503 reads as an
|
|
104
|
+
outage. RFC 9110 requires a 401 to carry a `WWW-Authenticate` challenge, and no registered scheme describes a session
|
|
105
|
+
cookie from a sign-in page, so the gate uses the shape drafted for exactly that (draft-broyer-http-cookie-auth).
|
|
106
|
+
Browsers prompt only for schemes they implement, so for this one they render the body, which the browser suite proves
|
|
107
|
+
in Chromium, Firefox and WebKit.
|
|
108
|
+
|
|
109
|
+
Its content comes from the bin's flags, stored in `gate.config.json` as `page` and checked when the bundle is made:
|
|
110
|
+
|
|
111
|
+
| Flag | Default | Checked |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| `--name` | the site id, capitalized | 1 to 60 characters, no control character, no space at either end |
|
|
114
|
+
| `--mark` | none: the name stands alone | an `.svg` or `.png` path inside the export (a link out of it is refused), at most 64 KB, inlined as base64 |
|
|
115
|
+
| `--mark-dark` | none: the dark scheme shows `--mark` on a light tile | as `--mark`; only with `--mark` |
|
|
116
|
+
| `--accent` | `#1f2933` | `#rrggbb`, at least 3:1 on the light page (`#ffffff`) |
|
|
117
|
+
| `--accent-dark` | `#d5dbe1` | `#rrggbb`, at least 3:1 on the dark page (`#11161b`) |
|
|
118
|
+
|
|
119
|
+
The button's label is white or black, whichever reads better on the accent; one of the two always reaches 4.5:1. The
|
|
120
|
+
mark is a file of the site that every visitor then sees, so name only a file meant to be public: the logo, never
|
|
121
|
+
anything from behind the door. If the Amplify app's custom headers also set a Content-Security-Policy, Amplify's wins
|
|
122
|
+
or both apply; the products' policy allows inline styles and `data:` images, so the page renders either way.
|
|
123
|
+
|
|
72
124
|
The gate holds only public keys, takes all of its configuration as data and names no product. The ticket issuer, the
|
|
73
125
|
door and the site registry are the door's own.
|
|
74
126
|
|
|
@@ -76,7 +128,7 @@ door and the site registry are the door's own.
|
|
|
76
128
|
|
|
77
129
|
The library entry exports `serve`, `createStaticServer`, `runLighthouse` and `pagesFromSitemap` for a script that
|
|
78
130
|
wants them in-process, and the gate's parts: `createGate`, `startGate`, `verifyTicket`, `parseJwks`,
|
|
79
|
-
`canonicalNext`, `parseGateConfig` and `
|
|
131
|
+
`canonicalNext`, `parseGateConfig`, `bundleDoor`, and the coming-soon page's `comingSoon` and `parsePageConfig`.
|
|
80
132
|
|
|
81
133
|
This is the one package in the repository with a build: a bin has to be JavaScript, because Node refuses to strip
|
|
82
134
|
types from a file under `node_modules`. `tsc` writes `dist/` on `prepack`, and the door bundle copies the gate's
|
|
@@ -4,10 +4,16 @@ import { parseSignoutChain } from "../door/config.js";
|
|
|
4
4
|
import { bundleDoor } from "../door/package.js";
|
|
5
5
|
const usage = `reef-door-bundle --site <id> [--out out] [--dest .amplify-hosting] --door-url <url> --hosts <h1,h2>
|
|
6
6
|
--jwks-url <url> [--signout-chain id=host,id=host] [--host-header host|x-forwarded-host]
|
|
7
|
+
[--name <display name>] [--mark <file in out>] [--mark-dark <file in out>]
|
|
8
|
+
[--accent #rrggbb] [--accent-dark #rrggbb]
|
|
7
9
|
|
|
8
10
|
Locks a static export behind the door: writes .amplify-hosting with the export inside the gate's compute bundle and
|
|
9
11
|
one route, /* to Compute. --door-url, --hosts, --jwks-url, --signout-chain and --host-header fall back to
|
|
10
|
-
CRV_DOOR_URL, CRV_DOOR_HOSTS, CRV_DOOR_JWKS_URL, CRV_DOOR_SIGNOUT_CHAIN and CRV_DOOR_HOST_HEADER
|
|
12
|
+
CRV_DOOR_URL, CRV_DOOR_HOSTS, CRV_DOOR_JWKS_URL, CRV_DOOR_SIGNOUT_CHAIN and CRV_DOOR_HOST_HEADER.
|
|
13
|
+
|
|
14
|
+
A page load without a session gets a coming-soon page: --name (the site id, capitalized, by default), --mark and
|
|
15
|
+
--mark-dark (an .svg or .png inside the export, inlined; none by default), --accent and --accent-dark (the button's
|
|
16
|
+
color in each scheme, at least 3:1 on the page; neutral by default).`;
|
|
11
17
|
const { values } = parseArgs({
|
|
12
18
|
options: {
|
|
13
19
|
site: { type: "string" },
|
|
@@ -18,6 +24,11 @@ const { values } = parseArgs({
|
|
|
18
24
|
"jwks-url": { type: "string" },
|
|
19
25
|
"signout-chain": { type: "string" },
|
|
20
26
|
"host-header": { type: "string" },
|
|
27
|
+
name: { type: "string" },
|
|
28
|
+
mark: { type: "string" },
|
|
29
|
+
"mark-dark": { type: "string" },
|
|
30
|
+
accent: { type: "string" },
|
|
31
|
+
"accent-dark": { type: "string" },
|
|
21
32
|
help: { type: "boolean", short: "h" },
|
|
22
33
|
},
|
|
23
34
|
});
|
|
@@ -46,6 +57,13 @@ try {
|
|
|
46
57
|
jwksUrl,
|
|
47
58
|
signout: parseSignoutChain(values["signout-chain"] ?? env.CRV_DOOR_SIGNOUT_CHAIN),
|
|
48
59
|
hostHeader,
|
|
60
|
+
page: {
|
|
61
|
+
name: values.name,
|
|
62
|
+
mark: values.mark,
|
|
63
|
+
markDark: values["mark-dark"],
|
|
64
|
+
accent: values.accent,
|
|
65
|
+
accentDark: values["accent-dark"],
|
|
66
|
+
},
|
|
49
67
|
});
|
|
50
68
|
console.log(`reef-door-bundle: ${values.dest} written for ${values.site}, gate ${manifest.framework.version}`);
|
|
51
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reef-door-bundle.js","sourceRoot":"","sources":["../../src/bin/reef-door-bundle.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,KAAK,GAAG
|
|
1
|
+
{"version":3,"file":"reef-door-bundle.js","sourceRoot":"","sources":["../../src/bin/reef-door-bundle.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,KAAK,GAAG;;;;;;;;;;;qEAWuD,CAAC;AAEtE,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE;QACP,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE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C,EAAE,CAAC,CAAC;IAC7F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
import { parseArgs } from "node:util";
|
|
3
3
|
import { runLighthouse } from "../lighthouse.js";
|
|
4
4
|
/**
|
|
5
|
-
* reef-lighthouse [--root out] [--reports lighthouse] [--port N] [--threshold 90] [--chrome <path>] [path ...]
|
|
5
|
+
* reef-lighthouse [--root out] [--reports lighthouse] [--port N] [--threshold 90] [--retries 2] [--chrome <path>] [path ...]
|
|
6
6
|
*
|
|
7
7
|
* Lighthouse on every page in the export's sitemap, or the paths given, each category at the threshold or above. The
|
|
8
|
-
* export is served on a free port unless --port pins one (Streamlane's run met EADDRINUSE on a fixed 3160).
|
|
9
|
-
*
|
|
8
|
+
* export is served on a free port unless --port pins one (Streamlane's run met EADDRINUSE on a fixed 3160). A page
|
|
9
|
+
* under the threshold is measured again, up to --retries more times, and the median of its runs decides, since a
|
|
10
|
+
* performance score swings a few points between runs on a shared runner. Exits 1 with the failing pages named when
|
|
11
|
+
* one is under, and leaves their reports in --reports.
|
|
10
12
|
*/
|
|
11
13
|
const { values, positionals } = parseArgs({
|
|
12
14
|
allowPositionals: true,
|
|
@@ -15,13 +17,14 @@ const { values, positionals } = parseArgs({
|
|
|
15
17
|
reports: { type: "string", default: "lighthouse" },
|
|
16
18
|
port: { type: "string" },
|
|
17
19
|
threshold: { type: "string", default: "90" },
|
|
20
|
+
retries: { type: "string", default: "2" },
|
|
18
21
|
chrome: { type: "string" },
|
|
19
22
|
"lighthouse-version": { type: "string", default: "13.5.0" },
|
|
20
23
|
help: { type: "boolean", short: "h" },
|
|
21
24
|
},
|
|
22
25
|
});
|
|
23
26
|
if (values.help) {
|
|
24
|
-
console.log("reef-lighthouse [--root out] [--reports lighthouse] [--port N] [--threshold 90] [--chrome <path>] [path ...]");
|
|
27
|
+
console.log("reef-lighthouse [--root out] [--reports lighthouse] [--port N] [--threshold 90] [--retries 2] [--chrome <path>] [path ...]");
|
|
25
28
|
process.exit(0);
|
|
26
29
|
}
|
|
27
30
|
const threshold = Number(values.threshold) / 100;
|
|
@@ -30,6 +33,7 @@ const results = await runLighthouse({
|
|
|
30
33
|
reportDir: values.reports,
|
|
31
34
|
...(values.port !== undefined && { port: Number(values.port) }),
|
|
32
35
|
threshold,
|
|
36
|
+
retries: Number(values.retries),
|
|
33
37
|
paths: positionals,
|
|
34
38
|
lighthouseVersion: values["lighthouse-version"],
|
|
35
39
|
...(values.chrome !== undefined && { chrome: values.chrome }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reef-lighthouse.js","sourceRoot":"","sources":["../../src/bin/reef-lighthouse.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD
|
|
1
|
+
{"version":3,"file":"reef-lighthouse.js","sourceRoot":"","sources":["../../src/bin/reef-lighthouse.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;;;;GAQG;AACH,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;IACxC,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE;QACP,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE;QACxC,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE;QAClD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE;QAC5C,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;QAC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AAC,GAAG,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,MAAM,CAAC,OAAO,GAAG,CAC/I,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
package/dist/door/config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PageConfig, type PageConfigFile } from "./page.ts";
|
|
1
2
|
import { type Jwks } from "./verify.ts";
|
|
2
3
|
/** One stop on the sign-out walk: a site behind the door, by id, and the host its gate answers on. */
|
|
3
4
|
export type SignoutStop = {
|
|
@@ -21,10 +22,13 @@ export type GateConfigFile = {
|
|
|
21
22
|
jwks: {
|
|
22
23
|
keys: unknown[];
|
|
23
24
|
};
|
|
25
|
+
/** The coming-soon page a visitor without a session sees: the product's name, mark and colors. Optional (0.4.0). */
|
|
26
|
+
page?: PageConfigFile;
|
|
24
27
|
};
|
|
25
|
-
export type GateConfig = Omit<GateConfigFile, "jwks"> & {
|
|
28
|
+
export type GateConfig = Omit<GateConfigFile, "jwks" | "page"> & {
|
|
26
29
|
keys: Jwks;
|
|
27
30
|
issuer: string;
|
|
31
|
+
page: PageConfig;
|
|
28
32
|
};
|
|
29
33
|
export declare const isSiteId: (value: unknown) => value is string;
|
|
30
34
|
export declare const isHost: (value: unknown) => value is string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/door/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,EAAa,MAAM,aAAa,CAAC;AAEnD,sGAAsG;AACtG,MAAM,MAAM,WAAW,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,uGAAuG;AACvG,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE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I,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC;AAKlH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAyD,CAAC;AAC7G,eAAO,MAAM,MAAM,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACyB,CAAC;AAE3E,gGAAgG;AAChG,eAAO,MAAM,UAAU,GAAI,MAAM,OAAO,KAAG,MAa1C,CAAC;AAeF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,UA2BhD,CAAC;AAEF,yCAAyC;AACzC,eAAO,MAAM,cAAc,GAAU,MAAM,MAAM,GAAG,GAAG,KAAG,OAAO,CAAC,UAAU,CACjB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,GAAG,SAAS,KAAG,WAAW,EAWnE,CAAC"}
|
package/dist/door/config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { parsePageConfig } from "./page.js";
|
|
2
3
|
import { parseJwks } from "./verify.js";
|
|
3
4
|
const siteId = /^[a-z0-9][a-z0-9-]{0,31}$/;
|
|
4
5
|
const hostName = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*(:\d{1,5})?$/;
|
|
@@ -59,6 +60,7 @@ export const parseGateConfig = (value) => {
|
|
|
59
60
|
}
|
|
60
61
|
const signout = checkSignout(file.signout ?? []);
|
|
61
62
|
const keys = parseJwks(file.jwks);
|
|
63
|
+
const page = parsePageConfig(file.page, file.site);
|
|
62
64
|
return {
|
|
63
65
|
version: 1,
|
|
64
66
|
site: file.site,
|
|
@@ -68,6 +70,7 @@ export const parseGateConfig = (value) => {
|
|
|
68
70
|
hostHeader: file.hostHeader,
|
|
69
71
|
signout,
|
|
70
72
|
keys,
|
|
73
|
+
page,
|
|
71
74
|
};
|
|
72
75
|
};
|
|
73
76
|
/** Reads and checks gate.config.json. */
|
package/dist/door/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/door/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAa,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/door/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAwC,eAAe,EAAE,MAAM,WAAW,CAAC;AAClF,OAAO,EAAa,SAAS,EAAE,MAAM,aAAa,CAAC;AA0BnD,MAAM,MAAM,GAAG,2BAA2B,CAAC;AAC3C,MAAM,QAAQ,GAAG,8EAA8E,CAAC;AAEhG,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7G,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAc,EAAmB,EAAE,CACxD,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAE3E,gGAAgG;AAChG,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAa,EAAU,EAAE;IAClD,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACzE,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK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
1
|
import { type GateConfigFile, type SignoutStop } from "./config.ts";
|
|
2
|
+
import { type PageImage } from "./page.ts";
|
|
2
3
|
/**
|
|
3
4
|
* The gate's own files, relative to the package's compiled root, which the bundle carries beside server.mjs. They
|
|
4
5
|
* import Node's modules and each other and nothing else, so the bundle needs no node_modules (a test holds the list
|
|
@@ -42,10 +43,25 @@ export type BundleDoorOptions = {
|
|
|
42
43
|
/** The sign-out walk, in order. */
|
|
43
44
|
signout?: SignoutStop[];
|
|
44
45
|
hostHeader?: GateConfigFile["hostHeader"];
|
|
46
|
+
/** The coming-soon page: the product's display name, its mark and dark mark as files in the export, its colors. */
|
|
47
|
+
page?: BundlePageOptions;
|
|
45
48
|
/** The compiled package root the gate's files are copied from; this package's own `dist` by default. */
|
|
46
49
|
gateRoot?: string;
|
|
47
50
|
maxBytes?: number;
|
|
48
51
|
};
|
|
52
|
+
/** What the bin's page flags name. The marks are paths inside the static export, which the bundle inlines. */
|
|
53
|
+
export type BundlePageOptions = {
|
|
54
|
+
name?: string | undefined;
|
|
55
|
+
mark?: string | undefined;
|
|
56
|
+
markDark?: string | undefined;
|
|
57
|
+
accent?: string | undefined;
|
|
58
|
+
accentDark?: string | undefined;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Reads a mark from the site's own export, for the coming-soon page to carry inline: an SVG or a PNG, inside the
|
|
62
|
+
* export (a symbolic link out of it is refused), and small. It is shown through `<img>`, where an SVG runs no script.
|
|
63
|
+
*/
|
|
64
|
+
export declare const readMark: (out: string, file: string) => Promise<PageImage>;
|
|
49
65
|
/** Fetches the door's JWKS and checks it is P-256 public keys; a build with no usable key fails here. */
|
|
50
66
|
export declare const fetchJwks: (jwksUrl: string) => Promise<{
|
|
51
67
|
keys: unknown[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/door/package.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,cAAc,EAAmB,KAAK,WA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AAmH;IACnH,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,wGAAwG;IACxG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,8GAA8G;AAC9G,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAU,KAAK,MAAM,EAAE,MAAM,MAAM,KAAG,OAAO,CAAC,SAAS,CAkB3E,CAAC;AAiBF,yGAAyG;AACzG,eAAO,MAAM,SAAS,GAAU,SAAS,MAAM,KAAG,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,EAAE,CAAA;CAAE,CAiC5E,CAAC;AAUF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAU,MAAM,MAAM,EAAE,iBAAyB,KAAG,OAAO,CAAC,cAAc,CAiBrG,CAAC;AAeF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAU,SAAS,iBAAiB,KAAG,OAAO,CAAC,cAAc,CA8CnF,CAAC"}
|
package/dist/door/package.js
CHANGED
|
@@ -1,16 +1,60 @@
|
|
|
1
|
-
import { cp, mkdir, readdir, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
1
|
+
import { cp, mkdir, readdir, readFile, realpath, rm, stat, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { parseGateConfig } from "./config.js";
|
|
5
|
+
import { maxMarkBytes } from "./page.js";
|
|
5
6
|
import { parseJwks } from "./verify.js";
|
|
6
7
|
/**
|
|
7
8
|
* The gate's own files, relative to the package's compiled root, which the bundle carries beside server.mjs. They
|
|
8
9
|
* import Node's modules and each other and nothing else, so the bundle needs no node_modules (a test holds the list
|
|
9
10
|
* against the imports).
|
|
10
11
|
*/
|
|
11
|
-
export const gateFiles = [
|
|
12
|
+
export const gateFiles = [
|
|
13
|
+
"serve.js",
|
|
14
|
+
"door/server.js",
|
|
15
|
+
"door/config.js",
|
|
16
|
+
"door/next.js",
|
|
17
|
+
"door/page.js",
|
|
18
|
+
"door/verify.js",
|
|
19
|
+
];
|
|
12
20
|
/** Amplify takes a deployment of up to 220 MB; the gate refuses one over 200, which leaves room. */
|
|
13
21
|
export const maxBundleBytes = 200 * 1024 * 1024;
|
|
22
|
+
const pngSignature = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
23
|
+
/**
|
|
24
|
+
* Reads a mark from the site's own export, for the coming-soon page to carry inline: an SVG or a PNG, inside the
|
|
25
|
+
* export (a symbolic link out of it is refused), and small. It is shown through `<img>`, where an SVG runs no script.
|
|
26
|
+
*/
|
|
27
|
+
export const readMark = async (out, file) => {
|
|
28
|
+
const root = await realpath(out);
|
|
29
|
+
const resolved = await realpath(path.resolve(root, file.replace(/^\/+/, ""))).catch(() => {
|
|
30
|
+
throw new Error(`the mark is not in the static export: ${file}`);
|
|
31
|
+
});
|
|
32
|
+
if (!resolved.startsWith(`${root}${path.sep}`))
|
|
33
|
+
throw new Error(`the mark is outside the static export: ${file}`);
|
|
34
|
+
const bytes = await readFile(resolved);
|
|
35
|
+
if (bytes.length > maxMarkBytes)
|
|
36
|
+
throw new Error(`the mark is ${bytes.length} bytes, over ${maxMarkBytes}: ${file}`);
|
|
37
|
+
const extension = path.extname(resolved).toLowerCase();
|
|
38
|
+
if (extension === ".png") {
|
|
39
|
+
if (!bytes.subarray(0, 8).equals(pngSignature))
|
|
40
|
+
throw new Error(`the mark is not a PNG: ${file}`);
|
|
41
|
+
return { type: "image/png", data: bytes.toString("base64") };
|
|
42
|
+
}
|
|
43
|
+
if (extension === ".svg") {
|
|
44
|
+
if (!/<svg[\s>]/.test(bytes.toString("utf8")))
|
|
45
|
+
throw new Error(`the mark is not an SVG: ${file}`);
|
|
46
|
+
return { type: "image/svg+xml", data: bytes.toString("base64") };
|
|
47
|
+
}
|
|
48
|
+
throw new Error(`the mark must be an .svg or a .png: ${file}`);
|
|
49
|
+
};
|
|
50
|
+
/** The page's configuration from the bin's flags: the marks read from the export, everything else as given. */
|
|
51
|
+
const pageFile = async (out, options = {}) => ({
|
|
52
|
+
...(options.name !== undefined && { name: options.name }),
|
|
53
|
+
...(options.mark !== undefined && { mark: await readMark(out, options.mark) }),
|
|
54
|
+
...(options.markDark !== undefined && { markDark: await readMark(out, options.markDark) }),
|
|
55
|
+
...(options.accent !== undefined && { accent: options.accent }),
|
|
56
|
+
...(options.accentDark !== undefined && { accentDark: options.accentDark }),
|
|
57
|
+
});
|
|
14
58
|
const packageRoot = fileURLToPath(new URL("../../", import.meta.url));
|
|
15
59
|
const compiledRoot = fileURLToPath(new URL("../", import.meta.url));
|
|
16
60
|
const ownVersion = async () => JSON.parse(await readFile(path.join(packageRoot, "package.json"), "utf8")).version;
|
|
@@ -121,6 +165,7 @@ export const bundleDoor = async (options) => {
|
|
|
121
165
|
hostHeader: options.hostHeader ?? "host",
|
|
122
166
|
signout: options.signout ?? [],
|
|
123
167
|
jwks,
|
|
168
|
+
page: await pageFile(out, options.page),
|
|
124
169
|
};
|
|
125
170
|
const config = parseGateConfig(configFile);
|
|
126
171
|
configFile.door = config.door;
|
package/dist/door/package.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/door/package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,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,OAAO,EAAE,kBAAkB,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACpG,MAAM,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/D,MAAM,QAAQ,GAAmB;QAC/B,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC;QACrE,gBAAgB,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;QACxF,SAAS,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE;KAC9C,CAAC;IACF,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,sBAAsB,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACnG,OAAO,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjD,CAAC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The coming-soon page: what a locked site answers a page load with when the visitor holds no session. It is the
|
|
3
|
+
* gate's own HTML and carries nothing of the site: one inline stylesheet, the mark as a data URI, no script and no
|
|
4
|
+
* request to anywhere. It is the same bytes for every path but one, the canonical next its sign-in link carries.
|
|
5
|
+
*/
|
|
6
|
+
/** An image the page shows, carried in gate.config.json as base64 so the page needs no request for it. */
|
|
7
|
+
export type PageImage = {
|
|
8
|
+
type: "image/svg+xml" | "image/png";
|
|
9
|
+
data: string;
|
|
10
|
+
};
|
|
11
|
+
/** gate.config.json's `page`: everything a site says about its coming-soon page. All optional. */
|
|
12
|
+
export type PageConfigFile = {
|
|
13
|
+
/** The product's display name, as the page writes it. The site id, capitalized, by default. */
|
|
14
|
+
name?: string;
|
|
15
|
+
/** The mark, shown beside the name. None by default, and the name stands alone. */
|
|
16
|
+
mark?: PageImage;
|
|
17
|
+
/** The mark for a dark scheme. Without it the dark scheme shows `mark` on a light tile. */
|
|
18
|
+
markDark?: PageImage;
|
|
19
|
+
/** The button's color in the light scheme, `#rrggbb`. */
|
|
20
|
+
accent?: string;
|
|
21
|
+
/** The button's color in the dark scheme, `#rrggbb`. */
|
|
22
|
+
accentDark?: string;
|
|
23
|
+
};
|
|
24
|
+
export type PageConfig = Required<Pick<PageConfigFile, "name" | "accent" | "accentDark">> & Pick<PageConfigFile, "mark" | "markDark">;
|
|
25
|
+
/** The page's own surfaces; a site's accent has to stand out from these. */
|
|
26
|
+
export declare const surfaces: {
|
|
27
|
+
light: {
|
|
28
|
+
background: string;
|
|
29
|
+
text: string;
|
|
30
|
+
muted: string;
|
|
31
|
+
};
|
|
32
|
+
dark: {
|
|
33
|
+
background: string;
|
|
34
|
+
text: string;
|
|
35
|
+
muted: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export declare const defaultAccent = "#1f2933";
|
|
39
|
+
export declare const defaultAccentDark = "#d5dbe1";
|
|
40
|
+
/** A mark larger than this is not a mark; the page is answered to every visitor without a session. */
|
|
41
|
+
export declare const maxMarkBytes: number;
|
|
42
|
+
/** WCAG 2's relative luminance of `#rrggbb`. */
|
|
43
|
+
export declare const luminance: (hex: string) => number;
|
|
44
|
+
/** WCAG 2's contrast ratio between two `#rrggbb` colors, 1 to 21. */
|
|
45
|
+
export declare const contrast: (a: string, b: string) => number;
|
|
46
|
+
/**
|
|
47
|
+
* The button's text on an accent: white or black, whichever reads better. One of the two always reaches 4.5:1 (the
|
|
48
|
+
* worst accent, where they tie, gives 4.58), so the label meets AA whatever color a site picks. Not a softer near-black:
|
|
49
|
+
* #111111 ties at 4.35, under the line.
|
|
50
|
+
*/
|
|
51
|
+
export declare const textOn: (accent: string) => string;
|
|
52
|
+
/** The site id as a display name: `driftline` becomes `Driftline`. */
|
|
53
|
+
export declare const defaultName: (site: string) => string;
|
|
54
|
+
/**
|
|
55
|
+
* Checks gate.config.json's `page` and fills in the defaults, or throws naming what is wrong. With no `page` at all
|
|
56
|
+
* the result still renders a correct page: the site id as the name, no mark, and a neutral button.
|
|
57
|
+
*/
|
|
58
|
+
export declare const parsePageConfig: (value: unknown, site: string) => PageConfig;
|
|
59
|
+
export type ComingSoon = {
|
|
60
|
+
/** The page for one canonical next: the only part that differs between paths. */
|
|
61
|
+
html: (next: string) => string;
|
|
62
|
+
/** The Content-Security-Policy that allows exactly what the page uses. */
|
|
63
|
+
csp: string;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Builds the coming-soon page for a site once, as the gate starts. `door` is the door's origin, which the "Get
|
|
67
|
+
* involved" link points into; `site` is the id the door knows the site by.
|
|
68
|
+
*/
|
|
69
|
+
export declare const comingSoon: (page: PageConfig, door: string, site: string) => ComingSoon;
|
|
70
|
+
//# sourceMappingURL=page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/door/page.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,0GAA0G;AAC1G,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,eAAe,GAAG,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E,kGAAkG;AAClG,MAAM,MAAM,cAAc,GAAG;IAC3B,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,yDAAyD;IACzD,M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