@lamalibre/create-lamaste 4.5.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/package.json +2 -2
  2. package/scripts/bundle-vendor.js +20 -3
  3. package/scripts/lamaste-priv +56 -5
  4. package/scripts/pin-release.js +98 -0
  5. package/src/index.js +8 -1
  6. package/src/lib/env.js +19 -0
  7. package/src/lib/service-config.js +7 -0
  8. package/src/tasks/redeploy.js +8 -0
  9. package/vendor/docs/00-introduction/how-it-works.md +2 -2
  10. package/vendor/docs/00-introduction/quickstart.md +5 -5
  11. package/vendor/docs/00-introduction/what-is-lamaste.md +5 -5
  12. package/vendor/docs/01-concepts/authentication.md +6 -2
  13. package/vendor/docs/01-concepts/authorization.md +4 -0
  14. package/vendor/docs/01-concepts/certificates.md +3 -3
  15. package/vendor/docs/01-concepts/dns-and-domains.md +9 -0
  16. package/vendor/docs/01-concepts/mtls.md +2 -2
  17. package/vendor/docs/01-concepts/security-model.md +28 -3
  18. package/vendor/docs/01-concepts/tickets.md +2 -2
  19. package/vendor/docs/01-concepts/tunneling.md +4 -4
  20. package/vendor/docs/02-guides/agent-setup.md +5 -5
  21. package/vendor/docs/02-guides/certificate-management.md +2 -2
  22. package/vendor/docs/02-guides/cloud-provisioning.md +3 -3
  23. package/vendor/docs/02-guides/desktop-app-setup.md +10 -10
  24. package/vendor/docs/02-guides/installation.md +3 -3
  25. package/vendor/docs/02-guides/managing-users.md +5 -11
  26. package/vendor/docs/02-guides/onboarding.md +2 -2
  27. package/vendor/docs/02-guides/second-domain.md +82 -0
  28. package/vendor/docs/02-guides/standalone-plugin-with-tickets.md +2 -2
  29. package/vendor/docs/02-guides/static-sites.md +4 -0
  30. package/vendor/docs/03-architecture/installer-flow.md +2 -2
  31. package/vendor/docs/03-architecture/installer.md +4 -4
  32. package/vendor/docs/03-architecture/management-flow.md +1 -1
  33. package/vendor/docs/03-architecture/nginx-configuration.md +80 -12
  34. package/vendor/docs/03-architecture/overview.md +5 -5
  35. package/vendor/docs/03-architecture/panel-client.md +6 -6
  36. package/vendor/docs/03-architecture/panel-server.md +2 -2
  37. package/vendor/docs/03-architecture/state-management.md +3 -3
  38. package/vendor/docs/03-architecture/system-overview.md +1 -1
  39. package/vendor/docs/04-api-reference/agent-hosted-plugins.md +116 -37
  40. package/vendor/docs/04-api-reference/app-host.md +3 -3
  41. package/vendor/docs/04-api-reference/domains.md +192 -0
  42. package/vendor/docs/04-api-reference/gatekeeper.md +54 -8
  43. package/vendor/docs/04-api-reference/lifecycle-hooks.md +4 -4
  44. package/vendor/docs/04-api-reference/onboarding.md +1 -1
  45. package/vendor/docs/04-api-reference/overview.md +9 -0
  46. package/vendor/docs/04-api-reference/registry-and-oidc.md +26 -13
  47. package/vendor/docs/04-api-reference/sites.md +9 -0
  48. package/vendor/docs/04-api-reference/tunnels.md +35 -28
  49. package/vendor/docs/04-api-reference/users.md +41 -29
  50. package/vendor/docs/05-operations/backup-and-restore.md +1 -1
  51. package/vendor/docs/05-operations/uninstalling.md +1 -1
  52. package/vendor/docs/05-operations/upgrades.md +15 -6
  53. package/vendor/docs/06-reference/config-files.md +19 -15
  54. package/vendor/docs/06-reference/glossary.md +3 -3
  55. package/vendor/docs/06-reference/installer-flags.md +13 -13
  56. package/vendor/docs/06-reference/ports-and-services.md +1 -1
  57. package/vendor/docs/06-reference/troubleshooting.md +8 -8
  58. package/vendor/docs/_index.json +105 -19
  59. package/vendor/docs/external-members-design.md +816 -0
  60. package/vendor/docs/gatekeeper-design.md +8 -8
  61. package/vendor/docs/identity-directory-design.md +3 -3
  62. package/vendor/docs/multi-domain-relay-design.md +836 -0
  63. package/vendor/docs/package.json +1 -1
  64. package/vendor/docs/todo/lib-cli-desktop-refactor.md +27 -27
  65. package/vendor/gatekeeper/dist/index.d.ts +3 -3
  66. package/vendor/gatekeeper/dist/index.d.ts.map +1 -1
  67. package/vendor/gatekeeper/dist/index.js +2 -2
  68. package/vendor/gatekeeper/dist/index.js.map +1 -1
  69. package/vendor/gatekeeper/dist/lib/authz.d.ts +9 -0
  70. package/vendor/gatekeeper/dist/lib/authz.d.ts.map +1 -1
  71. package/vendor/gatekeeper/dist/lib/authz.js +31 -0
  72. package/vendor/gatekeeper/dist/lib/authz.js.map +1 -1
  73. package/vendor/gatekeeper/dist/lib/constants.d.ts +5 -2
  74. package/vendor/gatekeeper/dist/lib/constants.d.ts.map +1 -1
  75. package/vendor/gatekeeper/dist/lib/constants.js +5 -2
  76. package/vendor/gatekeeper/dist/lib/constants.js.map +1 -1
  77. package/vendor/gatekeeper/dist/lib/grants.d.ts.map +1 -1
  78. package/vendor/gatekeeper/dist/lib/grants.js +20 -13
  79. package/vendor/gatekeeper/dist/lib/grants.js.map +1 -1
  80. package/vendor/gatekeeper/dist/lib/migrations/gatekeeper/0004_unconsume_access_grants.sql +8 -0
  81. package/vendor/gatekeeper/dist/lib/secret.d.ts +6 -0
  82. package/vendor/gatekeeper/dist/lib/secret.d.ts.map +1 -0
  83. package/vendor/gatekeeper/dist/lib/secret.js +12 -0
  84. package/vendor/gatekeeper/dist/lib/secret.js.map +1 -0
  85. package/vendor/gatekeeper/dist/lib/templates.d.ts +20 -0
  86. package/vendor/gatekeeper/dist/lib/templates.d.ts.map +1 -1
  87. package/vendor/gatekeeper/dist/lib/templates.js +80 -14
  88. package/vendor/gatekeeper/dist/lib/templates.js.map +1 -1
  89. package/vendor/gatekeeper/dist/lib/tunnels.d.ts +3 -6
  90. package/vendor/gatekeeper/dist/lib/tunnels.d.ts.map +1 -1
  91. package/vendor/gatekeeper/dist/lib/tunnels.js +4 -16
  92. package/vendor/gatekeeper/dist/lib/tunnels.js.map +1 -1
  93. package/vendor/gatekeeper/dist/lib/types.d.ts +0 -19
  94. package/vendor/gatekeeper/dist/lib/types.d.ts.map +1 -1
  95. package/vendor/gatekeeper/dist/server/index.d.ts +6 -1
  96. package/vendor/gatekeeper/dist/server/index.d.ts.map +1 -1
  97. package/vendor/gatekeeper/dist/server/index.js +56 -11
  98. package/vendor/gatekeeper/dist/server/index.js.map +1 -1
  99. package/vendor/gatekeeper/dist/server/routes/authz.d.ts.map +1 -1
  100. package/vendor/gatekeeper/dist/server/routes/authz.js +325 -55
  101. package/vendor/gatekeeper/dist/server/routes/authz.js.map +1 -1
  102. package/vendor/gatekeeper/dist/server/routes/diagnostic.d.ts.map +1 -1
  103. package/vendor/gatekeeper/dist/server/routes/diagnostic.js +5 -2
  104. package/vendor/gatekeeper/dist/server/routes/diagnostic.js.map +1 -1
  105. package/vendor/gatekeeper/package.json +2 -2
  106. package/vendor/server/bin/lamaste-server.js +7 -0
  107. package/vendor/server/package.json +2 -2
  108. package/vendor/server/src/commands/domains.js +214 -0
  109. package/vendor/server/src/commands/plugin-identity.js +2 -16
  110. package/vendor/server/src/commands/plugin-web-surface.js +269 -0
  111. package/vendor/server/src/commands/plugins.js +175 -14
  112. package/vendor/server/src/commands/registry-credential.js +10 -3
  113. package/vendor/server/src/commands/sites.js +18 -1
  114. package/vendor/server/src/commands/status.js +19 -0
  115. package/vendor/server/src/commands/tunnels.js +4 -1
  116. package/vendor/server/src/commands/users.js +8 -19
  117. package/vendor/server/src/domains.js +92 -0
  118. package/vendor/server/src/fail.js +21 -0
  119. package/vendor/server/src/oidc-client-grants.js +63 -0
  120. package/vendor/server/src/panel-api.js +15 -0
  121. package/vendor/server/src/plugin-approval.js +80 -1
  122. package/vendor/server/src/plugin-web-surface.js +307 -0
  123. package/vendor/server-ui/dist/assets/index-B8Tv_ocF.js +84 -0
  124. package/vendor/server-ui/dist/assets/index-Cb-ADsbB.css +1 -0
  125. package/vendor/server-ui/dist/index.html +2 -2
  126. package/vendor/serverd/package.json +2 -2
  127. package/vendor/serverd/src/index.js +50 -19
  128. package/vendor/serverd/src/lib/app-error.js +24 -0
  129. package/vendor/serverd/src/lib/audience.js +12 -3
  130. package/vendor/serverd/src/lib/authelia.js +341 -35
  131. package/vendor/serverd/src/lib/chisel-runtime.js +18 -6
  132. package/vendor/serverd/src/lib/chisel.js +10 -2
  133. package/vendor/serverd/src/lib/directory.js +67 -52
  134. package/vendor/serverd/src/lib/domains.js +1792 -0
  135. package/vendor/serverd/src/lib/gatekeeper-client.js +34 -7
  136. package/vendor/serverd/src/lib/hook-pipelines.js +8 -3
  137. package/vendor/serverd/src/lib/identity-sync.js +35 -0
  138. package/vendor/serverd/src/lib/migrations/state/0015_plugin_web_surface.sql +14 -0
  139. package/vendor/serverd/src/lib/migrations/state/0016_domains.sql +53 -0
  140. package/vendor/serverd/src/lib/migrations/state/0017_membership_kind.sql +15 -0
  141. package/vendor/serverd/src/lib/migrations/state/0018_domain_group_keys.sql +23 -0
  142. package/vendor/serverd/src/lib/nginx.js +576 -131
  143. package/vendor/serverd/src/lib/owned-groups.js +326 -0
  144. package/vendor/serverd/src/lib/plugin-domain.js +86 -0
  145. package/vendor/serverd/src/lib/plugin-hooks.js +40 -11
  146. package/vendor/serverd/src/lib/plugin-lifecycle.js +129 -5
  147. package/vendor/serverd/src/lib/plugin-oidc.js +144 -42
  148. package/vendor/serverd/src/lib/plugin-packages.js +74 -2
  149. package/vendor/serverd/src/lib/plugins.js +82 -9
  150. package/vendor/serverd/src/lib/registry-credential.js +39 -6
  151. package/vendor/serverd/src/lib/services.js +9 -1
  152. package/vendor/serverd/src/lib/state.js +29 -0
  153. package/vendor/serverd/src/lib/tunnel-deps.js +2 -4
  154. package/vendor/serverd/src/lib/user-surface.js +77 -31
  155. package/vendor/serverd/src/lib/users-lock.js +23 -0
  156. package/vendor/serverd/src/lib/vhost-reconcile.js +151 -41
  157. package/vendor/serverd/src/lib/web-surface.js +783 -0
  158. package/vendor/serverd/src/middleware/user-access-session.js +11 -4
  159. package/vendor/serverd/src/routes/invite.js +15 -5
  160. package/vendor/serverd/src/routes/management/domains.js +154 -0
  161. package/vendor/serverd/src/routes/management/gatekeeper-proxy.js +44 -8
  162. package/vendor/serverd/src/routes/management/identity.js +21 -7
  163. package/vendor/serverd/src/routes/management/invitations.js +33 -4
  164. package/vendor/serverd/src/routes/management/plugin-web-surface.js +151 -0
  165. package/vendor/serverd/src/routes/management/plugins.js +6 -2
  166. package/vendor/serverd/src/routes/management/registry-credential.js +86 -57
  167. package/vendor/serverd/src/routes/management/sites.js +188 -71
  168. package/vendor/serverd/src/routes/management/tunnels.js +37 -22
  169. package/vendor/serverd/src/routes/management/users.js +184 -64
  170. package/vendor/serverd/src/routes/management.js +4 -0
  171. package/vendor/serverd/src/routes/onboarding/dns.js +3 -17
  172. package/vendor/serverd/src/routes/onboarding/provision.js +22 -13
  173. package/vendor/serverd/src/routes/user-access.js +13 -1
  174. package/vendor/gatekeeper/dist/lib/migrations/migrations/gatekeeper/0001_groups.sql +0 -7
  175. package/vendor/gatekeeper/dist/lib/migrations/migrations/gatekeeper/0002_access_grants.sql +0 -14
  176. package/vendor/gatekeeper/dist/lib/migrations/migrations/gatekeeper/0003_access_request_log.sql +0 -9
  177. package/vendor/server-ui/dist/assets/index-D-fer5ef.css +0 -1
  178. package/vendor/server-ui/dist/assets/index-DSaDPJaw.js +0 -84
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lamalibre/lamaste-docs",
3
- "version": "4.5.0",
3
+ "version": "4.7.0",
4
4
  "private": true,
5
5
  "description": "Lamaste documentation — markdown files served by the panel and published to GitHub Pages",
6
6
  "type": "module",
@@ -29,7 +29,7 @@ feria dev registry — OUT OF SCOPE, do not touch
29
29
 
30
30
  ### Naming Rules
31
31
 
32
- - **`lamaste`** is the core lib. You `import { ... } from '@lamalibre/lamaste@4.5.0'`. No `-lib` suffix.
32
+ - **`lamaste`** is the core lib. You `import { ... } from '@lamalibre/lamaste@4.7.0'`. No `-lib` suffix.
33
33
  - **`-d` suffix** for daemons — Unix convention (`httpd`, `sshd`, `mongod`). Instantly signals "long-running process".
34
34
  - **`-ui`** for React component libraries — universal term, avoids "serverd serves the panel" tautology.
35
35
  - **`create-*`** for all npx one-shot tools — the one npm convention everyone knows.
@@ -74,24 +74,24 @@ lamaste core library (types, constants, schemas, pl
74
74
 
75
75
  | # | Package (npm name) | Type | Depends on | Purpose |
76
76
  | --- | ----------------------------------- | ----------- | ---------- | ------------------------------------------------------------------------------------------------------------------- |
77
- | 1 | `@lamalibre/lamaste@4.5.0` | core lib | nothing | Types, constants, Zod schemas, plugin host Fastify plugin, atomic file helpers, client interfaces |
78
- | | | | | Subpath: `@lamalibre/lamaste@4.5.0/agent` — agent domain logic |
79
- | | | | | Subpath: `@lamalibre/lamaste@4.5.0/server` — server domain logic |
80
- | 2 | `@lamalibre/lamaste-agent@4.5.0` | CLI | `lamaste` | Thin agent CLI. No Fastify, no HTTP |
81
- | 3 | `@lamalibre/lamaste-agentd@4.5.0` | daemon | `lamaste` | Agent REST API on :9393. No CLI argument parsing |
82
- | 4 | `@lamalibre/lamaste-agent-ui@4.5.0` | UI lib | `lamaste` | Agent React components + browser SPA build. Used by desktop and agentd |
83
- | 5 | `@lamalibre/lamaste-server@4.5.0` | CLI | `lamaste` | **NEW.** Thin server CLI. No Fastify, no HTTP |
84
- | 6 | `@lamalibre/lamaste-serverd@4.5.0` | daemon | `lamaste` | Server REST API on :3100. No CLI argument parsing. Renamed from `serverd` |
85
- | 7 | `@lamalibre/lamaste-server-ui@4.5.0` | UI lib | `lamaste` | Server/admin React components + browser SPA build. Replaces both `panel-client` and `lamaste-admin-panel` |
86
- | 8 | `@lamalibre/lamaste@4.5.0-desktop` | desktop | `lamaste` | Unified Tauri app. Multi-target: full, agent-only, server-only. Credentials, tray, deep links |
87
- | 9 | `@lamalibre/lamaste-cloud@4.5.0` | lib + CLI | — | Cloud provider abstraction (already correct pattern) |
88
- | 10 | `@lamalibre/lamaste-tickets@4.5.0` | SDK | — | Agent-to-agent authorization |
89
- | 11 | `@lamalibre/lamaste-identity@4.5.0` | SDK | — | Authelia identity parsing and query |
90
- | 12 | `@lamalibre/create-lamaste@4.5.0` | provisioner | `lamaste` | Server provisioner: OS hardening, nginx, Authelia, certs. `npx create-lamaste` |
91
- | 13 | `@lamalibre/create-lamaste-agent@4.5.0` | provisioner | `lamaste` | Agent provisioner: cert enrollment, service setup. `npx create-lamaste-agent`. Renamed from `install-lamaste-agent` |
92
- | 14 | `@lamalibre/create-lamaste-desktop@4.5.0` | installer | — | Desktop app installer. `npx create-lamaste-desktop`. Renamed from `install-lamaste-desktop` |
93
- | 15 | `@lamalibre/create-lamaste-admin@4.5.0` | provisioner | `lamaste` | Admin cert upgrade to hardware-bound. `npx create-lamaste-admin`. Renamed from `install-lamaste-admin` |
94
- | 16 | `@lamalibre/create-lamaste-e2e@4.5.0` | test infra | — | E2E test MCP server. `npx create-lamaste-e2e`. Renamed from `install-lamaste-e2e-mcp` |
77
+ | 1 | `@lamalibre/lamaste@4.7.0` | core lib | nothing | Types, constants, Zod schemas, plugin host Fastify plugin, atomic file helpers, client interfaces |
78
+ | | | | | Subpath: `@lamalibre/lamaste@4.7.0/agent` — agent domain logic |
79
+ | | | | | Subpath: `@lamalibre/lamaste@4.7.0/server` — server domain logic |
80
+ | 2 | `@lamalibre/lamaste-agent@4.7.0` | CLI | `lamaste` | Thin agent CLI. No Fastify, no HTTP |
81
+ | 3 | `@lamalibre/lamaste-agentd@4.7.0` | daemon | `lamaste` | Agent REST API on :9393. No CLI argument parsing |
82
+ | 4 | `@lamalibre/lamaste-agent-ui@4.7.0` | UI lib | `lamaste` | Agent React components + browser SPA build. Used by desktop and agentd |
83
+ | 5 | `@lamalibre/lamaste-server@4.7.0` | CLI | `lamaste` | **NEW.** Thin server CLI. No Fastify, no HTTP |
84
+ | 6 | `@lamalibre/lamaste-serverd@4.7.0` | daemon | `lamaste` | Server REST API on :3100. No CLI argument parsing. Renamed from `serverd` |
85
+ | 7 | `@lamalibre/lamaste-server-ui@4.7.0` | UI lib | `lamaste` | Server/admin React components + browser SPA build. Replaces both `panel-client` and `lamaste-admin-panel` |
86
+ | 8 | `@lamalibre/lamaste@4.7.0-desktop` | desktop | `lamaste` | Unified Tauri app. Multi-target: full, agent-only, server-only. Credentials, tray, deep links |
87
+ | 9 | `@lamalibre/lamaste-cloud@4.7.0` | lib + CLI | — | Cloud provider abstraction (already correct pattern) |
88
+ | 10 | `@lamalibre/lamaste-tickets@4.7.0` | SDK | — | Agent-to-agent authorization |
89
+ | 11 | `@lamalibre/lamaste-identity@4.7.0` | SDK | — | Authelia identity parsing and query |
90
+ | 12 | `@lamalibre/create-lamaste@4.7.0` | provisioner | `lamaste` | Server provisioner: OS hardening, nginx, Authelia, certs. `npx create-lamaste` |
91
+ | 13 | `@lamalibre/create-lamaste-agent@4.7.0` | provisioner | `lamaste` | Agent provisioner: cert enrollment, service setup. `npx create-lamaste-agent`. Renamed from `install-lamaste-agent` |
92
+ | 14 | `@lamalibre/create-lamaste-desktop@4.7.0` | installer | — | Desktop app installer. `npx create-lamaste-desktop`. Renamed from `install-lamaste-desktop` |
93
+ | 15 | `@lamalibre/create-lamaste-admin@4.7.0` | provisioner | `lamaste` | Admin cert upgrade to hardware-bound. `npx create-lamaste-admin`. Renamed from `install-lamaste-admin` |
94
+ | 16 | `@lamalibre/create-lamaste-e2e@4.7.0` | test infra | — | E2E test MCP server. `npx create-lamaste-e2e`. Renamed from `install-lamaste-e2e-mcp` |
95
95
  | 17 | `@lamalibre/feria` | dev tool | — | Dev registry + release runner. **Out of scope — do not touch in this refactor** |
96
96
 
97
97
  ### Rename Map (1.x → 2.0.0)
@@ -116,7 +116,7 @@ The core library uses **subpath exports** to provide domain-specific entry point
116
116
 
117
117
  ```json
118
118
  {
119
- "name": "@lamalibre/lamaste@4.5.0",
119
+ "name": "@lamalibre/lamaste@4.7.0",
120
120
  "exports": {
121
121
  ".": "./dist/index.js",
122
122
  "./agent": "./dist/agent/index.js",
@@ -126,9 +126,9 @@ The core library uses **subpath exports** to provide domain-specific entry point
126
126
  ```
127
127
 
128
128
  ```typescript
129
- import { RESERVED_API_PREFIXES, pluginManifestSchema } from '@lamalibre/lamaste@4.5.0';
130
- import { loadRegistry, loadAgent, isAgentLoaded } from '@lamalibre/lamaste@4.5.0/agent';
131
- import { createTunnel, rotateCert } from '@lamalibre/lamaste@4.5.0/server';
129
+ import { RESERVED_API_PREFIXES, pluginManifestSchema } from '@lamalibre/lamaste@4.7.0';
130
+ import { loadRegistry, loadAgent, isAgentLoaded } from '@lamalibre/lamaste@4.7.0/agent';
131
+ import { createTunnel, rotateCert } from '@lamalibre/lamaste@4.7.0/server';
132
132
  ```
133
133
 
134
134
  **Why subpath exports instead of three packages (`lamaste-lib`, `lamaste-lib-agent`, `lamaste-lib-server`):**
@@ -149,7 +149,7 @@ import { createTunnel, rotateCert } from '@lamalibre/lamaste@4.5.0/server';
149
149
 
150
150
  | Layer | Agent side | Server side |
151
151
  | ------------------------ | ----------------------------------------------- | ---------------------------------------------- |
152
- | **Domain logic** | `@lamalibre/lamaste@4.5.0/agent` | `@lamalibre/lamaste@4.5.0/server` |
152
+ | **Domain logic** | `@lamalibre/lamaste@4.7.0/agent` | `@lamalibre/lamaste@4.7.0/server` |
153
153
  | **Operational CLI** | `lamaste-agent` | `lamaste-server` (new) |
154
154
  | **Long-running daemon** | `lamalibre-lamaste-agentd` on :9393 (extracted) | `lamalibre-lamaste-serverd` on :3100 (renamed) |
155
155
  | **UI components** | `lamaste-agent-ui` (renamed) | `lamaste-server-ui` (merged) |
@@ -471,7 +471,7 @@ The Rust backend has both `commands.rs` (legacy) and `agents.rs` (multi-agent).
471
471
 
472
472
  Create `packages/lamaste/` (TypeScript) with subpath exports:
473
473
 
474
- **Root (`@lamalibre/lamaste@4.5.0`):**
474
+ **Root (`@lamalibre/lamaste@4.7.0`):**
475
475
 
476
476
  - Types: `AdminClient`, `AgentClient` TypeScript interfaces, plugin manifest types, capability types
477
477
  - Constants: Reserved API prefixes, curated plugin list, capability names
@@ -479,7 +479,7 @@ Create `packages/lamaste/` (TypeScript) with subpath exports:
479
479
  - Plugin Host: Fastify plugin for plugin route mounting, bundle serving, disabled handler (unified from three routers)
480
480
  - File Helpers: Atomic write (temp → fsync → rename), promise-chain mutex
481
481
 
482
- **Agent subpath (`@lamalibre/lamaste@4.5.0/agent`):**
482
+ **Agent subpath (`@lamalibre/lamaste@4.7.0/agent`):**
483
483
 
484
484
  - Platform: Path helpers, platform detection (from `platform.js`)
485
485
  - Registry: Agent registry CRUD, label validation, legacy migration (from `registry.js`)
@@ -491,7 +491,7 @@ Create `packages/lamaste/` (TypeScript) with subpath exports:
491
491
  - Server Registry: servers.json and storage-servers.json CRUD (new — from Rust `cloud.rs`)
492
492
  - Mode: Server mode and admin cert file operations (new — from Rust `mode.rs`)
493
493
 
494
- **Server subpath (`@lamalibre/lamaste@4.5.0/server`):**
494
+ **Server subpath (`@lamalibre/lamaste@4.7.0/server`):**
495
495
 
496
496
  - Plugins: Server-side plugin lifecycle (uses shared schema from root)
497
497
  - Tunnels: Tunnel creation workflow with rollback (from `routes/tunnels.js`)
@@ -1,9 +1,9 @@
1
- export type { Group, GroupState, CreateGroupOptions, UpdateGroupOptions, DeleteGroupResult, Grant, GrantState, CreateGrantOptions, GrantFilter, AccessAllowed, AccessDenied, AccessResult, AccessRequestTemplates, TemplateOptions, GatekeeperSettings, AccessRequestEntry, TunnelInfo, TunnelUserSurfaceInfo, PluginTunnelTarget, AutheliaSession, GatekeeperLogger, } from './lib/types.js';
2
- export { PRINCIPAL_TYPES, RESOURCE_TYPES, ACCESS_MODES, RESERVED_GROUP_NAMES, MAX_GROUPS, MAX_GRANTS, GRANT_RETENTION_MS, SESSION_CACHE_TTL_MS, GROUP_NAME_REGEX, MAX_GROUP_NAME_LENGTH, MIN_GROUP_NAME_LENGTH, DEFAULT_DATA_DIR, GROUPS_FILE, GRANTS_FILE, SETTINGS_FILE, ACCESS_LOG_FILE, AUTHELIA_VERIFY_URL, GATEKEEPER_PORT, } from './lib/constants.js';
1
+ export type { Group, GroupState, CreateGroupOptions, UpdateGroupOptions, DeleteGroupResult, Grant, GrantState, CreateGrantOptions, GrantFilter, AccessAllowed, AccessDenied, AccessResult, AccessRequestTemplates, TemplateOptions, GatekeeperSettings, AccessRequestEntry, TunnelInfo, PluginTunnelTarget, AutheliaSession, GatekeeperLogger, } from './lib/types.js';
2
+ export { PRINCIPAL_TYPES, RESOURCE_TYPES, ACCESS_MODES, RESERVED_GROUP_NAMES, MAX_GROUPS, MAX_GRANTS, GRANT_RETENTION_MS, SESSION_CACHE_TTL_MS, GROUP_NAME_REGEX, MAX_GROUP_NAME_LENGTH, MIN_GROUP_NAME_LENGTH, DEFAULT_DATA_DIR, GROUPS_FILE, GRANTS_FILE, SETTINGS_FILE, TUNNELS_FILE, SITES_FILE, ACCESS_LOG_FILE, AUTHELIA_VERIFY_URL, GATEKEEPER_PORT, } from './lib/constants.js';
3
3
  export type { PrincipalType, ResourceType, AccessMode } from './lib/constants.js';
4
4
  export { createGroup, listGroups, getGroup, updateGroup, deleteGroup, addMembers, removeMembers, getGroupsForUser, } from './lib/groups.js';
5
5
  export { createGrant, listGrants, getGrant, revokeGrant, consumeGrant, removeGrantsByPredicate, removeGrantsByPrincipal, } from './lib/grants.js';
6
- export { checkAccess } from './lib/authz.js';
6
+ export { checkAccess, isPluginAudienceMember } from './lib/authz.js';
7
7
  export { tunnelInfoFromState } from './lib/tunnels.js';
8
8
  export { getAccessRequestTemplates, buildAccessRequestPage } from './lib/templates.js';
9
9
  export { migrateFromLegacy } from './lib/migration.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,eAAe,EACf,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGlF,OAAO,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,EACb,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,eAAe,EACf,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,aAAa,EACb,YAAY,EACZ,UAAU,EACV,eAAe,EACf,mBAAmB,EACnB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGlF,OAAO,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,EACb,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAGrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,11 +1,11 @@
1
1
  // Constants
2
- export { PRINCIPAL_TYPES, RESOURCE_TYPES, ACCESS_MODES, RESERVED_GROUP_NAMES, MAX_GROUPS, MAX_GRANTS, GRANT_RETENTION_MS, SESSION_CACHE_TTL_MS, GROUP_NAME_REGEX, MAX_GROUP_NAME_LENGTH, MIN_GROUP_NAME_LENGTH, DEFAULT_DATA_DIR, GROUPS_FILE, GRANTS_FILE, SETTINGS_FILE, ACCESS_LOG_FILE, AUTHELIA_VERIFY_URL, GATEKEEPER_PORT, } from './lib/constants.js';
2
+ export { PRINCIPAL_TYPES, RESOURCE_TYPES, ACCESS_MODES, RESERVED_GROUP_NAMES, MAX_GROUPS, MAX_GRANTS, GRANT_RETENTION_MS, SESSION_CACHE_TTL_MS, GROUP_NAME_REGEX, MAX_GROUP_NAME_LENGTH, MIN_GROUP_NAME_LENGTH, DEFAULT_DATA_DIR, GROUPS_FILE, GRANTS_FILE, SETTINGS_FILE, TUNNELS_FILE, SITES_FILE, ACCESS_LOG_FILE, AUTHELIA_VERIFY_URL, GATEKEEPER_PORT, } from './lib/constants.js';
3
3
  // Groups
4
4
  export { createGroup, listGroups, getGroup, updateGroup, deleteGroup, addMembers, removeMembers, getGroupsForUser, } from './lib/groups.js';
5
5
  // Grants
6
6
  export { createGrant, listGrants, getGrant, revokeGrant, consumeGrant, removeGrantsByPredicate, removeGrantsByPrincipal, } from './lib/grants.js';
7
7
  // Authorization
8
- export { checkAccess } from './lib/authz.js';
8
+ export { checkAccess, isPluginAudienceMember } from './lib/authz.js';
9
9
  // The tunnels Gatekeeper authorizes, as it reads them from tunnels.json
10
10
  export { tunnelInfoFromState } from './lib/tunnels.js';
11
11
  // Templates
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyBA,YAAY;AACZ,OAAO,EACL,eAAe,EACf,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAI5B,SAAS;AACT,OAAO,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,EACb,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB,SAAS;AACT,OAAO,EACL,WAAW,EACX,UAAU,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,iBA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-13,4 +13,13 @@ import type { AccessResult, TemplateOptions } from './types.js';
13
13
  * @returns AccessResult indicating allowed/denied with templates if denied
14
14
  */
15
15
  export declare function checkAccess(username: string, resourceType: string, resourceId: string, templateOptions?: TemplateOptions): Promise<AccessResult>;
16
+ /**
17
+ * Whether `username` is in the audience of the plugin at `route`: an
18
+ * entitlement — a `plugin` grant on the route with roles — to the user or
19
+ * to one of their Lamaste groups. What a plugin's web surface asks before it
20
+ * serves the shell; the panel decides again, from its directory, on every
21
+ * request to the plugin's API (a disabled or removed user, a plugin not
22
+ * ready).
23
+ */
24
+ export declare function isPluginAudienceMember(username: string, route: string): Promise<boolean>;
16
25
  //# sourceMappingURL=authz.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authz.d.ts","sourceRoot":"","sources":["../../src/lib/authz.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhE;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,eAAe,CAAC,EAAE,eAAe,GAChC,OAAO,CAAC,YAAY,CAAC,CA8BvB"}
1
+ {"version":3,"file":"authz.d.ts","sourceRoot":"","sources":["../../src/lib/authz.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhE;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,eAAe,CAAC,EAAE,eAAe,GAChC,OAAO,CAAC,YAAY,CAAC,CA8BvB;AAeD;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAU9F"}
@@ -39,4 +39,35 @@ export async function checkAccess(username, resourceType, resourceId, templateOp
39
39
  templates,
40
40
  };
41
41
  }
42
+ /**
43
+ * The roles a grant carries as an entitlement — its `context.roles` when
44
+ * that is a non-empty list of strings — or null. The panel's rule
45
+ * (`entitlements.js` `grantRoles`): a grant without roles (a desktop's
46
+ * local-install grant, one migrated from `user-plugin-access.json`) never
47
+ * makes anyone a member of a plugin's audience.
48
+ */
49
+ function entitlementRoles(context) {
50
+ const roles = context?.['roles'];
51
+ if (!Array.isArray(roles) || roles.length === 0)
52
+ return null;
53
+ return roles.every((role) => typeof role === 'string') ? roles : null;
54
+ }
55
+ /**
56
+ * Whether `username` is in the audience of the plugin at `route`: an
57
+ * entitlement — a `plugin` grant on the route with roles — to the user or
58
+ * to one of their Lamaste groups. What a plugin's web surface asks before it
59
+ * serves the shell; the panel decides again, from its directory, on every
60
+ * request to the plugin's API (a disabled or removed user, a plugin not
61
+ * ready).
62
+ */
63
+ export async function isPluginAudienceMember(username, route) {
64
+ const entitlements = (await listGrants({ resourceType: 'plugin', resourceId: route })).filter((g) => entitlementRoles(g.context) !== null);
65
+ if (entitlements.some((g) => g.principalType === 'user' && g.principalId === username)) {
66
+ return true;
67
+ }
68
+ if (!entitlements.some((g) => g.principalType === 'group'))
69
+ return false;
70
+ const groups = await getGroupsForUser(username);
71
+ return entitlements.some((g) => g.principalType === 'group' && groups.includes(g.principalId));
72
+ }
42
73
  //# sourceMappingURL=authz.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authz.js","sourceRoot":"","sources":["../../src/lib/authz.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAG3D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,QAAgB,EAChB,YAA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,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,OAAO,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AACjG,CAAC"}
@@ -5,9 +5,10 @@ export declare const PRINCIPAL_TYPES: readonly ["user", "group"];
5
5
  export type PrincipalType = (typeof PRINCIPAL_TYPES)[number];
6
6
  /**
7
7
  * Built-in resource types. The grant system is extensible — new resource types
8
- * can be added without schema changes.
8
+ * can be added without schema changes. A `site` grant opens a restricted
9
+ * plugin-owned site (a plugin's web surface) to its holder.
9
10
  */
10
- export declare const RESOURCE_TYPES: readonly ["tunnel", "plugin"];
11
+ export declare const RESOURCE_TYPES: readonly ["tunnel", "plugin", "site"];
11
12
  export type ResourceType = (typeof RESOURCE_TYPES)[number];
12
13
  /**
13
14
  * Tunnel access modes.
@@ -63,6 +64,8 @@ export declare const DEFAULT_DATA_DIR = "/etc/lamalibre/lamaste";
63
64
  export declare const GROUPS_FILE = "groups.json";
64
65
  export declare const GRANTS_FILE = "access-grants.json";
65
66
  export declare const SETTINGS_FILE = "gatekeeper.json";
67
+ export declare const TUNNELS_FILE = "tunnels.json";
68
+ export declare const SITES_FILE = "sites.json";
66
69
  export declare const ACCESS_LOG_FILE = "access-request-log.json";
67
70
  /**
68
71
  * Authelia verify endpoint (localhost).
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe,4BAA6B,CAAC;AAC1D,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D;;;GAGG;AACH,eAAO,MAAM,cAAc,+BAAgC,CAAC;AAC5D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,YAAY,oDAAqD,CAAC;AAC/E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O,MAAM,YAAY,oDAAqD,CAAC;AAC/E,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,6CAA8C,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,UAAU,MAAM,CAAC;AAE9B;;GAEG;AACH,eAAO,MAAM,UAAU,OAAO,CAAC;AAE/B;;GAEG;AACH,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAA2B,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,oBAAoB,QAAY,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAoC,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,gBAAgB,2BAA2B,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAChD,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAC/C,eAAO,MAAM,YAAY,iBAAiB,CAAC;AAC3C,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,eAAe,4BAA4B,CAAC;AAEzD;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,iDAAiD,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,eAAe,OAAO,CAAC"}
@@ -4,9 +4,10 @@
4
4
  export const PRINCIPAL_TYPES = ['user', 'group'];
5
5
  /**
6
6
  * Built-in resource types. The grant system is extensible — new resource types
7
- * can be added without schema changes.
7
+ * can be added without schema changes. A `site` grant opens a restricted
8
+ * plugin-owned site (a plugin's web surface) to its holder.
8
9
  */
9
- export const RESOURCE_TYPES = ['tunnel', 'plugin'];
10
+ export const RESOURCE_TYPES = ['tunnel', 'plugin', 'site'];
10
11
  /**
11
12
  * Tunnel access modes.
12
13
  */
@@ -60,6 +61,8 @@ export const DEFAULT_DATA_DIR = '/etc/lamalibre/lamaste';
60
61
  export const GROUPS_FILE = 'groups.json';
61
62
  export const GRANTS_FILE = 'access-grants.json';
62
63
  export const SETTINGS_FILE = 'gatekeeper.json';
64
+ export const TUNNELS_FILE = 'tunnels.json';
65
+ export const SITES_FILE = 'sites.json';
63
66
  export const ACCESS_LOG_FILE = 'access-request-log.json';
64
67
  /**
65
68
  * Authelia verify endpoint (localhost).
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AAG1D;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAG5D;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,eAAe,EAAE,YAAY,CAAU,CAAC;AAG/E;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAC;AAE9B;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC;AAE/B;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAA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M access_grants WHERE grant_id = ?'),
39
39
  // Retention sweep: prune consumed grants past GRANT_RETENTION_MS. The
40
40
  // matching index (idx_grants_used_used_at) covers the predicate.
41
- deleteConsumedBefore: db.prepare('DELETE FROM access_grants WHERE used = 1 AND used_at IS NOT NULL AND used_at < ?'),
41
+ // Only local plugin grants are ever consumed (a desktop enrolment);
42
+ // every other grant is access, kept until it is revoked.
43
+ deleteConsumedBefore: db.prepare(`DELETE FROM access_grants WHERE used = 1 AND used_at IS NOT NULL AND used_at < ?
44
+ AND resource_type = 'plugin'
45
+ AND coalesce(json_extract(context, '$.target'), 'local') = 'local'`),
42
46
  begin: db.prepare('BEGIN IMMEDIATE'),
43
47
  commit: db.prepare('COMMIT'),
44
48
  rollback: db.prepare('ROLLBACK'),
@@ -72,18 +76,13 @@ function pruneStaleGrants(s) {
72
76
  s.deleteConsumedBefore.run(cutoff);
73
77
  }
74
78
  /**
75
- * Check if a grant should be auto-consumed on creation.
76
- * Tunnel grants and agent-side plugin grants are auto-consumed.
77
- * Local plugin grants start unused (consumed on enrollment).
79
+ * Whether a grant is consumable: a local plugin grant, consumed by its
80
+ * desktop enrolment. Every other grant is access, never consumed.
78
81
  */
79
- function shouldAutoConsume(options) {
80
- if (options.resourceType === 'tunnel')
81
- return true;
82
- if (options.resourceType === 'plugin') {
83
- const target = options.context?.['target'] ?? 'local';
84
- return target.startsWith('agent:');
85
- }
86
- return true;
82
+ function isConsumable(grant) {
83
+ if (grant.resourceType !== 'plugin')
84
+ return false;
85
+ return (grant.context['target'] ?? 'local') === 'local';
87
86
  }
88
87
  /**
89
88
  * Check if two grants are duplicates (same principal + resource + context).
@@ -124,7 +123,10 @@ export async function createGrant(options, initialState) {
124
123
  throw Object.assign(new Error('Duplicate grant: a grant with the same principal, resource, and context already exists'), { statusCode: 409 });
125
124
  }
126
125
  const now = new Date().toISOString();
127
- const used = initialState?.used ?? shouldAutoConsume(options);
126
+ // Created unused: a local plugin grant is consumed by its desktop
127
+ // enrolment; every other grant is access, never consumed, so the
128
+ // retention sweep never deletes it.
129
+ const used = initialState?.used ?? false;
128
130
  const createdAt = initialState?.createdAt ?? now;
129
131
  const usedAt = initialState?.usedAt !== undefined ? initialState.usedAt : used ? now : null;
130
132
  const grant = {
@@ -297,6 +299,11 @@ export async function consumeGrant(grantId, username) {
297
299
  if (grant.principalType !== 'user' || grant.principalId !== username) {
298
300
  throw Object.assign(new Error('Grant does not belong to this user'), { statusCode: 403 });
299
301
  }
302
+ if (!isConsumable(grant)) {
303
+ throw Object.assign(new Error('Only a local plugin grant can be consumed'), {
304
+ statusCode: 409,
305
+ });
306
+ }
300
307
  if (grant.used) {
301
308
  throw Object.assign(new Error('Grant has already been consumed'), { statusCode: 409 });
302
309
  }
@@ -1 +1 @@
1
- {"version":3,"file":"grants.js","sourceRoot":"","sources":["../../src/lib/grants.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKhD,8EAA8E;AAC9E,gDAAgD;AAChD,EAAE;AACF,0EAA0E;AAC1E,mEAAmE;AACnE,4EAA4E;AAC5E,kDAAkD;AAClD,8EAA8E;AAE9E,MAAM,UAAU,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAE3C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAI,EAAoB;IACnD,OAAO,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAC5B,CAAC;AAmBD,IAAI,KAAK,GAAsB,IAAI,CAAC;AAEpC,KAAK,UAAU,QAAQ;IACrB,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IAExB,MAAM,EAAE,GAAG,MAAM,eAAe,EAAE,C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MAAM,CAAC,IAAI,KAAK,CAAC,2CAA2C,CAAC,EAAE;gBAC1E,UAAU,EAAE,GAAG;aAChB,CAAC,CAAC;QACL,CAAC;QAED,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iCAAiC,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;QACzF,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACxC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACd,IAAI,CAAC;YACH,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACjB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;YACjB,MAAM,GAAG,CAAC;QACZ,CAAC;QAED,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QACtB,sBAAsB,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,8 @@
1
+ -- Only a local plugin grant is ever consumed (its desktop enrolment). Grants
2
+ -- on tunnels, sites and agent-side plugins were created consumed, and the
3
+ -- retention sweep deleted them 90 days later: access vanished silently. They
4
+ -- are access, kept until revoked.
5
+ UPDATE access_grants SET used = 0, used_at = NULL
6
+ WHERE used = 1
7
+ AND NOT (resource_type = 'plugin'
8
+ AND coalesce(json_extract(context, '$.target'), 'local') = 'local');
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Whether the presented management secret is Gatekeeper's, compared in
3
+ * constant time (both sides hashed first, so their lengths never show).
4
+ */
5
+ export declare function secretMatches(presented: unknown, secret: string): boolean;
6
+ //# sourceMappingURL=secret.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret.d.ts","sourceRoot":"","sources":["../../src/lib/secret.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAIzE"}
@@ -0,0 +1,12 @@
1
+ import crypto from 'node:crypto';
2
+ /**
3
+ * Whether the presented management secret is Gatekeeper's, compared in
4
+ * constant time (both sides hashed first, so their lengths never show).
5
+ */
6
+ export function secretMatches(presented, secret) {
7
+ if (typeof presented !== 'string')
8
+ return false;
9
+ const digest = (value) => crypto.createHash('sha256').update(value).digest();
10
+ return crypto.timingSafeEqual(digest(presented), digest(secret));
11
+ }
12
+ //# sourceMappingURL=secret.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secret.js","sourceRoot":"","sources":["../../src/lib/secret.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,SAAkB,EAAE,MAAc;IAC9D,IAAI,OAAO,SAAS,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAChD,MAAM,MAAM,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7F,OAAO,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AACnE,CAAC"}
@@ -18,4 +18,24 @@ export declare function getAccessRequestTemplates(username: string, resourceName
18
18
  * @returns Full HTML page string
19
19
  */
20
20
  export declare function buildAccessRequestPage(username: string, resourceFqdn: string, options?: TemplateOptions): string;
21
+ /**
22
+ * The page a signed-in user is answered with on a host of a domain they
23
+ * are not a member of (the multi-domain relay): no access request — the
24
+ * whole domain is closed to them — but who to ask, and a way to sign in as
25
+ * someone else. It names no user (Authelia's refusal carries none). Shares
26
+ * the access-request page's look. With `site`, the page of a static site
27
+ * that refused a signed-in user — for its domain or its own user list
28
+ * (Authelia's 403 does not say which).
29
+ *
30
+ * @param domain - The base domain the requested host is under; null when it
31
+ * is under none (the page then links to no sign-in: there is none to trust)
32
+ * @param options - Optional admin contact info
33
+ * @param host - The requested hostname; `site` when the refusal is a static
34
+ * site's (for its domain or its own user list)
35
+ * @returns Full HTML page string
36
+ */
37
+ export declare function buildDomainRefusalPage(domain: string | null, options: TemplateOptions | undefined, { host, site }: {
38
+ host: string;
39
+ site?: boolean;
40
+ }): string;
21
41
  //# sourceMappingURL=templates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/lib/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE1E;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,eAAe,GACxB,sBAAsB,CAmBxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,eAAe,GACxB,MAAM,CAmGR"}
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/lib/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAkB1E;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,eAAe,GACxB,sBAAsB,CAmBxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,eAAe,GACxB,MAAM,CAsFR;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,EAAE,eAAe,GAAG,SAAS,EACpC,EAAE,IAAI,EAAE,IAAY,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GACvD,MAAM,CAkDR"}
@@ -1,3 +1,18 @@
1
+ /** The look every page Gatekeeper serves shares: the panel's dark terminal style. */
2
+ const BASE_CSS = ` *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
3
+ body {
4
+ font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
5
+ background: #09090b; color: #e4e4e7;
6
+ min-height: 100vh; display: flex; align-items: center; justify-content: center;
7
+ padding: 1rem;
8
+ }
9
+ .card {
10
+ background: #18181b; border: 1px solid #27272a; border-radius: 0.75rem;
11
+ max-width: 560px; width: 100%; padding: 2rem;
12
+ }
13
+ .icon { font-size: 2.5rem; margin-bottom: 1rem; }
14
+ h1 { font-size: 1.25rem; color: #f4f4f5; margin-bottom: 0.5rem; }
15
+ .fqdn { color: #22d3ee; }`;
1
16
  /**
2
17
  * Generate pre-filled message templates for requesting access to a resource.
3
18
  *
@@ -44,20 +59,7 @@ export function buildAccessRequestPage(username, resourceFqdn, options) {
44
59
  <meta name="viewport" content="width=device-width, initial-scale=1">
45
60
  <title>Access Required — ${escapeHtml(resourceFqdn)}</title>
46
61
  <style>
47
- *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
48
- body {
49
- font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
50
- background: #09090b; color: #e4e4e7;
51
- min-height: 100vh; display: flex; align-items: center; justify-content: center;
52
- padding: 1rem;
53
- }
54
- .card {
55
- background: #18181b; border: 1px solid #27272a; border-radius: 0.75rem;
56
- max-width: 560px; width: 100%; padding: 2rem;
57
- }
58
- .icon { font-size: 2.5rem; margin-bottom: 1rem; }
59
- h1 { font-size: 1.25rem; color: #f4f4f5; margin-bottom: 0.5rem; }
60
- .fqdn { color: #22d3ee; }
62
+ ${BASE_CSS}
61
63
  .subtitle { color: #a1a1aa; font-size: 0.875rem; margin-bottom: 1.5rem; }
62
64
  .section-label {
63
65
  color: #71717a; font-size: 0.75rem; text-transform: uppercase;
@@ -132,6 +134,70 @@ ${escapeHtml(templates.email.body)}<button class="copy-btn" onclick="copyTemplat
132
134
  </body>
133
135
  </html>`;
134
136
  }
137
+ /**
138
+ * The page a signed-in user is answered with on a host of a domain they
139
+ * are not a member of (the multi-domain relay): no access request — the
140
+ * whole domain is closed to them — but who to ask, and a way to sign in as
141
+ * someone else. It names no user (Authelia's refusal carries none). Shares
142
+ * the access-request page's look. With `site`, the page of a static site
143
+ * that refused a signed-in user — for its domain or its own user list
144
+ * (Authelia's 403 does not say which).
145
+ *
146
+ * @param domain - The base domain the requested host is under; null when it
147
+ * is under none (the page then links to no sign-in: there is none to trust)
148
+ * @param options - Optional admin contact info
149
+ * @param host - The requested hostname; `site` when the refusal is a static
150
+ * site's (for its domain or its own user list)
151
+ * @returns Full HTML page string
152
+ */
153
+ export function buildDomainRefusalPage(domain, options, { host, site = false }) {
154
+ const adminContact = options?.adminContact ?? '';
155
+ const adminName = options?.adminName ?? 'your administrator';
156
+ const heading = domain === null || site
157
+ ? `Not allowed on <span class="fqdn">${escapeHtml(host)}</span>`
158
+ : `Not a member of <span class="fqdn">${escapeHtml(domain)}</span>`;
159
+ const explanation = domain === null
160
+ ? `Your account is signed in, but this host is under none of this relay's domains,
161
+ so nobody may open it.`
162
+ : site
163
+ ? `Your account is signed in, but it may not open this site: it is not a member of
164
+ ${escapeHtml(domain)}, or not one of the site's users.`
165
+ : `Your account is signed in, but it is not a member of this domain, so none of its
166
+ applications are open to it.`;
167
+ // Only a domain of this relay has a sign-in to send the user to; a host
168
+ // under none could name a stranger's.
169
+ const signOut = domain === null
170
+ ? ''
171
+ : `<p class="subtitle">
172
+ <a href="https://auth.${escapeAttr(domain)}/logout">Sign out</a> to sign in with another account.
173
+ </p>`;
174
+ return `<!DOCTYPE html>
175
+ <html lang="en">
176
+ <head>
177
+ <meta charset="utf-8">
178
+ <meta name="viewport" content="width=device-width, initial-scale=1">
179
+ <title>Not allowed — ${escapeHtml(domain ?? host)}</title>
180
+ <style>
181
+ ${BASE_CSS}
182
+ .subtitle { color: #a1a1aa; font-size: 0.875rem; margin-bottom: 1rem; }
183
+ .contact { color: #a1a1aa; font-size: 0.8125rem; margin-top: 1.5rem; }
184
+ a { color: #22d3ee; text-decoration: none; }
185
+ a:hover { text-decoration: underline; }
186
+ </style>
187
+ </head>
188
+ <body>
189
+ <div class="card">
190
+ <div class="icon">&#128683;</div>
191
+ <h1>${heading}</h1>
192
+ <p class="subtitle">
193
+ ${explanation} Ask ${escapeHtml(adminName)} to add you if you should have access.
194
+ </p>
195
+ ${signOut}
196
+ ${adminContact ? `<p class="contact">Admin: <a href="mailto:${escapeAttr(adminContact)}">${escapeHtml(adminContact)}</a></p>` : ''}
197
+ </div>
198
+ </body>
199
+ </html>`;
200
+ }
135
201
  function escapeHtml(str) {
136
202
  return str
137
203
  .replace(/&/g, '&amp;')