Separate Zapier, web, API, and leaf access planes with NATS authz
Some checks are pending
offline / test (push) Waiting to run
Some checks are pending
offline / test (push) Waiting to run
Zapier is one ingress. Direct web, customer API, and S2S leaf nodes are their own services. Every hop to an internal subject must pass verae.access.authz.check (default deny by plane).
This commit is contained in:
parent
ac38676645
commit
1b199ca4d4
70 changed files with 2640 additions and 105 deletions
|
|
@ -30,7 +30,12 @@ Zapier cloud **never** connects to NATS. Internal services do: middleware worker
|
|||
| Module | Repo (Forgejo) | Runtime | Listens | Sends |
|
||||
|--------|----------------|---------|---------|-------|
|
||||
| zapier-platform-app | `verae-zapier-app` | Zapier cloud | User Zap steps | HTTPS to zappier-edge |
|
||||
| zappier-edge | `zappier-edge` | Public HTTPS :3000 | Zapier, portal, admin | HTTPS to middleware; NATS billing pub |
|
||||
| zappier-edge | `zappier-edge` | Public HTTPS :3000 | Zapier, portal, admin | HTTPS to middleware; NATS billing after authz |
|
||||
| access-authz | `verae-access-authz` | :3020 + NATS | `verae.access.authz.check` | allow/deny |
|
||||
| access-web | `verae-access-web` | :3021 | customer browser | billing statement/reload |
|
||||
| access-api | `verae-access-api` | :3022 | x-api-key | statement; HTTPS to middleware |
|
||||
| access-leaf | `verae-access-leaf` | :3023 | S2S leaf | archive/jobs only |
|
||||
| access-zapier | `verae-access-zapier` | :3024 | Zapier HTTPS | jobs.watch after authz |
|
||||
| account-balance | `zappier-account-balance` | :3010 + NATS | `verae.billing.*` | statement/adjust replies |
|
||||
| customer-service | `zappier-customer-service` | :3011 | CS staff HTTP | NATS balance.adjust / statement.get |
|
||||
| sales-pricing | `zappier-sales-pricing` | :3012 | Sales HTTP | NATS statement.get; HTTPS to edge for multipliers |
|
||||
|
|
@ -63,6 +68,11 @@ Zapier cloud **never** connects to NATS. Internal services do: middleware worker
|
|||
| `verae.billing.usage.recorded` | pub | meter events from zappier-edge |
|
||||
| `verae.billing.payment.recorded` | pub | portal reload / invoice paid |
|
||||
| `verae.billing.credit.applied` | pub | CS goodwill |
|
||||
| `verae.access.authz.check` | request-reply | `{ plane, subject, principal }` → `{ allow, reason }` |
|
||||
| `verae.access.web.billing.statement.get` | ingress | web plane only; mapped after authz |
|
||||
| `verae.access.api.*` | ingress | customer API plane |
|
||||
| `verae.access.zapier.*` | ingress | Zapier plane |
|
||||
| `verae.access.leaf.in` | ingress | S2S leaf; never billing |
|
||||
| `verae.archive.put` | JetStream | `sha256`, `tenantId`, `kind` (`publicMeta\|privateMeta\|file\|tree`), `record`, `traceId` |
|
||||
| `verae.archive.query` | pub to **all** archives | `correlationId`, `sha256`, `tenantId`, `kinds[]`, `traceId` |
|
||||
| `verae.archive.reply.<correlationId>` | replies | `archiveId`, `sha256`, `records[]`, `traceId` |
|
||||
|
|
|
|||
3
packages/docs-master/modules/verae-access-api/NATS.md
Normal file
3
packages/docs-master/modules/verae-access-api/NATS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# NATS — verae-access-api
|
||||
|
||||
Plane `api`. Statement and jobs.watch after authz. No credits, no archive.
|
||||
3
packages/docs-master/modules/verae-access-api/SUMMARY.md
Normal file
3
packages/docs-master/modules/verae-access-api/SUMMARY.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# verae-access-api
|
||||
|
||||
Direct customer API (`x-api-key`). Separate from Zapier Platform.
|
||||
3
packages/docs-master/modules/verae-access-authz/NATS.md
Normal file
3
packages/docs-master/modules/verae-access-authz/NATS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# NATS — verae-access-authz
|
||||
|
||||
`verae.access.authz.check` request-reply. Queue `access-authz`. Fail closed.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# verae-access-authz
|
||||
|
||||
Default-deny authorization step on the NATS address path. Planes: zapier, web, api, leaf, staff.
|
||||
3
packages/docs-master/modules/verae-access-leaf/NATS.md
Normal file
3
packages/docs-master/modules/verae-access-leaf/NATS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# NATS — verae-access-leaf
|
||||
|
||||
`verae.access.leaf.in` → authz.check → `verae.archive.*` / jobs.*. Denied: billing.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# verae-access-leaf
|
||||
|
||||
Server-to-server NATS leaf ingress. Archive and jobs only. Never billing.
|
||||
3
packages/docs-master/modules/verae-access-web/NATS.md
Normal file
3
packages/docs-master/modules/verae-access-web/NATS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# NATS — verae-access-web
|
||||
|
||||
Plane `web`. Authz then `verae.billing.statement.get` / `balance.adjust` kind=reload.
|
||||
3
packages/docs-master/modules/verae-access-web/SUMMARY.md
Normal file
3
packages/docs-master/modules/verae-access-web/SUMMARY.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# verae-access-web
|
||||
|
||||
Direct customer web plane. Not Zapier. Statement + reload only after authz.
|
||||
3
packages/docs-master/modules/verae-access-zapier/NATS.md
Normal file
3
packages/docs-master/modules/verae-access-zapier/NATS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# NATS — verae-access-zapier
|
||||
|
||||
Plane `zapier`. Authz then jobs.watch / usage.recorded. Zapier cloud never connects to NATS.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
# verae-access-zapier
|
||||
|
||||
Zapier Platform HTTPS plane only. No portal, no admin, no leaf.
|
||||
|
|
@ -10,8 +10,12 @@ Verae Time proves a SHA-256 existed at a given time. Zapier lets customers regis
|
|||
|
||||
| Plane | What | Network |
|
||||
|-------|------|---------|
|
||||
| Zapier cloud | `verae-zapier-app`, `verae-activate` | HTTPS to zappier-edge |
|
||||
| Commercial edge | `zappier-edge` portal, admin, `x-api-key`, Stripe meter | Public HTTPS; NATS billing pubs/requests |
|
||||
| Zapier cloud | `verae-zapier-app` via **access-zapier** | HTTPS to `:3024` only (not NATS) |
|
||||
| Direct web | `verae-access-web` customer browser | HTTPS `:3021` |
|
||||
| Direct customer API | `verae-access-api` `x-api-key` | HTTPS `:3022` |
|
||||
| S2S leaf | `verae-access-leaf` | NATS `verae.access.leaf.in` / HTTPS `:3023` |
|
||||
| Authz | `verae-access-authz` | `verae.access.authz.check` before any internal subject |
|
||||
| Commercial edge | `zappier-edge` portal, admin, Stripe (legacy combined) | Public HTTPS; NATS billing after authz |
|
||||
| Account balance | `zappier-account-balance` prepaid SoT | NATS `verae.billing.*` + HTTP `:3010` |
|
||||
| CS / sales / accounting | `zappier-customer-service`, `zappier-sales-pricing`, `zappier-accounting-export` | Private HTTP; NATS statement/adjust |
|
||||
| Middleware HTTP | `/zapier/v1/*` job id + wait | Public HTTPS from edge only |
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@ Each runtime piece is its **own git repo** on Forgejo (`git.georgelambert.org`,
|
|||
| **verae-nats-process** | `packages/verae-nats-process` | **Template** for a new addressed NATS process |
|
||||
| **master-zapier-plan-draft** | workspace root | Combined snapshot (`main` and `master`) |
|
||||
| **zappier-edge** | `packages/zappier` | Metered HTTPS, portal, admin, Stripe; **proxies Verae calls to middleware** |
|
||||
| **verae-access-authz** | `packages/verae-access-authz` | NATS authorization step (`authz.check`) |
|
||||
| **verae-access-web** | `packages/verae-access-web` | Direct customer web plane |
|
||||
| **verae-access-api** | `packages/verae-access-api` | Direct customer API plane (not Zapier) |
|
||||
| **verae-access-leaf** | `packages/verae-access-leaf` | Server-to-server NATS leaf plane |
|
||||
| **verae-access-zapier** | `packages/verae-access-zapier` | Zapier Platform plane only |
|
||||
| **zappier-account-balance** | `packages/zappier-account-balance` | NATS source of truth for prepaid balances |
|
||||
| **zappier-customer-service** | `packages/zappier-customer-service` | CS goodwill credits onto prepaid balances |
|
||||
| **zappier-sales-pricing** | `packages/zappier-sales-pricing` | Sales per-customer tier / multiplier |
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Today’s NS1 box (`NS1.GEORGELAMBERT.ORG`, `70.88.205.138`) already runs JetStr
|
|||
|
||||
| Allowed | Forbidden |
|
||||
|---------|-----------|
|
||||
| verae-middleware, fleet workers, WORM, tree nodes, account-balance, zappier-edge billing, CS/sales/accounting, `verae-nats-process` clones | Zapier cloud, customer browsers (they use HTTPS portal/CS/sales UIs) |
|
||||
| access-authz, access-leaf (after token), middleware, fleet workers, WORM, tree, account-balance, access planes, CS/sales | Zapier cloud, customer browsers (HTTPS to access-web / access-api / access-zapier only) |
|
||||
|
||||
## Address families already in use
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,14 @@ NATS **addresses** (subjects) are the extension point. A new search, store, or j
|
|||
## Pattern
|
||||
|
||||
```text
|
||||
verae.<area>.<resource>.<action>
|
||||
verae.access.<plane>.<area>.<resource>.<action> # ingress (one plane)
|
||||
verae.access.authz.check # authorization step
|
||||
verae.<area>.<resource>.<action> # internal bus
|
||||
verae.<area>.<resource>.reply.<correlationId>
|
||||
```
|
||||
|
||||
Planes: `zapier` | `web` | `api` | `leaf` | `staff`. Default deny. A leaf cannot `balance.adjust`; Zapier cannot `statement.get`; a browser cannot `archive.put`.
|
||||
|
||||
| Piece | Example | Meaning |
|
||||
|-------|---------|---------|
|
||||
| `verae` | — | Verae bus (not Zapier) |
|
||||
|
|
@ -26,7 +30,7 @@ verae.<area>.<resource>.reply.<correlationId>
|
|||
2. Rename `verae.example.process.in` / `.out` / `.reply.*` in `src/subjects.js`.
|
||||
3. Add a row to that repo’s `ROUTING.md` and to [INDEX.md](INDEX.md).
|
||||
4. Register the process in `verae-fleet` (`min`/`max`, machines, roles).
|
||||
5. If Zapier must call it, add **one HTTPS route** on middleware — Zapier still never sees NATS.
|
||||
5. If an access plane must call it, add the subject to **verae-access-authz** policy for that plane only. Zapier still never sees NATS.
|
||||
|
||||
Do **not** invent a public NATS URL for Zapier. Do **not** reuse `verae.archive.query` as a queue group.
|
||||
|
||||
|
|
|
|||
|
|
@ -8,23 +8,24 @@ SVG files in [`diagrams/`](diagrams/). The same shapes are repeated below in mer
|
|||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
Z[Zapier cloud apps] -->|HTTPS x-api-key| E[zappier-edge]
|
||||
Cust[customer portal] -->|HTTPS statement| E
|
||||
CS[customer-service] -->|NATS statement/adjust| N[NATS 3-node cluster]
|
||||
SA[sales-pricing] -->|NATS statement| N
|
||||
AC[accounting-export] -->|NATS statement| N
|
||||
E -->|NATS billing| N
|
||||
BAL[account-balance] -->|reply verae.billing.*| N
|
||||
E -->|HTTPS metered| M[verae-middleware]
|
||||
M -->|HTTPS| C[Verae chain]
|
||||
M -->|JetStream| N
|
||||
Z[Zapier cloud] -->|HTTPS plane=zapier| AZ[access-zapier]
|
||||
Web[customer browser] -->|HTTPS plane=web| AW[access-web]
|
||||
API[customer API] -->|HTTPS plane=api| AA[access-api]
|
||||
Leaf[S2S leaf] -->|verae.access.leaf.in| AL[access-leaf]
|
||||
AZ --> Authz[access-authz]
|
||||
AW --> Authz
|
||||
AA --> Authz
|
||||
AL --> Authz
|
||||
CS[staff CS/sales] --> Authz
|
||||
Authz -->|allow| N[NATS cluster]
|
||||
BAL[account-balance] --> N
|
||||
AZ -->|HTTPS| M[verae-middleware]
|
||||
M --> N
|
||||
N --> P[job-poller]
|
||||
N --> W[webhook-deliver]
|
||||
N --> A[archive-aggregator]
|
||||
N --> R[WORM x N]
|
||||
N --> T[tree-node x N]
|
||||
P -->|HTTPS status| C
|
||||
W -->|HTTPS REST Hook| Z
|
||||
N --> R[WORM]
|
||||
N --> T[tree-node]
|
||||
P --> C[Verae chain]
|
||||
M --> C
|
||||
```
|
||||
|
||||
## 8.2 NATS.IO 3-server cluster
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ Operator console (loopback): http://127.0.0.1:3850/ · [CONSOLE.pdf](https://zap
|
|||
|
||||
Prefix: `https://git.georgelambert.org/marchon/`
|
||||
|
||||
overview · verae-nats-process · verae-ops · master-zapier-plan-draft · zappier-edge · verae-middleware · verae-zapier-app · verae-activate · verae-request-splitter · verae-archive-worm · verae-archive-aggregator · verae-tree-node · verae-fleet · verae-zapier-simulator · zapier-user-docs · zapier-docs-master
|
||||
overview · verae-nats-process · verae-ops · master-zapier-plan-draft · zappier-edge · verae-access-authz · verae-access-web · verae-access-api · verae-access-leaf · verae-access-zapier · verae-middleware · verae-zapier-app · verae-activate · verae-request-splitter · verae-archive-worm · verae-archive-aggregator · verae-tree-node · verae-fleet · verae-zapier-simulator · zapier-user-docs · zapier-docs-master
|
||||
|
||||
## Per-module contracts
|
||||
|
||||
|
|
|
|||
3
packages/verae-access-api/NATS.md
Normal file
3
packages/verae-access-api/NATS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# NATS — verae-access-api
|
||||
|
||||
Plane `api`. Ingress `verae.access.api.*`. Authz then statement.get / usage.recorded / jobs.watch. Never archive or credits.
|
||||
11
packages/verae-access-api/README.md
Normal file
11
packages/verae-access-api/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# verae-access-api
|
||||
|
||||
**Direct customer API** plane (`x-api-key`). Separate from the Zapier Platform app.
|
||||
|
||||
**Forgejo:** https://git.georgelambert.org/marchon/verae-access-api
|
||||
|
||||
Address path: `verae.access.api.*` → `verae.access.authz.check` → `verae.billing.statement.get` / `verae.zapier.jobs.watch` (HTTPS to middleware, not a Zapier NATS client).
|
||||
|
||||
Cannot `balance.adjust` or `archive.put`.
|
||||
|
||||
Port `:3022`.
|
||||
11
packages/verae-access-api/package.json
Normal file
11
packages/verae-access-api/package.json
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"name": "verae-access-api",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"description": "Direct customer API access plane (x-api-key, not Zapier)",
|
||||
"scripts": {
|
||||
"start": "node src/server.js",
|
||||
"test": "node --test test/*.test.js"
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue