Skip to main content
Palyra implements a defense-in-depth security architecture designed for local-first agentic workflows. The system ensures that all communication between the daemon, CLI, and external connectors is authenticated via mTLS or cryptographically signed tokens, while sensitive credentials (like LLM API keys) are protected using envelope encryption in a local vault.

Security Architecture Overview

The security posture is divided into three primary layers:
  1. Transport & Identity: Mutual TLS (mTLS) for all gRPC and QUIC traffic, anchored by a device-specific Certificate Authority (CA).
  2. Secret Management: A secure vault that uses ring and chacha20_poly1305 to encrypt data at rest.
  3. Access Control: A principal-based authorization system that uses Cedar policies to govern tool execution and resource access.

Component Relationship

The following diagram illustrates how the security crates interact to provide a unified trust boundary. Security Subsystem Interaction Sources: crates/palyra-identity/src/device.rs#17-21, crates/palyra-vault/src/envelope.rs#14-24, crates/palyra-auth/src/lib.rs#10-21

Identity, mTLS & Pairing

The foundation of Palyra’s security is the DeviceIdentity. Every installation generates a unique Ed25519 signing key and X25519 secret for cryptographic operations crates/palyra-identity/src/device.rs#17-21.
  • Trust Model: Palyra uses a Trust-On-First-Use (TOFU) pairing handshake to establish connections between the daemon and new clients (CLI or Connectors).
  • Transport Security: All internal gRPC communication is wrapped in mTLS using rustls crates/palyra-identity/Cargo.toml#18-18.
  • Fingerprinting: Identities are identified by a SHA-256 fingerprint of the signing public key crates/palyra-identity/src/device.rs#68-71.
For details on the pairing handshake and certificate lifecycle, see Identity, mTLS & Pairing.

Vault & Secret Management

The palyra-vault crate provides encrypted storage for sensitive data. It implements Envelope Encryption, where data is encrypted with a unique Data Encryption Key (DEK), and the DEK is itself encrypted with a Key Encryption Key (KEK) crates/palyra-vault/src/envelope.rs#26-47.
FeatureImplementation
AlgorithmChaCha20-Poly1305 (via ring) crates/palyra-vault/src/envelope.rs#4-4
StorageSQLite-backed encrypted blobs
Key DerivationHKDF for deriving sub-keys crates/palyra-vault/Cargo.toml#12-12
Payload VersioningVersioned EnvelopePayload for migration support crates/palyra-vault/src/envelope.rs#15-15
For details on the encryption primitives and vault CLI commands, see Vault & Secret Management.

Authentication & Access Control

Authentication in Palyra revolves around the Principal. A principal represents an authenticated entity (a user, a specific CLI instance, or a remote node) crates/palyra-auth/src/lib.rs#10-16. Authentication Code Mapping For details on principal types, CSRF protection, and policy syntax, see Authentication & Access Control.

Security Gates & Governance

Palyra maintains a strict security posture through automated gates in the CI/CD pipeline:
  • Fuzzing: Nine cargo-fuzz targets test parsers for A2UI, Webhooks, and Config paths.
  • Dependency Auditing: cargo-deny and osv-scanner are used to prevent supply chain attacks.
  • Static Analysis: Gitleaks and CodeQL scan for secrets and vulnerabilities.
Sources: crates/palyra-auth/src/lib.rs#1-33, crates/palyra-daemon/src/openai_auth.rs#1-187, crates/palyra-vault/src/envelope.rs#1-147, crates/palyra-identity/src/device.rs#1-134

Child Pages