Skip to main content

Security

AgentHiFive is an authority delegation platform -- security is not a feature, it is the product. This section documents the security architecture, encryption strategy, and threat model.

Security Principles

  1. Zero trust for agents. Every agent request is authenticated, authorized against a policy, and audit-logged. No implicit trust.
  2. Least privilege by default. Policies default to deny. Agents only access what is explicitly allowed by allowlists, rate limits, and time windows.
  3. Envelope encryption for secrets. Provider tokens are encrypted at rest using AES-256-GCM with envelope encryption. Key Encryption Keys (KEKs) never leave the KMS boundary.
  4. Audit everything. Every execution, approval, connection change, and policy modification is recorded in an append-only audit log.
  5. Algorithm agility. Encryption envelopes and JWT signatures include algorithm identifiers and version numbers, enabling migration to post-quantum algorithms without re-architecture.

Authentication Model

AgentHiFive uses a layered authentication model:

LayerMechanismPurpose
User authBetter Auth (passkeys, OAuth)Human users accessing the web dashboard.
Session tokensJWTs signed with RS256 via JWKSStateless session validation across services. JWTs have a 5-minute TTL.
Agent authAPI keys (ah5_... prefix)AI agents calling the execution gateway. Scoped to a workspace.
Provider authOAuth 2.0 access/refresh tokensDelegated access to third-party provider APIs (Google, Microsoft, Telegram).
JWT Verification

The API service verifies JWTs by fetching the public key set (JWKS) from the web service. Keys are cached and rotated on a 90-day schedule. Multiple key IDs (kid) are supported simultaneously during rotation.

Key Management Overview

AgentHiFive requires two distinct security systems:

Secrets Management

Application secrets (OAuth client credentials, database passwords, API keys) are stored outside the codebase:

EnvironmentSolution
Development.env files (local only)
SaaS ProductionAWS Secrets Manager or Azure Key Vault
Self-Hosted ProductionHashiCorp Vault or SOPS
Self-Hosted (Simple)Kubernetes Secrets or Docker Secrets

Encryption Key Management

Provider tokens are encrypted at rest using envelope encryption:

EnvironmentKEK ProviderKey Rotation
SaaS ProductionAWS KMSAutomatic (annual)
Self-Hosted ProductionVault TransitVersioned (zero-downtime)
Self-Hosted (Simple)age encryptionManual
DevelopmentHardcoded keyN/A
Production Rule

Never use .env files or hardcoded keys in production (SaaS or self-hosted).

Key Rotation Schedule

AssetFrequencyMethod
KEK (master key)Every 365 daysKMS auto / Vault rotate / age manual
DEK (workspace key)Every 90 daysRe-generate and re-encrypt tokens
JWT signing keysEvery 90 daysNew kid, keep old for verification
OAuth provider tokensOn refreshStandard OAuth refresh flow
Emergency rotationImmediateForce rotate + rewrap all tokens

Next Steps

  • Encryption -- AES-256-GCM envelope encryption and key provider details.
  • Threat Model -- threat analysis, attack vectors, and mitigations.