Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -5,7 +5,7 @@
|
||||
**Last revised:** 2026-05-19
|
||||
**Status:** **Initial cut for B-006 audit-package.** Findings here are the gaps the agent identified during the threat-model + attack-surface authoring pass. They are NOT a substitute for the external pen-test; they are the input the auditor receives to know what we already know.
|
||||
|
||||
Each finding maps back to an asset in `docs/security/plugin-threat-model.md` (`A-NN`) and a folder-per-finding in `docs/improvement-plan/06-plugin-system/security-findings/F-NNN-…md` if/when it reaches Critical / High status.
|
||||
Each finding maps back to an asset in `docs/security/plugin-threat-model.md` (`A-NN`) and to a follow-up ticket if/when it reaches Critical / High status.
|
||||
|
||||
Severity scale here: **Critical** = production-blocker, **High** = remediate before sign-off, **Medium** = remediate or document as accepted residual, **Low** = backlog.
|
||||
|
||||
@@ -17,7 +17,7 @@ Severity scale here: **Critical** = production-blocker, **High** = remediate bef
|
||||
| ----- | ---------- | ---------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| F-001 | Medium | A-02 | **backend closed 2026-05-19; list-level UI closed 2026-05-26; nonrepudiation metadata closed 2026-05-28; guided dialog deferred** | `TenantPluginCapabilityGrant` Prisma model + migration `20260519010000_06_plugin_capability_grant`. `grantPluginCapabilities` service upserts one row per (tenant, plugin, capability); rejects capabilities not declared in the manifest. `enablePlugin` runs `assertConsentSatisfied` and refuses to flip Plugin.enabled=true until every declared capability has a grant (`capability_consent_missing` → HTTP 409). Disable always allowed (kill-switch parity). Route exposes `POST ?op=grant` with `{ pluginId, grants[] }`. Env opt-out `PLUGIN_REQUIRE_CAPABILITY_CONSENT=false` for back-compat dev/test. Tenant settings now requires a reviewed-capabilities checkbox and server-generated manifest digest before writing missing grants; stale manifests are rejected. Grant audit events include plugin version, review digest, approved capability names, approved scope JSON, and the matching manifest scope snapshot. A fuller guided tenant-admin consent dialog remains deferred. |
|
||||
| F-002 | Medium | A-01, A-11 | **partially closed 2026-05-27; Wasmtime track remains external hardening** | Plugin invocation now runs in a killable worker-thread sandbox and enforces `PLUGIN_MAX_WALL_CLOCK_MS` (default 5000 ms) with `worker.terminate()`, so a pure-WASM loop with zero host calls no longer blocks the parent worker indefinitely. Remaining hardening: V8 WebAssembly still lacks per-instruction fuel/epoch interruption, so CPU accounting is wall-clock coarse and a future Wasmtime/Component-Model runtime remains the preferred security-audit upgrade path. Keep tight `PLUGIN_MAX_FUEL`, per-plugin worker concurrency, and BullMQ job timeouts in production. |
|
||||
| F-003 | Low | A-05 | **closed 2026-05-19; operator verifier shipped 2026-05-29** | Per-tenant hash chain landed: `PluginCapabilityUse.prevHash` + `rowHash` columns (migration `20260519000000_06_plugin_capability_use_chain`), canonical-form spec in `packages/plugin-runtime/src/audit-chain.ts` (10-field deterministic encoding, SHA-256), worker handler stamps both columns per batch with optional `getChainHead` seam so chains span batches. `verifyPluginCapabilityUseChain` walks an ordered slice and reports first break with `prev_mismatch` / `row_hash_mismatch`. Chain-helper, handler, and CLI tests cover stamping, cross-batch seeding, soft-fail on `getChainHead` error, intra-batch threading, tamper/deletion detection, and operator verification through `toolctrl-cli plugins verify-audit-chain <tenantId>`. Pre-F-003 rows are skipped without flagging. A production web endpoint remains deferred; the operator CLI is the supported verification surface. |
|
||||
| F-003 | Low | A-05 | **closed 2026-05-19; operator verifier shipped 2026-05-29** | Per-tenant hash chain landed: `PluginCapabilityUse.prevHash` + `rowHash` columns (migration `20260519000000_06_plugin_capability_use_chain`), canonical-form spec in `packages/plugin-runtime/src/audit-chain.ts` (10-field deterministic encoding, SHA-256), worker handler stamps both columns per batch with optional `getChainHead` seam so chains span batches. `verifyPluginCapabilityUseChain` walks an ordered slice and reports first break with `prev_mismatch` / `row_hash_mismatch`. Chain-helper, handler, and CLI tests cover stamping, cross-batch seeding, soft-fail on `getChainHead` error, intra-batch threading, tamper/deletion detection, and operator verification through `hivegrid-cli plugins verify-audit-chain <tenantId>`. Pre-F-003 rows are skipped without flagging. A production web endpoint remains deferred; the operator CLI is the supported verification surface. |
|
||||
| F-004 | (reserved) | — | — | placeholder for IDs that get split out from F-005. |
|
||||
| F-005 | High | A-02, A-08 | **closed 2026-05-19 (Phase A + Phase B)** | Phase A (commit `5d9b97cd`): trust-store gate + signedBy/key match. Phase B (this commit): install path now reads the .wasm binary from `PLUGIN_BINARY_BASE_PATH/<id>/<version>/plugin.wasm` and runs `verifyPluginSignature` against the manifest. Rejects with `binary_not_found` (404), `binary_verification_failed` (403), or `signature_key_*` (403). Dev escape via `PLUGIN_INSTALL_SKIP_BINARY_VERIFY=true` documented as non-production. 4 new tests with temp-dir fixture cover missing binary, hash mismatch, submitted-sha-vs-manifest-sha mismatch, and the escape hatch. |
|
||||
| F-006 | Low | A-06 | **closed 2026-05-19** | Stage-2 token-aware scan landed in `migrations.ts`: `tokenizeSqlIdentifiers` walks the SQL respecting single-quoted strings, double-quoted identifiers, dollar-quoted strings, line comments, and block comments. `findForbiddenKeyword` scans the identifier stream for DROP DATABASE / GRANT / REVOKE / TRUNCATE / SET ROLE / PG\_\*. Replaces the previous substring-only check (which both false-positived on string-literal content AND was bypassable through obfuscation). 7 new tests cover string-literal isolation, dollar-quote isolation, comment isolation, keyword detection, and the previously-broken DEFAULT-with-grant false-positive case. Stage-1 substring scan retained as belt-and-braces; only fires when a forbidden token appears OUTSIDE every string literal. |
|
||||
@@ -26,11 +26,11 @@ Severity scale here: **Critical** = production-blocker, **High** = remediate bef
|
||||
| F-009 | Medium | A-07 | **closed 2026-05-19** | `installPlugin` now rejects when the tenant has reached `PLUGIN_MAX_INSTALLS_PER_TENANT` (default 50; set to 0 to disable). New code `tenant_install_limit_exceeded` → HTTP 429. 3 new tests. |
|
||||
| F-010 | Low | A-08 | closed (test landed 2026-05-19, commit `bf639ac7`) | CSRF body-consumption regression — verified safe when `x-csrf-token` header is set; install route documents this contract. Negative-path test confirms a clean error (not the opaque undici `TypeError: unusable`) when callers omit the header. |
|
||||
| F-011 | Medium | A-08 | **closed 2026-05-19** | Install route now runs a SharedStore sliding-window rate limiter (`createSlidingWindowRateLimiter`) keyed on `tenant:<id>`. Default `PLUGIN_INSTALL_RATE_LIMIT_PER_MIN=5`; over-limit returns 429 + `Retry-After: 60`. Production fails closed on infra errors unless `PLUGIN_RATE_LIMIT_FAIL_OPEN=true` is explicitly configured; non-production remains fail-open for operator ergonomics. 3 new tests cover allowed/denied/infra-error paths. |
|
||||
| F-012 | Medium | A-09 | **closed 2026-05-26** | Plugin hook fanout is now wired: `plugin.hook.*` outbox events route to `outbox.plugin-hook`, the general worker's `plugin-hook-fanout` consumer scopes enabled-plugin lookup by `tenantId`, filters manifest-declared hooks, and enqueues one idempotent `toolctrl.plugin-invoke` job per subscriber. Sandbox execution remains isolated on `WORKER_QUEUE_GROUP=plugin`. The fanout path is tenant-scoped and does not cross tenant boundaries. |
|
||||
| F-012 | Medium | A-09 | **closed 2026-05-26** | Plugin hook fanout is now wired: `plugin.hook.*` outbox events route to `outbox.plugin-hook`, the general worker's `plugin-hook-fanout` consumer scopes enabled-plugin lookup by `tenantId`, filters manifest-declared hooks, and enqueues one idempotent `hivegrid.plugin-invoke` job per subscriber. Sandbox execution remains isolated on `WORKER_QUEUE_GROUP=plugin`. The fanout path is tenant-scoped and does not cross tenant boundaries. |
|
||||
| F-013 | Low | A-10 | **accepted-residual 2026-05-19** | A tenant user with control over plugin input can drive their own plugin to auto-disable. Confirmed not a privilege escalation: the threat-model invariant is that disabling a plugin for one's own tenant is not a security boundary. Documented in plugin-threat-model.md A-10 "Elevation" row. |
|
||||
| F-014 | Medium | A-12 | **closed 2026-05-19** | `sanitizePluginOutput` now carries a total-bytes budget across the walk (default 1 MiB, env override `PLUGIN_SANITIZE_TOTAL_BUDGET_BYTES`). Once exhausted further string leaves become `[SIZE_LIMIT]` markers. The output-size budget is closed; the remaining caveat is regex-based sanitization for encoded secrets. 4 new tests cover budget exhaustion in objects + arrays, default-fits cases, and invalid-env fallback. |
|
||||
| F-015 | Critical | A-13 | **bootstrap wiring closed 2026-05-26; production runtime gate remains B-006** | Handler now dispatches to `handlePluginInvokeJob` when `pluginInvokeDeps` is injected; throws (fail-loud, BullMQ dead-letters) when not. `apps/worker/src/index.ts` composes production deps when `WORKER_QUEUE_GROUP=plugin`. Bootstrap module `apps/worker/src/jobs/plugin-invoke-bootstrap.ts` wires Prisma `loadPlugin`, filesystem `loadBinary` (from `PLUGIN_BINARY_BASE_PATH/<id>/<version>/plugin.wasm`), `verifyPluginSignature`, SharedStore sliding-window rate-limit, sandbox+gateway `invokeInSandbox`, log-based `recordAudit`, and SharedStore crash-tracker. Remaining signoff is the broader production WASM runtime review, not the SharedStore limiter wiring. Host-fns for the 9 declared capabilities remain empty — any capability call denies via `no_host_implementation` through the gateway (intentional foundation scope). |
|
||||
| F-016 | Low | A-14 | **documented 2026-05-19** | The stale runtime-enable toggle has been replaced by the current production gate: `PLUGIN_RUNTIME_PRODUCTION_ENABLED=true` is required before tenant plugin runtime operations are allowed in production. Emergency stop remains operational: stop/scale `worker-plugin`, pause/drain `toolctrl.plugin-invoke`, and disable affected plugins through lifecycle controls. |
|
||||
| F-016 | Low | A-14 | **documented 2026-05-19** | The stale runtime-enable toggle has been replaced by the current production gate: `PLUGIN_RUNTIME_PRODUCTION_ENABLED=true` is required before tenant plugin runtime operations are allowed in production. Emergency stop remains operational: stop/scale `worker-plugin`, pause/drain `hivegrid.plugin-invoke`, and disable affected plugins through lifecycle controls. |
|
||||
| F-017 | High | A-02 | closed (commit `0b2995ad`, 2026-05-19) | Schema widened to declare optional `minHostVersion` / `maxHostVersion`. `PluginLifecycleService.extractVersionConstraints` is now redundant (the parsed manifest already carries the fields) but remains harmless; consider collapsing in a follow-up. |
|
||||
| F-021 | Medium | A-06 | **closed 2026-05-19** | `validateCreateTable` now requires `tenantId` to appear as a column-definition header (preceded by `(` or `,`, optionally double-quoted, followed by whitespace before the type). Column comments / DEFAULT literals containing the word `tenantId` no longer satisfy the check. 5 new tests cover the positive + negative paths. |
|
||||
| F-022 | Medium | A-08 | **closed 2026-05-26** | Plugin lifecycle routes now split the broad account-settings permission into `app.plugins.use` for read/list/audit surfaces and `app.plugins.manage` for install, capability grant, enable, and disable. Default seeds assign manage to SuperUser/Admin and use to all default app roles. |
|
||||
@@ -205,7 +205,7 @@ Historical reproduction only:
|
||||
|
||||
## Other findings (Medium / Low)
|
||||
|
||||
The remaining findings F-001, F-002, F-003, F-006, F-007, F-008, F-009, F-011, F-013, F-014, F-016, F-018, F-019, F-020 are tracked in the summary table above. Each becomes a stub file under `docs/improvement-plan/06-plugin-system/security-findings/F-NNN-….md` if and when it is scheduled for remediation.
|
||||
The remaining findings F-001, F-002, F-003, F-006, F-007, F-008, F-009, F-011, F-013, F-014, F-016, F-018, F-019, F-020 are tracked in the summary table above. Each becomes a follow-up ticket if and when it is scheduled for remediation.
|
||||
|
||||
---
|
||||
|
||||
@@ -215,4 +215,4 @@ The remaining findings F-001, F-002, F-003, F-006, F-007, F-008, F-009, F-011, F
|
||||
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------- |
|
||||
| 2026-05-19 | Initial 20-finding cut produced during threat-model pass. F-005/F-010/F-015/F-017 flagged as High for sign-off remediation. | Claude Opus 4.7 (1M context) |
|
||||
| 2026-05-19 | Self-audit pass. F-017 closed via commit `0b2995ad` (schema widened). F-010 closed via commit `bf639ac7` (regression test landed; route confirmed safe under `x-csrf-token` header contract). F-005 confirmed open + concrete remediation plan added (trust-store gate as Phase A, in-PR scope; binary-positioning gate as Phase B, out of scope). F-015 **escalated High → Critical** during this pass because production plugin invoke wiring and rate limiting still needed proof at that point. Three new findings added: F-021 (migration tenantId-column regex bypass, Medium), F-022 (permission conflation across all plugin lifecycle ops, Medium), F-023 (sanitize missing circular-reference guard, Medium). | Claude Opus 4.7 (1M context) |
|
||||
| 2026-05-26 | Docs sync: F-012 updated to closed after `plugin.hook.*` events gained the `outbox.plugin-hook` route and the general-worker `plugin-hook-fanout` consumer that enqueues tenant-scoped `toolctrl.plugin-invoke` jobs for manifest-declared subscribers. | Codex |
|
||||
| 2026-05-26 | Docs sync: F-012 updated to closed after `plugin.hook.*` events gained the `outbox.plugin-hook` route and the general-worker `plugin-hook-fanout` consumer that enqueues tenant-scoped `hivegrid.plugin-invoke` jobs for manifest-declared subscribers. | Codex |
|
||||
Reference in new issue
Block a user