Decisions
ADR-003: Security-First Approach
Status: Accepted Date: 2026-02-09 Authors: @sebastienrousseau
Context
Dotfiles repositories present unique security challenges:
- They configure system behavior and permissions
- They may contain or reference secrets (API keys, tokens)
- They execute scripts with user privileges
- They're often cloned to multiple machines
A security breach in dotfiles can compromise all systems using them.
Decision
Implement a defense-in-depth security model with multiple layers:
Layer 1: Secrets Protection
Never commit secrets:
# .gitleaks.toml - block common secret patterns
Encrypted secrets with age:
# Secrets stored encrypted, decrypted at apply time
CI enforcement:
- Gitleaks runs on every PR
- TruffleHog for verified secrets detection
- Block merge if secrets detected
Layer 2: Input Validation
Path traversal prevention:
# Validate all user inputs
if ; then
fi
Safe file operations:
# Use absolute paths, validate before operations
real_path=""
if ; then
fi
Layer 3: Opt-in System Modifications
Dangerous operations require explicit consent:
# Security scripts are opt-in
if [; then
fi
Comprehensive logging:
# All system modifications logged
Layer 4: CI Security Scanning
Multi-tool approach:
- Gitleaks: Secrets in git history
- Shellcheck: Shell script vulnerabilities
- Checkov: Infrastructure misconfigurations
- Trivy: Container vulnerabilities (when applicable)
- CodeQL: Static analysis for Python/JavaScript
Weekly deep scans:
schedule:
- cron: '0 2 * * 0' # Weekly security audit
Layer 5: Minimal Privileges
Scripts request only needed permissions:
# Don't run as root unless necessary
if [; then
fi
# Use sudo only for specific commands
Consequences
Positive
- Secrets never enter git history
- System modifications are auditable
- Multiple layers catch different vulnerability types
- Contributors have clear security patterns to follow
Negative
- Additional complexity in scripts
- Encrypted secrets require key management
- Some features disabled by default (friction)
Neutral
- Security vs convenience trade-offs explicit
- Regular security audits via scheduled CI
Security Checklist for Contributors
- No hardcoded secrets (use environment variables or age encryption)
- Validate all user inputs
- Use absolute paths for file operations
- Document any system modifications
- Test scripts with shellcheck
- Add appropriate permission checks