Skip to content

Security Specifications ​

This directory contains security requirements and guidelines for Beancount implementations.

Overview ​

Plain text accounting tools process user-controlled input files. While ledger files are typically local and trusted, implementations MUST handle malformed or malicious input gracefully to prevent:

  • Denial of Service (resource exhaustion)
  • Information disclosure (path traversal)
  • Code execution (plugin sandboxing)

Threat Model ​

See threat-model.md for the complete threat analysis.

Trust Boundaries ​

┌─────────────────────────────────────────────────────────┐
│                    User Environment                      │
│  ┌─────────────┐    ┌─────────────┐    ┌─────────────┐ │
│  │ Ledger File │    │  Includes   │    │  Plugins    │ │
│  │  (trusted)  │───▶│ (semi-trust)│───▶│ (untrusted) │ │
│  └─────────────┘    └─────────────┘    └─────────────┘ │
│         │                  │                  │         │
│         ▼                  ▼                  ▼         │
│  ┌─────────────────────────────────────────────────┐   │
│  │              Beancount Implementation            │   │
│  │  ┌─────────┐  ┌─────────┐  ┌─────────────────┐  │   │
│  │  │ Parser  │  │ Loader  │  │ Plugin Runtime  │  │   │
│  │  └─────────┘  └─────────┘  └─────────────────┘  │   │
│  └─────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────┘

Security Topics ​

Input Handling ​

TopicDescriptionSpec
Input LimitsSize, line length, file countMUST
Memory LimitsMemory usage boundsSHOULD
Nesting LimitsRecursion depth limitsMUST

Parsing ​

TopicDescriptionSpec
ReDoSRegular expression denial of serviceMUST
Stack OverflowParser stack exhaustionMUST

File Includes ​

TopicDescriptionSpec
Path TraversalDirectory escape preventionMUST
CyclesInclude cycle detectionMUST
SymlinksSymbolic link handlingSHOULD

Plugins ​

TopicDescriptionSpec
SandboxingPlugin isolation requirementsSHOULD
CapabilitiesPlugin permission modelSHOULD

Conformance Levels ​

Implementations MUST document their security posture:

LevelRequirements
BasicInput limits, path traversal protection
StandardBasic + ReDoS protection, cycle detection
HardenedStandard + plugin sandboxing, memory limits

Reporting Vulnerabilities ​

See SECURITY.md in the repository root.