If
chmodtaught usrwx, what's the permission model for cryptography?
HSED: Hash | Sign | Encrypt | Decrypt
You need to grant your CI/CD pipeline access to sign container images, but your cloud provider's IAM policy looks like this:
{
"Effect": "Allow",
"Action": [
"kms:Decrypt",
"kms:Encrypt",
"kms:Sign",
"kms:Verify",
"kms:GenerateDataKey",
"kms:CreateKey",
"kms:DescribeKey"
],
"Resource": "*"
}Translation: "We gave up and granted everything."
Sound familiar?
# Your CI/CD pipeline should only sign
hsed:signer = 12 # H+S (Hash + Sign only)
# Your secrets manager should only encrypt/decrypt
hsed:vault = 3 # E+D (Encrypt + Decrypt only)
# Your audit team should verify and read
hsed:audit = 9 # H+D (Hash + Decrypt only)Just like chmod 755, but for cryptographic operations.
pip install hsed# Initialize HSED policy
hsed init
# Create a signer role (CI/CD)
hsed role create signer --permissions 12
# Generate AWS KMS policy
hsed generate aws-kms --role signer --key-arn arn:aws:kms:...
# Validate existing policies
hsed validate policy.hsed
# Audit your AWS KMS permissions
hsed audit aws-kms --profile productionfrom hsed import Policy, Role, Permissions
# Define roles
policy = Policy()
policy.add_role(Role('signer', permissions=12)) # H+S
policy.add_role(Role('vault', permissions=3)) # E+D
policy.add_role(Role('audit', permissions=9)) # H+D
# Enforce at runtime
@policy.enforce(role='signer')
def sign_artifact(data: bytes) -> bytes:
return sign_data(data) # β Allowed
@policy.enforce(role='signer')
def decrypt_secret(ciphertext: bytes) -> bytes:
return decrypt_data(ciphertext) # β PermissionError!
# Generate cloud provider policies
aws_policy = policy.to_aws_kms(role='signer', key_arn='...')
vault_policy = policy.to_vault(role='signer', path='signing/*')H | S | E | D
8 4 2 1
- H (8) - Hash/Verify: Compute hashes, verify signatures
- S (4) - Sign: Create digital signatures, attestations
- E (2) - Encrypt: Seal data, create ciphertext
- D (1) - Decrypt: Unseal data, read plaintext
hsed 15 # 1111 = H+S+E+D = Full crypto authority (root)
hsed 12 # 1100 = H+S = Sign only (CI/CD, code signing)
hsed 3 # 0011 = E+D = Encrypt/Decrypt (vault, secrets)
hsed 9 # 1001 = H+D = Verify + Read (audit, forensics)
hsed 10 # 1010 = H+E = Hash + Encrypt (DMZ, ingress)| Role | Permissions | Use Case |
|---|---|---|
hsed:root |
15 (H+S+E+D) | Full authority (break glass) |
hsed:admin |
14 (H+S+E) | Admin without decrypt |
hsed:signer |
12 (H+S) | CI/CD, code signing, attestation |
hsed:vault |
3 (E+D) | Secrets management |
hsed:audit |
9 (H+D) | Compliance, forensics |
hsed:encryptor |
10 (H+E) | Data ingestion, sealing |
hsed:verifier |
8 (H) | Signature verification only |
# Without HSED: Overly permissive
"Action": ["kms:*"] # π±
# With HSED: Precise permissions
role = Role('signer', permissions=12) # Only H+S βFinancial Transaction Flow:
βββββββββββββββββββββββββββββββββββββββ
β Initiator: hsed 10 (H+E) β β Can hash and seal request
β Approver: hsed 13 (H+S+D) β β Can verify, sign, decrypt
β Executor: hsed 9 (H+D) β β Can verify signature, decrypt
βββββββββββββββββββββββββββββββββββββββ
No single role can complete the transaction alone.
Works across:
- β AWS KMS
- β HashiCorp Vault
- β Azure Key Vault
- β GCP Cloud KMS
- β Hardware Security Modules (HSMs)
- β Custom key management systems
# Find all god-mode access
grep "hsed:15" audit-trail.log
# Find all roles that can decrypt
hsed audit list --can-decrypt
# Compliance report
hsed report --soc2 --output compliance.pdfIf your team knows chmod 755, they'll understand hsed 12.
# GitHub Actions workflow
- name: Sign container image
env:
HSED_ROLE: signer # permissions=12 (H+S)
run: |
hsed sign --key signing-key \
--input image.tar \
--output image.tar.sigPermissions enforced:
- β Can hash the image
- β Can sign the hash
- β Cannot decrypt production secrets
- β Cannot encrypt (prevents data exfiltration)
from hsed import enforce
@enforce(role='vault') # permissions=3 (E+D)
def store_secret(name: str, value: str):
encrypted = encrypt(value)
save_to_store(name, encrypted)
@enforce(role='vault')
def retrieve_secret(name: str) -> str:
encrypted = load_from_store(name)
return decrypt(encrypted)Permissions enforced:
- β Can encrypt secrets
- β Can decrypt secrets
- β Cannot sign (prevents forging attestations)
- β Cannot hash (focused role)
# Auditor role: hsed:audit (permissions=9, H+D)
hsed audit verify-logs \
--role audit \
--logs /var/log/audit/* \
--key-id audit-keyPermissions enforced:
- β Can verify log signatures
- β Can decrypt evidence for investigation
- β Cannot sign (prevents evidence tampering)
- β Cannot encrypt (prevents hiding data)
π Complete Book
Comprehensive guide covering:
- Chapter 1: Introduction & Fundamentals
- Chapter 2: Core Concepts
- Chapter 3: Implementation Patterns
- Chapter 4: Cloud Provider Integration
- Chapter 5: Security & Compliance
- Chapter 6: Advanced Topics
- Chapter 7: Real-World Case Studies
π Specification
RFC-style specification of the HSED permission model.
π Quick Start Guides
π οΈ Examples
Ready-to-use implementations:
hsed/
βββ chapters/ # Complete book (YAML format)
β βββ hsed_book_index.yaml
β βββ chapter_1_index.yaml
β βββ section_1_01_introduction.yaml
β βββ ...
β
βββ hsed/ # Python package
β βββ core/ # Core permission engine
β βββ enforcement/ # Runtime enforcement
β βββ integrations/ # Cloud provider integrations
β βββ cli/ # Command-line interface
β βββ utils/ # Utilities
β
βββ examples/ # Real-world usage patterns
β βββ cicd-pipeline/
β βββ secrets-manager/
β βββ audit-trail/
β βββ zero-trust/
β
βββ templates/ # Ready-to-use templates
β βββ aws-kms/
β βββ hashicorp-vault/
β βββ kubernetes/
β
βββ tests/ # Test suite
βββ docs/ # Generated documentation
βββ bin/ # CLI executable
We welcome contributions! See CONTRIBUTING.md for guidelines.
Areas we'd love help with:
- Additional cloud provider integrations (IBM Cloud, Oracle Cloud)
- Language bindings (Go, Rust, Java)
- Terraform/CloudFormation modules
- Real-world case studies
- Documentation improvements
Hash | Sign | Encrypt | Decrypt
Four fundamental cryptographic operations. Four permission bits. Simple. Universal. Memorable.
Just like chmod taught us rwx, HSED teaches us who touches our crypto, and how.
MIT License - see LICENSE for details.
If you use HSED in your research or production systems, please cite:
@software{hsed2024,
title = {HSED: Unix Permissions for Cryptographic Operations},
author = {Your Name},
year = {2024},
url = {https://github.com/yourusername/hsed}
}Inspired by:
- Unix file permissions (
chmod) - Principle of least privilege
- Real-world pain of managing KMS/HSM permissions
- Need for simple, universal security abstractions
π§ Early Development - API may change
- Core permission model
- Python implementation
- CLI tool
- AWS KMS integration
- HashiCorp Vault integration
- Azure Key Vault integration
- GCP Cloud KMS integration
- Complete documentation
- Production-ready (v1.0.0)
Star β this repo to follow progress!
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: See SECURITY.md for responsible disclosure
If chmod taught you rwx, let HSED teach you crypto permissions.
Made with β€οΈ for security engineers who believe in least privilege.