Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Heuristic:1ay1 Agentty Defense In Depth

From Leeroopedia
Knowledge Sources
Domains Security, Authentication
Last Updated 2026-10-28 14:00 GMT

Overview

Layer multiple independent security controls (OS keystore + file encryption + process lock) so that a failure or bypass of any single layer does not compromise the system.

Description

The Defense_In_Depth heuristic requires that sensitive operations (credential storage, OAuth token handling) are protected by multiple independent layers, each of which must be independently bypassed for an attack to succeed. A single layer of defense is a single point of failure: if that layer has a bug or is misconfigured, the system is fully exposed. Multiple independent layers (OS-native keystore, at-rest file encryption, cross-process locking, permission-tiered access) mean that a bug in one layer is caught by another.

In agentty this appears in: the OS-native keystore (`keystore.hpp`) which layers OS keychain access on top of file-based storage; and the MCP OAuth login (`oauth.hpp`) which layers token validation on top of the transport security.

Usage

Apply this heuristic when designing security-critical paths (credential storage, authentication flows, sensitive file access). For each path, ask: how many independent controls must fail for an attack to succeed? If the answer is one, add more layers. Each layer should be independent — a bug in one should not disable the others.

The Insight (Rule of Thumb)

  • Action: Layer multiple independent security controls for sensitive operations.
  • Value: OS keystore + file encryption + process lock + permission tiers — each must be independently bypassed.
  • Trade-off: More complexity and potential for false negatives; but a single layer failure does not compromise the system.
  • Compatibility: Pairs with Heuristic:1ay1_Agentty_Fail_Closed_Refuse_Default for layer defaults.

Reasoning

A single security layer is a single point of failure. If the file encryption key is leaked, the encrypted credentials are exposed. If the OS keystore has a bug, the credentials are exposed. By layering independent controls — OS keystore AND file encryption AND process locking AND permission tiers — an attacker must bypass every layer simultaneously. Each layer is independently developed and maintained, so a bug in one is unlikely to correlate with a bug in another. The probability of all layers failing simultaneously is the product of individual failure probabilities, which is dramatically lower than any single layer.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment