Skip to content

Commit 88fc788

Browse files
authored
Merge pull request #248 from jplock/jp-kiro
1 parent eb7eb0a commit 88fc788

11 files changed

Lines changed: 371 additions & 340 deletions

File tree

.kiro/steering/product.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# AWS Nitro Enclaves Vault
2+
3+
A secure vault solution for storing and protecting sensitive data (PII/PHI) using AWS Nitro Enclaves.
4+
5+
## Purpose
6+
7+
Provides a secure mechanism to store sensitive data encrypted at rest, with decryption only possible through approved channels within isolated Nitro Enclave environments.
8+
9+
## Key Features
10+
11+
- Flexible data model supporting PII fields (email, SSN, DOB, address, phone, etc.)
12+
- HPKE encryption (RFC 9180) using P-384 curve, HKDF-SHA384, and AES-256-GCM
13+
- Symmetric keys secured via AWS KMS
14+
- CEL (Common Expression Language) support for field transformations during decryption
15+
- Audit logging of all vault operations
16+
17+
## Architecture Overview
18+
19+
Three-tier architecture:
20+
1. **API Tier**: API Gateway + Lambda (Python) + DynamoDB for metadata/audit
21+
2. **Decryption Tier**: EC2 instances with NGINX, parent application (Rust), vsock proxy
22+
3. **Enclave Tier**: Nitro Enclave running enclave application (Rust) for secure decryption

.kiro/steering/structure.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Project Structure
2+
3+
```
4+
├── api/ # Python Lambda API
5+
│ ├── src/app/ # Application code
6+
│ │ ├── routers/ # API route handlers
7+
│ │ ├── resources/ # AWS resource clients (DynamoDB, KMS)
8+
│ │ ├── models.py # Pydantic models and vault schema
9+
│ │ ├── vault.py # Core vault operations
10+
│ │ ├── encryptors.py # HPKE encryption logic
11+
│ │ └── lambda_handler.py # Lambda entry point
12+
│ ├── dependencies/ # Lambda layer dependencies
13+
│ └── template.yml # SAM template
14+
15+
├── enclave/ # Rust Nitro Enclave application
16+
│ └── src/
17+
│ ├── main.rs # Enclave entry point (vsock listener)
18+
│ ├── hpke.rs # HPKE decryption
19+
│ ├── kms.rs # KMS integration
20+
│ ├── expressions.rs # CEL expression execution
21+
│ ├── models.rs # Request/response types
22+
│ └── protocol.rs # Vsock message protocol
23+
24+
├── parent/ # Rust parent instance application
25+
│ └── src/
26+
│ ├── main.rs # Parent entry point
27+
│ ├── application.rs # Axum app setup
28+
│ ├── routes.rs # HTTP route handlers
29+
│ ├── enclaves.rs # Enclave management
30+
│ ├── imds.rs # EC2 instance metadata
31+
│ └── protocol.rs # Vsock communication
32+
33+
├── canary/ # Python canary Lambda for monitoring
34+
│ └── src/app/
35+
36+
├── docs/ # MkDocs documentation
37+
38+
├── scripts/ # Development scripts
39+
40+
├── Cargo.toml # Rust workspace root
41+
├── deploy.sh # Main deployment script
42+
├── uninstall.sh # Cleanup script
43+
44+
# CloudFormation Templates
45+
├── vpc_template.yml # VPC infrastructure
46+
├── kms_template.yml # KMS key setup
47+
├── ci_template.yml # CI/CD pipeline
48+
├── vault_template.yml # Vault EC2 infrastructure
49+
└── deploy_template.yml # Deployment orchestration
50+
```
51+
52+
## Key Patterns
53+
54+
- **Workspace**: Rust workspace with `enclave` and `parent` members
55+
- **Lambda Layers**: Python dependencies in `api/dependencies/`
56+
- **SAM**: Each Lambda component has its own `template.yml` and `samconfig.toml`
57+
- **Makefiles**: Each component has a Makefile for common operations
58+
- **License Headers**: All source files include MIT-0 license header

.kiro/steering/tech.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Technology Stack
2+
3+
## Languages
4+
5+
- **Rust** (Edition 2024): Enclave and parent applications
6+
- **Python 3.13**: API Lambda functions
7+
8+
## Rust Stack
9+
10+
- **Runtime**: Tokio async runtime (parent)
11+
- **Web Framework**: Axum (parent HTTP server)
12+
- **Serialization**: serde, serde_json
13+
- **Crypto**: aws-lc-rs, rustls
14+
- **AWS SDK**: aws-config, aws-credential-types
15+
- **Enclave Communication**: vsock
16+
- **Expression Language**: cel-interpreter
17+
- **CLI Parsing**: clap
18+
- **Error Handling**: anyhow, thiserror
19+
- **Memory**: mimalloc (enclave, musl target)
20+
- **Security**: zeroize for sensitive data
21+
22+
## Python Stack
23+
24+
- **Framework**: AWS Lambda Powertools (logging, tracing, metrics, validation)
25+
- **Validation**: Pydantic (via Powertools parser)
26+
- **HTTP Client**: requests
27+
- **Crypto**: cryptography, hpke
28+
- **ID Generation**: pksuid
29+
- **AWS SDK**: boto3
30+
31+
## Infrastructure
32+
33+
- **IaC**: AWS SAM (Serverless Application Model) + CloudFormation
34+
- **Container**: Docker (enclave and parent images)
35+
- **Build**: docker-bake.hcl for multi-platform builds
36+
37+
## Build Commands
38+
39+
### API (Python Lambda)
40+
```bash
41+
cd api
42+
make setup # Create venv and install dependencies
43+
make build # SAM build
44+
make deploy # SAM deploy
45+
make format # Run black formatter
46+
make clean # SAM delete
47+
```
48+
49+
### Enclave (Rust)
50+
```bash
51+
cd enclave
52+
make build # Build for aarch64-unknown-linux-musl
53+
make build-docker # Build Docker image
54+
make build-enclave # Build Nitro Enclave EIF
55+
make clean # Cargo clean
56+
```
57+
58+
### Parent (Rust)
59+
```bash
60+
cd parent
61+
make build # Build for aarch64-unknown-linux-gnu
62+
make build-docker # Build Docker image
63+
make clean # Cargo clean
64+
```
65+
66+
### Full Deployment
67+
```bash
68+
./deploy.sh # Interactive deployment script
69+
```
70+
71+
## Code Style
72+
73+
- **Python**: Black formatter, line length 120, target Python 3.13
74+
- **Rust**: Edition 2024, release profile optimized for size (strip, LTO, panic=abort)

0 commit comments

Comments
 (0)