Updated: 2025-08-27
This document describes the security measures implemented in Aetherra OS and Lyrixa today, how to configure them, and what’s planned next. It is grounded in the current codebase and tests to avoid over‑claiming.
- Least privilege and safe-by-default
- Verify what runs: signatures, static checks, auditability
- Opt-in telemetry and privacy first
- Defense in depth with graceful fallbacks in dev
- Script signing (.aether): Done (HMAC-SHA256, strict mode available)
- Plugin manifest signing (ed25519): Partial (strict toggle; PyNaCl optional)
- Secrets (API keys): Improved (file store + env override; rotation and leak checks; encrypt-at-rest optional via master key)
- Sandbox for eval: Partial (best-effort Python AST/eval restrictions; containers/policy engine planned)
- Security scans (keys/memory/files/network): Done (periodic, alerting + auto-cleanup hooks)
- Prompt injection defenses: New (heuristic scanner with high‑risk short‑circuit)
- Capability enforcement: New (deny-by-default option with policy file)
- Network policy: New (domain allow/deny with strict mode + safe HTTP wrappers)
- Telemetry privacy: Partial (opt-in enforced by tests; minimal counters)
- Audit and static risk for .aether: Done (report + thresholds; strict signature verify optional)
-
API key store:
Aetherra/security/api_keys.py- Stores keys in user config dir:
~/.aetherra/keys.json(Windows-friendly path), with an in-memory cache. - Env override: any key can be provided via
AETHERRA_<NAME>environment variable; env wins over file. - Operations:
get_key(name),set_key(name, value),delete_key(name),get_key_scoped(name, requester). - Encrypt-at-rest (optional): set a Fernet master key via env
AETHERRA_KEYS_MASTERor file~/.aetherra/keys_master.key.- When a master key is present, keys are stored encrypted with structure
{ "__encrypted__": true, name: {"cipher": "..."} }. - Utility:
ensure_master_key()will generate and persist a master key file and auto-upgrade existing plaintext entries.
- When a master key is present, keys are stored encrypted with structure
- Scoped access: deny-by-default when a
requesteris specified unless allowed by~/.aetherra/policy/keys_policy.json.
- Stores keys in user config dir:
-
Rotation and leak checks:
Aetherra/aetherra_core/system/security_system.py- Rotation advisory based on age (configurable
api_key_rotation_days, default 30 days). - Leak checks scan environment variables and common files for “api_key”/“secret” strings.
- File permission checks on sensitive paths (e.g.,
.aetherra/secure,.aetherra/keys).
- Rotation advisory based on age (configurable
-
.aether script signing:
Aetherra/security/script_signing.py- HMAC-SHA256 over the script body; signature embedded in first line as
# @signature: <hex>. - Secret source: API key store (
aether_script_signing_secret) or dev fallback. - Strict verification gate: set
AETHERRA_SCRIPT_VERIFY_STRICT=1or pass--strictto the verifier. - Tooling:
tools/verify_aether_scripts.pygeneratesaether_static_report.md, enforces thresholds, and validates signatures when strict.
- HMAC-SHA256 over the script body; signature embedded in first line as
-
Plugin manifest signing:
Aetherra/security/plugin_signing.py- Ed25519 signatures via PyNaCl when available; permissive fallback otherwise.
- Strict mode:
AETHERRA_SIGNING_STRICT=1makes unsigned/invalid manifests fail. - Revocation: checks
~/.aetherra/revocations.jsonfor revoked pubkeys/key_ids. - Transparency log: appends JSONL entries to
~/.aetherra/signing_log.jsonlon sign. - Optional integrity: when
code_hashandcode_filesare present in the manifest, verify SHA256 over the file list.
-
Sandbox (best-effort):
Aetherra/security/sandbox.pysafe_evaluses AST checks to disallow dangerous nodes; tight builtin whitelist.- Intended for small arithmetic/logic expressions only; not a general-purpose sandbox.
- Strong isolation (containers/VMs/policy engine) is recommended for untrusted plugins (planned).
- Quotas available:
run_with_timeout(wall-clock) andensure_memory_budget(RSS best-effort); exceptionsTimeBudgetExceededandMemoryBudgetExceededraised on violations.
-
Capability/permissions model (policy):
- Coding System spec establishes deny-by-default capabilities for plugins and policy‑mediated file/network/process access.
- Implementation:
Aetherra/security/capabilities.pywith optional strict mode viaAETHERRA_REQUIRE_CAPABILITIES=1and policy file~/.aetherra/policy/capabilities.json: { "allow": { "core:webhook_manager": ["network:outbound", "network:webhook"] } } - Wired example:
Aetherra/core/webhook_manager.pychecks capabilitynetwork:webhookbefore firing.
- Security System Orchestrator:
Aetherra/aetherra_core/system/security_system.py- Periodic scans (threaded): API keys, memory, files, network → alerts and auto‑cleanup hooks.
- UI alerts feed: JSONL appended at
.aetherra/security/alerts.jsonlfor recent alerts display. - Memory protection: integrates with the core
MemoryManagerfor usage stats; high-usage log notice. - File system scanning: flags suspicious extensions/patterns and permissive permissions.
- Network: placeholder open‑port checks (extend per deployment).
- Logging: security/audit files under
.aetherra/security/.
- Module:
Aetherra/security/prompt_defense.py- Heuristic pattern-based scanner detects jailbreak/injection phrases and scores risk.
- Integrated into
Aetherra/core/chat_router.py: high-risk (>= 0.6) short-circuits with a guarded response and emits a security alert if the orchestrator is available.
- Module:
Aetherra/security/net_policy.py- Policy file
~/.aetherra/policy/net_policy.jsonwithallow_domains/deny_domains. - Strict mode via
AETHERRA_NET_STRICT=1denies non-allowlisted domains. - Safe wrappers
http_get/http_postenforce policy and timeouts; used byAetherra/core/webhook_manager.py.
- Policy file
-
Opt-in telemetry (tests):
tests/unit/test_telemetry_optin.py- Telemetry ingestion/stats exist in the Hub; opt‑in is enforced by environment/config (module:
Aetherra.telemetry.optin). - Defaults are conservative; tests verify explicit opt‑in is respected.
- Differential Privacy: runtime‑toggleable via Lyrixa Settings (Enable DP + epsilon). Backend applies via
Telemetry.set_dp(enabled, epsilon)and persists DP flags to~/.aetherra/telemetry.json. - Redactions and noise: filters out
content,prompt,message; redacts common IDs; applies Laplace noise to numeric fields when DP is enabled.
- Telemetry ingestion/stats exist in the Hub; opt‑in is enforced by environment/config (module:
-
Audit ledger for .aether runs
- When enabled, execution emits anonymized traces and audit records (see Coding System spec). Redaction hooks prevent sensitive content leakage in logs.
- Strict signing for plugins: set
AETHERRA_SIGNING_STRICT='1'. - Strict signature verification for .aether: set
AETHERRA_SCRIPT_VERIFY_STRICT='1'. - Strict require semantics in generated .aether:
AETHERRA_REQUIRE_STRICT='1'. - Capabilities strict mode:
AETHERRA_REQUIRE_CAPABILITIES='1'(deny-by-default without explicit grants). In production profile (AETHERRA_PROFILE=prod|production), this is enforced by default. - Network strict mode:
AETHERRA_NET_STRICT='1'(deny-by-default for non-allowlisted domains). In production profile, strict mode is enabled by default; when no policy file exists, a safe allowlist is assumed:localhost,127.0.0.1,.aetherra.dev. - Deterministic/test profiles: see Coding/Memory specs (e.g.,
AETHERRA_PROFILE=test).
VS Code Tasks (Terminal → Run Task):
- “Aether Verify (Quick, Test Profile)” → static .aether checks and signature validation (test profile).
- “Aether Verify (Strict Signatures)” → strict signature checks across
.aetherfiles.
PowerShell examples:
$env:AETHERRA_SCRIPT_VERIFY_STRICT='1'; python tools/verify_aether_scripts.py --strict --output aether_static_report.md
$env:AETHERRA_SIGNING_STRICT='1'; pytest -q tests/test_hub_signing.py tests/test_discovery_signing.py
# Bootstrap policy files (capabilities and network) with safe defaults
python -m Aetherra.cli.policy_bootstrap --all
python -m Aetherra.cli.policy_bootstrap --network --allow api.example.com .corp.example- .aether static risk report:
aether_static_report.md(generated bytools/verify_aether_scripts.py). - Security logs:
.aetherra/security/security.logand.aetherra/security/alerts.log. - Docs verification: “Verify Docs Consistency” task checks env and endpoint references across docs.
Lyrixa UI: Security Alerts panel displays
.aetherra/security/alerts.jsonlin real time via the web bridge.
Alerts CLI (view recent and follow live):
- Module:
Aetherra/cli/alerts.py - Show last N alerts (PowerShell):
python -m Aetherra.cli.alerts --recent 30- Follow the live feed (Ctrl+C to stop):
python -m Aetherra.cli.alerts --follow- Custom path (defaults to
./.aetherra/security/alerts.jsonl):
python -m Aetherra.cli.alerts --path C:\path\to\alerts.jsonl --recent 50- API key storage is plaintext today. Recommended mitigations: provide keys via environment variables or integrate an OS keychain/secret manager. A built‑in encrypt‑at‑rest option (e.g., keyring/cryptography) is planned.
- The Python sandbox is intentionally narrow and not a substitute for containerization/VMs; stronger isolation and a central policy engine are planned.
- Recommended deployment tier for untrusted plugins: containerized plugin runner (per-plugin process/container boundary with network/FS policies). This is the suggested production posture until the integrated isolation layer ships.
- Network/TLS hardening depends on deployment; add reverse proxy/TLS termination and CORS policies per environment.
- Capability enforcement is partly policy/docs‑level; wire stricter checks into plugin execution and hub operations over time.
- API keys:
Aetherra/security/api_keys.py - Script signing (.aether):
Aetherra/security/script_signing.py,tools/verify_aether_scripts.py, tests intests/unit/ - Plugin signing (ed25519):
Aetherra/security/plugin_signing.py, hub/discovery teststests/test_hub_signing.py,tests/test_discovery_signing.py - Security orchestration:
Aetherra/aetherra_core/system/security_system.py - Sandbox:
Aetherra/security/sandbox.py - Prompt injection:
Aetherra/security/prompt_defense.py, integration inAetherra/core/chat_router.py - Capabilities:
Aetherra/security/capabilities.py, usage inAetherra/core/webhook_manager.py - Network policy:
Aetherra/security/net_policy.py, usage inAetherra/core/webhook_manager.py - Telemetry (opt-in):
Aetherra/telemetry/optin.py(referenced by tests),tests/unit/test_telemetry_optin.py - Policy/guardrails overview:
docs/AETHERRA_CODING_SYSTEM.md
See also:
- Aetherra Coding System:
docs/AETHERRA_CODING_SYSTEM.md - Aetherra Memory System:
docs/AETHERRA_MEMORY_SYSTEM.md - Security policy for reporting:
SECURITY.md