Skip to content

scanset/Endpoint-State-Policy

Repository files navigation

Endpoint State Policy (ESP)

License Rust GitHub tag

Policy as Data: A declarative language for endpoint compliance validation


Overview

Endpoint State Policy (ESP) is a platform-agnostic policy language that separates security intent from execution logic. Policies are written as structured data, not imperative scripts, making them inspectable, testable, and portable across different scanner implementations.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    ESP Policy Files                         β”‚
β”‚              (Security Intent as Data)                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β–Ό                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Compiler        β”‚      β”‚   Execution Engine   β”‚
β”‚                      β”‚      β”‚                      β”‚
β”‚ β€’ Syntax validation  β”‚      β”‚ β€’ Resolution engine  β”‚
β”‚ β€’ Type checking      β”‚      β”‚ β€’ Execution engine   β”‚
β”‚ β€’ Reference resolutionβ”‚     β”‚ β€’ Strategy framework β”‚
β”‚ β€’ Fail-fast design   β”‚      β”‚ β€’ Evidence generationβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚                              β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Compliance Results                        β”‚
β”‚              (Repeatable, Auditable Evidence)               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Why ESP?

Traditional compliance automation (SCAP/XCCDF) suffers from:

  • Verbose, fragile XML β€” Policies are difficult to read, write, and maintain
  • Tight coupling β€” Policy definition is intertwined with scanner implementation
  • Poor extensibility β€” Adding new check types requires modifying the standard
  • High cost β€” Authoring and maintaining policies requires specialized expertise

ESP addresses these problems by:

  • Separating policy from execution β€” Policies describe what should be true, scanners decide how to check it
  • Using a typed, validated DSL β€” Catch errors at compile time, not during scans
  • Enforcing contracts β€” CTN types define clear interfaces between policies and implementations
  • Human and machine readable β€” Policies are inspectable by auditors and parseable by tools

ESP focuses on technical controls β€” controls validated by inspecting endpoint state.


Core Philosophy

Policy as Data, Not Code

ESP policies describe what should be true, not how to check it. This separation enables:

  • Policy authors to focus on security intent without implementation details
  • Scanner implementers to optimize execution for their platform
  • Auditors to inspect policies without reading code
  • Organizations to share policies across different scanner implementations

Fail-Fast Compiler

The compiler enforces strict validation at compile time through a 7-pass pipeline:

  1. File processing with UTF-8 and size validation
  2. Lexical analysis with token limits
  3. Syntax validation and AST construction
  4. Symbol discovery and table building
  5. Reference resolution and cycle detection
  6. Semantic analysis and type checking
  7. Structural validation and limit enforcement

Errors are caught before execution, not during a scan. Security limits are baked into the binary at compile time (SSDF compliant).

Constrained Execution

The runtime engine operates within strict boundaries:

  • Whitelisted command execution β€” Only approved commands can run
  • Deterministic evaluation order β€” Same policy produces same results
  • Repeatable evidence generation β€” Collection methods are documented
  • No code injection β€” Policies cannot execute arbitrary code

Trust Model

ESP enforces trust boundaries at every stage:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  UNTRUSTED INPUT          TRUST GATE              TRUSTED OUTPUT    β”‚
β”‚                                                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ .esp files  │────▢│    Compiler     │────▢│  Validated AST  β”‚   β”‚
β”‚  β”‚ (untrusted) β”‚     β”‚ (7-pass check)  β”‚     β”‚   (trusted)     β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                                                       β”‚             β”‚
β”‚                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚                      β–Ό                                              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                           β”‚
β”‚  β”‚         Constrained Execution        β”‚                           β”‚
β”‚  β”‚  β€’ Contract-bound collectors         β”‚                           β”‚
β”‚  β”‚  β€’ Whitelisted commands              β”‚                           β”‚
β”‚  β”‚  β€’ Deterministic evaluation          β”‚                           β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                           β”‚
β”‚                     β”‚                                               β”‚
β”‚                     β–Ό                                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                           β”‚
β”‚  β”‚         Controlled Disclosure        β”‚                           β”‚
β”‚  β”‚  β€’ Attestations (network-safe)       β”‚                           β”‚
β”‚  β”‚  β€’ Full results (local-only)         β”‚                           β”‚
β”‚  β”‚  β€’ Audit logging (mandatory)         β”‚                           β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Boundary Threat Mitigated
Policy Input Malformed/malicious policies
Compiler Gate Unsafe policies reaching execution
Execution Uncontrolled system access
Capabilities Privilege escalation
Results Information leakage

πŸ“„ See ESP Trust Model for complete details.


Quick Start

Prerequisites

  • Rust 1.85+ (rustup.rs)
  • Linux/macOS: OpenSSL development libraries (libssl-dev on Ubuntu, openssl on macOS)
  • Windows: No additional dependencies (uses native CNG)

Dev Container (Recommended)

This repository includes a VS Code Dev Container for fast setup:

  1. Install Docker Desktop and VS Code
  2. Install the Dev Containers extension
  3. Clone and open in VS Code:
    git clone https://github.com/CurtisSlone/Endpoint-State-Policy.git
    code Endpoint-State-Policy
  4. Click "Reopen in Container" when prompted

Build

# Build all crates
cargo build --workspace

# Run tests
make test

# Run linting
make lint

Validate ESP Files (Compiler Only)

# Compile a single file
cargo run -p compiler -- policy.esp

# Compile a directory
cargo run -p compiler -- policies/

Architecture

Crate Overview

Crate Purpose
common Shared types: AST, logging, configuration, results, FIPS 140-3 cryptography
compiler Parse and validate ESP files through 7-pass pipeline
execution_engine Resolution engine, execution framework, strategy system

Data Flow

policy.esp
    β”‚
    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        Compiler                             β”‚
β”‚  File β†’ Tokens β†’ AST β†’ Symbols β†’ References β†’ Semantics    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚ Validated AST
                             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Execution Engine                         β”‚
β”‚  Conversion β†’ Resolution β†’ Execution β†’ Results              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                             β–Ό
                    Compliance Results

Compiler Pipeline

The compiler transforms ESP source through seven distinct passes:

Pass Module Purpose
1 file_processor UTF-8 validation, size limits, encoding
2 lexical Token stream generation
3 syntax Grammar validation, AST construction
4 symbols Symbol table building
5 reference_resolution Cross-reference validation, cycle detection
6 semantic_analysis Type checking, runtime operation validation
7 validation Structural requirements, implementation limits

Execution Engine

The execution engine consumes validated AST and produces compliance results:

Phase Purpose
Conversion Transform AST to execution types
Resolution Variable substitution, SET expansion, dependency ordering
Execution Data collection, state validation, evidence generation

Control Framework Coverage

ESP can express technical controls from any framework with observable requirements:

Framework Example Use
NIST SP 800-53 / 800-171 Configuration management controls
MITRE ATT&CK Detection-oriented validation
DISA STIGs Security configuration baselines
CIS Benchmarks Hardening verification
Custom baselines Organization-specific requirements

ESP answers: "Is this endpoint in the required technical state?"


ESP Agent SDK

For building scanners that execute ESP policies, see the ESP Agent SDK:

πŸ”— github.com/scanset/ESP-Agent-SDK

The SDK provides:

  • Reference CTN type implementations (file_metadata, file_content, tcp_listener, etc.)
  • Collector and executor patterns
  • Example agent application
  • Contract development guide

Design Partners Wanted

ScanSet is building the Compliance Evidence Layer β€” infrastructure that produces cryptographically verifiable proof of compliance, continuously. We're seeking design partners to shape the orchestration and integration layers.

What We're Building

ESP is the policy engine. ScanSet is the infrastructure that operationalizes it:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    ScanSet Evidence Layer                           β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚   Policy    β”‚     β”‚  Orchestration  β”‚     β”‚     Trust       β”‚   β”‚
β”‚  β”‚  (ESP Core) │────▢│     Layer       │────▢│ Infrastructure  β”‚   β”‚
β”‚  β”‚             β”‚     β”‚                 β”‚     β”‚                 β”‚   β”‚
β”‚  β”‚ β€’ Compiler  β”‚     β”‚ β€’ Agent mgmt    β”‚     β”‚ β€’ Signing       β”‚   β”‚
β”‚  β”‚ β€’ Engine    β”‚     β”‚ β€’ Policy routingβ”‚     β”‚ β€’ Attestations  β”‚   β”‚
β”‚  β”‚ β€’ Contracts β”‚     β”‚ β€’ Evidence flow β”‚     β”‚ β€’ Verification  β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                              β”‚                                      β”‚
β”‚                              β–Ό                                      β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                             β”‚
β”‚                    β”‚   Connectors    β”‚                             β”‚
β”‚                    β”‚                 β”‚                             β”‚
β”‚                    β”‚ β€’ SIEM / SOAR   β”‚                             β”‚
β”‚                    β”‚ β€’ GRC Platforms β”‚                             β”‚
β”‚                    β”‚ β€’ Threat Models β”‚                             β”‚
β”‚                    β”‚ β€’ AI Agents     β”‚                             β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

What Design Partners Get

  • Early access to orchestration and trust infrastructure
  • Custom connector development for your SIEM/SOAR (Splunk, Sentinel, ServiceNow, etc.)
  • Direct input on API design and integration patterns
  • Priority support during implementation

What We're Looking For

Profile Why You'd Be a Great Fit
Federal Contractors FedRAMP/FISMA continuous monitoring, 3PAO evidence packages
Regulated SaaS SOC 2 evidence automation, customer audit responses
Cloud-Native Teams GitOps integration, CI/CD compliance gates
MSPs / MSSPs Multi-tenant evidence collection, client reporting

The Vision

Compliance outcomes should be provable, not explained:

  • Attestations flow to your SIEM β€” failed controls become security events
  • SOAR playbooks trigger automatically β€” remediation closes the loop with signed proof
  • Threat models update in real-time β€” attack paths light up when controls fail
  • 3PAO audits become queries β€” not quarterly fire drills

Get Involved

πŸ“§ Contact: curtis@scanset.io

🌐 Learn more: scanset.io

We're not looking for customers yet β€” we're looking for partners who want to shape how compliance evidence infrastructure gets built.


Makefile Commands

Command Description
make build Build all crates
make test Run all tests
make test-unit Run unit tests only
make lint Run strict clippy checks
make format Format code
make docs Generate documentation
make pre-commit Run all checks before commit

Documentation

ESP Language Specification

Document Description
ESP Overview Language introduction and concepts
Lexical Rules Token definitions and lexical structure
Grammar EBNF Formal grammar specification
Type System Data types and type compatibility
Symbol Resolution Symbol tables and reference resolution
Evaluation Semantics Runtime evaluation rules
Meta Requirements Structural requirements
Error Model Error codes and handling
Canonical Schema Output format specification
Trust Model Security boundaries and trust
Configuration Build and runtime configuration
Logging Logging system specification

Crate Documentation

Crate README
common common/README.md
compiler compiler/README.md
execution_engine execution_engine/README.md

Platform Support

Platform Cryptography Status
Linux OpenSSL FIPS βœ… Full support
macOS OpenSSL βœ… Full support (requires Homebrew OpenSSL)
Windows CNG (BCrypt) βœ… Full support (native, no dependencies)

Cross-compilation from Linux to Windows is supported without bundling OpenSSL.


Security

Design Principles

  • No code execution β€” Policies are data, not scripts
  • Whitelisted commands β€” Only approved commands can execute
  • FIPS 140-3 cryptography β€” Platform-native certified implementations
  • Compile-time limits β€” Security boundaries baked into binary
  • Mandatory audit logging β€” Security events always logged

Reporting Vulnerabilities

For security vulnerabilities, contact curtis@scanset.io.


License

Apache 2.0 β€” See LICENSE for details.


ESP β€” Making endpoint compliance declarative, testable, and auditable.

About

Endpoint-State-Policy is a policy-as-data framework for defining, evaluating, and enforcing security requirements across endpoints and cloud-managed systems. It provides a structured schema for representing technical and policy controls, enabling automated assessment, continuous monitoring, and standardized evidence generation for compliance.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages