The Iron Vault - Secure Filesystem Agent Layer for Aperion
Project description
The Iron Vault - Aperion FSAL
The absolute boundary between AI agents and the underlying operating system.
Overview
The Iron Vault is a hardened filesystem access layer that enforces Constitution B3 (Sandbox Boundaries) and guarantees file integrity via atomic operations. It serves as the exclusive I/O gateway for AI agents in the Aperion system.
Key Security Guarantees
- ๐ Sandbox Isolation: All paths are rigidly constrained to
FSAL_ROOT - โ๏ธ Atomic Writes: Write-temp-then-rename pattern with
fsyncprevents corruption - ๐ซ Traversal Prevention:
../, null bytes, symlinks, and absolute paths are blocked - ๐ Bearer Token Auth: Production mode enforces authentication
- ๐ Audit Ready: Structured logging for all operations
Quick Start
Installation
pip install aperion-fsal
# From source
pip install -e .
# With dev dependencies
pip install -e ".[dev]"
Running the Service
# Development mode (CWD fallback allowed)
APERION_ENV=dev aperion-fsal
# Production mode (FSAL_ROOT required)
FSAL_ROOT=/data/sandbox FSAL_TOKEN=secret aperion-fsal
Docker
# Build
docker build -t aperion-fsal .
# Run
docker run -d -p 4848:4848 \
-e FSAL_TOKEN=your-secret-token \
-v /path/to/sandbox:/data \
aperion-fsal
API Reference
All endpoints require Bearer token authentication when FSAL_TOKEN is set.
| Endpoint | Method | Description |
|---|---|---|
/healthz |
GET | Health check |
/metrics |
GET | Prometheus metrics |
/auth/status |
GET | Auth configuration (public) |
/v1/fs/list |
POST | List directory contents (supports recursive) |
/v1/fs/read |
POST | Read file content |
/v1/fs/write |
POST | Write file (base64 encoded) |
/v1/fs/move |
POST | Move/rename file or directory |
/v1/fs/copy |
POST | Copy file or directory |
/v1/fs/mkdir |
POST | Create directory |
/v1/fs/delete |
POST | Delete file or directory |
/v1/fs/hash |
POST | Calculate file hash |
/v1/fs/exists |
POST | Check if path exists |
/v1/fs/stat |
POST | Get detailed file/directory info |
Example: Write a File
curl -X POST http://localhost:4848/v1/fs/write \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-token" \
-d '{
"path": "hello.txt",
"content_b64": "SGVsbG8sIFdvcmxkIQ==",
"make_dirs": true
}'
Example: Read a File
curl -X POST http://localhost:4848/v1/fs/read \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-token" \
-d '{
"path": "hello.txt",
"as_text": true
}'
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
FSAL_ROOT |
Yes (prod) | CWD (dev) | Sandbox root directory |
FSAL_TOKEN |
Recommended | None | Bearer token for authentication |
FSAL_HOST |
No | 127.0.0.1 | Host to bind to |
FSAL_PORT |
No | 4848 | Port to listen on |
APERION_ENV |
No | production | Set to dev for development mode |
FSAL_MAX_FILE_SIZE |
No | 104857600 | Max file size in bytes (100MB) |
FSAL_MIN_FREE_SPACE |
No | 104857600 | Min free disk space required (100MB) |
FSAL_REQUEST_TIMEOUT |
No | 30 | Request timeout in seconds |
FSAL_TRACING_ENABLED |
No | false | Enable OpenTelemetry tracing |
Security Model
Asymmetric Behavior (Constitution B)
- Server: Logs warning if
FSAL_TOKENnot set, but allows startup in dev mode - Client/Scripts: Must fail immediately if tokens are missing
Sandbox Enforcement
- All paths are normalized to relative paths
- Absolute paths have their root stripped
..components are resolved BEFORE path construction- Symlinks are rejected by default
- Null bytes in paths are always rejected
FSAL_ROOTMUST be set in production mode
Atomic Write Guarantee
1. Write to temp file in SAME directory as target
2. fsync() to ensure data hits disk
3. Atomic rename() to move temp to target
4. Cleanup temp file in finally block
This guarantees that on power loss:
- Either the OLD content is preserved, OR
- The NEW content is fully written
- Never a partial/corrupt file
Testing
# Run all tests
pytest
# Run with coverage
pytest --cov=aperion_fsal --cov-report=html
# Run security tests only
pytest tests/security/
# Run unit tests only
pytest tests/unit/
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run linter
ruff check src/
# Run type checker
mypy src/
# Format code
ruff format src/
Project Structure
aperion-fsal/
โโโ src/
โ โโโ aperion_fsal/
โ โโโ __init__.py
โ โโโ core/
โ โ โโโ safeio.py # The atomic I/O kernel
โ โ โโโ sandbox.py # Path resolution & traversal prevention
โ โโโ service/
โ โ โโโ app.py # FastAPI application
โ โ โโโ models.py # Pydantic schemas
โ โ โโโ auth.py # Token validation logic
โ โโโ main.py # Entry point
โโโ tests/
โ โโโ conftest.py
โ โโโ unit/
โ โ โโโ test_safeio.py
โ โโโ security/
โ โโโ test_traversal.py # Red Team attacks
โโโ pyproject.toml
โโโ Dockerfile
โโโ README.md
โโโ ref/ # Reference documentation
โโโ GAP_ANALYSIS.md # Security gaps & improvements
โโโ SECURITY_BEST_PRACTICES.md
โโโ INTEGRATION_GUIDE.md # Aperion integration
โโโ IMPLEMENTATION_ROADMAP.md
โโโ KNOWN_ISSUES.md
Reference Documentation
The /ref directory contains detailed documentation for development and integration:
| Document | Description |
|---|---|
| GAP_ANALYSIS.md | Security gaps and prioritized improvements |
| SECURITY_BEST_PRACTICES.md | Industry security guidance and citations |
| INTEGRATION_GUIDE.md | How to integrate with Aperion Legendary AI |
| IMPLEMENTATION_ROADMAP.md | Phased implementation plan with code samples |
| KNOWN_ISSUES.md | Current bugs, edge cases, and limitations |
License
MIT License - see LICENSE for details.
"Trust but verify." - The Iron Vault
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aperion_fsal-1.2.2.tar.gz.
File metadata
- Download URL: aperion_fsal-1.2.2.tar.gz
- Upload date:
- Size: 68.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4a520e28f1e27c95fb7a3e2abd1f09be7b6f6151b84050408cda64c2f27e933
|
|
| MD5 |
8e3336fa0f41f72ddf86ad9b0f553e9a
|
|
| BLAKE2b-256 |
f14017d74b50356caf80f2a5fec54210b8f60aab6c78db2f64bc67042b287493
|
Provenance
The following attestation bundles were made for aperion_fsal-1.2.2.tar.gz:
Publisher:
release.yml on invictustitan2/aperion-fsal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aperion_fsal-1.2.2.tar.gz -
Subject digest:
a4a520e28f1e27c95fb7a3e2abd1f09be7b6f6151b84050408cda64c2f27e933 - Sigstore transparency entry: 943887586
- Sigstore integration time:
-
Permalink:
invictustitan2/aperion-fsal@c9f2c4ef530186319914d69811c79ecee7695b58 -
Branch / Tag:
refs/tags/v1.2.2 - Owner: https://github.com/invictustitan2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c9f2c4ef530186319914d69811c79ecee7695b58 -
Trigger Event:
push
-
Statement type:
File details
Details for the file aperion_fsal-1.2.2-py3-none-any.whl.
File metadata
- Download URL: aperion_fsal-1.2.2-py3-none-any.whl
- Upload date:
- Size: 37.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d163ec8e7a7ac3d528bf5416f39073a1c6beab7a214113e17adc20f51dbca2c
|
|
| MD5 |
8225a1a1f42f6ffcf9b58501f62d3dca
|
|
| BLAKE2b-256 |
43ee09fd27c03c49d482a76d5655d2ba71af885525cff427ea7308dc314d3fc8
|
Provenance
The following attestation bundles were made for aperion_fsal-1.2.2-py3-none-any.whl:
Publisher:
release.yml on invictustitan2/aperion-fsal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aperion_fsal-1.2.2-py3-none-any.whl -
Subject digest:
3d163ec8e7a7ac3d528bf5416f39073a1c6beab7a214113e17adc20f51dbca2c - Sigstore transparency entry: 943887591
- Sigstore integration time:
-
Permalink:
invictustitan2/aperion-fsal@c9f2c4ef530186319914d69811c79ecee7695b58 -
Branch / Tag:
refs/tags/v1.2.2 - Owner: https://github.com/invictustitan2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c9f2c4ef530186319914d69811c79ecee7695b58 -
Trigger Event:
push
-
Statement type: