feat: add approval bound full maintenance script console and executors
Rust development slice / linux (push) Failing after 6s

This commit is contained in:
2026-11-14 16:35:11 +01:00
parent 287a784c8f
commit ff78b6a498
51 changed files with 8880 additions and 278 deletions
+63 -6
View File
@@ -1,6 +1,6 @@
# Linux-MVP WebUI
React/TypeScript, no runtime demo data, no desktop/terminal/hypervisor integration.
React/TypeScript, no runtime demo data, no desktop/PTY/hypervisor integration.
Build assets: **`web/dist/`**; serve `index.html` and `/assets/*` from the TLS backend
on the same origin. Do not proxy authentication to a different origin. All API URLs
are relative; cookies use `credentials: same-origin`, mutations use `X-CSRF-Token`.
@@ -10,8 +10,64 @@ No token or password persistence, raw HTML rendering, automatic approval or retr
From `web/`: `npm ci`, `npm run typecheck`, `npm test`, `npm run build`.
`npm run dev` binds loopback, but is not the authenticated TLS acceptance setup.
The authoritative runtime is the backend serving `web/dist` at
`https://rmm-dev.internal:18443`. No certificate-verification bypass is supported.
The current server is `discovery.ease-technologies.de`; management access uses the
configured SSH tunnel and verified TLS. Earlier local `rmm-dev.internal:18443`
examples below are historical. The notebook is development only, without an RMM
server or enrolled agent. No certificate-verification bypass is supported.
## Script console (specification 1.20, source implementation)
`run_script` remains a durable plan/request, not a PTY or interactive terminal.
The planner accepts complete fixed POSIX/Bash or Windows PowerShell5.1 scripts.
The optional action-wide `parameters.privileged_script_profile` is exactly
`full_maintenance_v1`; missing preserves the existing bounded mode, while present
null/unknown values fail. Full maintenance requires root on Linux or SYSTEM on
Windows, plus `scripts:execute` and the separate root/system scope. SYSTEM scripts
require the explicit profile. The UI selection grants no permission: central/local
opt-in, target capabilities, independent helper checks and actual WebUI approval
remain necessary. Full authority includes filesystem, network and services, and
can alter the agent/PKI or cause a reboot. It has no sandbox/no-reboot promise.
The profile budgets are Linux 1–300s, Windows 1–120s, at most 32768 script bytes
and 65536 output bytes. RemoteSigned, when explicitly bound, remains limited to
the approved Windows job process.
Before submit/approval, `src/script-console.ts` projects every script from the
SHA256-verified stored plan bytes. It checks full payload structure, fixed
target/job/attempt IDs, script SHA256 and the job SHA256 reconstructed in Rust
declaration order. Every supplied payload/target alias must agree. It snapshots
the checked views, rejects later mutation and rechecks immediately before each
submit/approval action. The displayed script, arguments, identity, profiles,
budgets, deadlines and hashes come from that projection, never the draft editor.
Control characters, CR, BOM and bidi controls are made visible in the text view;
the full original JSON and stored bytes remain available. Existing pending-only
submission and interactivity/CSRF checks remain in force.
`src/console-output.tsx` displays the actual stored job status and final stdout/
stderr. Status polling is every four seconds; output arrives with the durable
result. There is no incremental output stream. Null result, empty output,
unknown exit code, unknown outcome, requested cancellation and truncation are
distinct. UTF-8 is a display attempt, not a claimed source encoding; invalid
UTF-8 is marked and original bytes can be downloaded as inert `.bin` files.
Terminal escapes and bidi controls are visible, never interpreted. Agent output
is React text and cannot create HTML, approval controls or follow-up jobs.
MCP already dispatches plan/submit/read-results to the same server application
functions. Shared PlanRequest/Action schemas expose the profile; MCP has no
approval tool and its bearer context cannot become an interactive approval
session. No independent MCP execution or approval path was added.
Local typechecking and renderer tests are source evidence only. Native Linux/
Windows runs, deployment and actual UI/MCP acceptance remain separate gates.
Actually executed on 2026-11-14 for this source slice: `npm ci --ignore-scripts
--no-audit --no-fund`, `npm run typecheck`, `npm test` (49 passed across seven
files), `npm run build` (TypeScript and Vite passed). Five script-console tests
read `../tests/script_console/codec-golden.json` directly: the same three actual
Rust codec families cover legacy Linux agent, Linux root/full and Windows
SYSTEM/full with RemoteSigned. Checks cover full displayed script/target/attempt/
profile/budgets/hashes, all aliases, mutation during/after verification and
independent scopes. Two output tests cover hostile HTML/terminal/bidi bytes,
unknown/cancellation/truncation, invalid encodings and absent/invalid results.
No browser, server, VM job, approval or deployment was executed in these checks.
## JSON adapter contract
@@ -70,9 +126,10 @@ All business endpoints are under `/api/v1/tenants/{tenant}`:
asset_id can also come from the exact payload. Every target requires a nonempty
exact payload and payload hash; preview coverage must equal the fixed target set,
duplicate asset IDs and contradictory payload asset IDs are rejected.
`job_id`/`attempt_id` are **not prerequisites** for planning, submission or approval:
if present they are optional fixed plan references, not proof of executable jobs
or persisted attempts. Actual jobs/attempts are created only after approval.
Script plans require the reserved `job_id`/`attempt_id` from the exact stored
payload, as well as matching script/job hashes. These are fixed definitions,
not proof of executable jobs or persisted attempts. Actual execution rows are
created only after approval.
Exact payload metadata and script/package hashes must be included. UI does not
recompute the plan hash from JSON. Missing fixed targets/previews/payload/hash or
excluded targets block submission and approval. All fields are shown, not just