Security · v1.2
The agent proposes. Deterministic code decides.
LokiAI separates reasoning from authority. Coding agents investigate and propose. LokiAI authenticates, authorises, executes, observes and records. People keep final authority over consequential actions.
- Design document
- Draft for human acceptance
- No external audit cited
01Trust boundaries
Five places, each with its own limits
Anything crossing a boundary needs runtime schema validation, authorisation, size and time bounds, redaction and structured errors.
- 01
Renderer
Untrusted presentation code. Sandboxed, no Node.js, no filesystem, shell, serial or credential access.
- 02
Electron main
Owns the window, external-browser sign-in, updates and a narrow, typed preload bridge. Validates every IPC sender.
- 03
Rust runtime
The authority boundary. Policy, approvals, durable jobs, connectors and encrypted local storage.
- 04
MCP server
One provider-neutral server. Authenticates every runtime connection and exposes fixed, scoped tools.
- 05
Build executor
Separate and contained. Runs repository code and toolchains with no secrets, devices or runtime access.
02Approval contract
Approval is bound to what will run
Approval depends on the operation, target, environment, scope, digest and policy. It does not depend on which button or agent asked.
What the hash covers
- Operation name and schema version
- Workspace and environment
- The exact device target snapshot
- The exact artifact, config or model digest
- Normalised parameters
- Requester and agent run
- Policy version and risk
- Preflight result digest
- Expected effect and downtime
- Verification and rollback plan
- Creation and expiry time
- The request is hashed. Execution recomputes the hash and compares it.
- An approval is single-use and consumed when execution begins.
- An agent cannot approve its own request.
- A button click without a stored approval record is not enough.
- Expired, denied, used, changed or differently scoped approvals fail closed.
- Emergency recovery is its own explicit policy, never a quiet bypass.
03Device-operation safety
Ten steps before and after any change
A device that ends in an unknown state is quarantined. It accepts no further destructive job until identity and state are reconciled.
- 01
Re-identify the physical target.
- 02
Confirm connector, version, capability and an exclusive lease.
- 03
Check power, transport, boot and recovery preconditions.
- 04
Verify artifact type, digest, compatibility, provenance and size.
- 05
Re-evaluate policy and the approval binding.
- 06
Save a recoverable job checkpoint.
- 07
Run with timeouts, progress bounds and safe cancellation points.
- 08
Reconcile identity after restart or reconnect.
- 09
Run operation-specific tests and observation.
- 10
Release the lease only at a terminal state or quarantine.
04MCP security
Tools with fixed shapes
Agents reach LokiAI only through typed tools. Read tools are scoped to the workspace and device. Consequential tools return an approval request or a job ID, never an implied success.
- Local clients use stdio. Remote MCP stays off until it has its own threat model.
- Every tool has a fixed schema, risk class, payload limit, timeout and audit policy.
- No tool takes arbitrary commands, scripts, URLs, ports, device paths or free filesystem paths.
- Repository paths resolve against an approved workspace root with canonical path and symlink checks.
- Tool text from the client cannot change policy or approval state.
- Results are bounded and redacted. Rate and concurrency limits apply per connection, workspace and device.
05Logs and prompt injection
Device text is untrusted
Device logs, repository files, build output, agent messages and cloud labels can all carry instructions meant to trick an agent.
- Evidence is labelled with its source and trust class, and delimited when shown to an agent.
- It is never joined into policy instructions. Authorisation stays in deterministic code, not model judgement.
- Control characters, encoding and size are filtered. Text renders without running HTML.
- Configured secrets and sensitive identifiers are redacted before storage or export.
06Secrets and session
Who holds what
Logout removes renderer access and usable local session state at once, even if revoking in the cloud has to retry.
- Sign-in
- Authorization Code with PKCE in the system browser, never in a privileged window.
- Renderer
- Gets a non-secret session projection only. Refresh tokens stay in OS-protected storage.
- Agents
- Use separate, revocable, workspace-scoped credentials. They never reuse the human token.
- Local data
- Runtime database is fully encrypted, with the key protected by the operating system.
- Logs
- Record credential references and fingerprints, never values.
08Electron baseline
A locked-down window
The design treats these Electron settings as release-blocking. The desktop shell is not built yet.
- Node integration off and context isolation on, in every renderer.
- Renderer sandbox on, with a strict content security policy.
- No remote code, remote preload or runtime-downloaded scripts.
- Unexpected navigation, permissions, downloads and new windows are denied.
- External links open only for HTTPS URLs on exact approved origins.
- No raw ipcRenderer is exposed. One narrow method per use case, with validated input and output.
07Build and supply chain
Repository code never runs in the runtime
Firmware builds run in a dedicated, ephemeral, least-privilege executor with limits on files, network, processes, resources, output and time.
Flash, serial, USB, credential, signing and runtime IPC access is never given to that executor. Its output is quarantined and validated from outside before it becomes an artifact.
- Builds run from an exact source revision with a typed, allowlisted recipe. Command strings are not an input.
- Toolchains are pinned and checksummed or verified by provenance.
- Artifacts are content-addressed by digest. The runtime re-checks digest and target before transfer and apply.
- Signing is separate from the build. Build success does not authorise deployment.
- Releases produce an SBOM and dependency record. Update checks fail closed.
09What is not claimed
Design intent, not verified gates
The security document is a draft that still needs human acceptance. Everything above describes controls the design requires.
- No independent security audit is cited. The design lists one as a release gate, not as done.
- The release gates (Electron, IPC, OAuth, approval, artifact, MCP, database and build tests, plus tests on physical hardware) are requirements to pass, not results.
- The Electron shell, runtime, MCP server and hardware paths are still implementation work, so these controls are not yet running.
- See
SECURITY.mdsection 14 for the full gate list. Treat anything not shown as verified there as unverified.
Check the design against the code
The security architecture is public so you can read it, question it and hold the implementation to it.
