Security Policy for Home Programming Language
On this page 25
This document outlines the security architecture, assumptions, and guidelines for the Home programming language.
Security Features
Memory Safety
Home provides memory safety without garbage collection through:
-
Ownership System
- Each value has exactly one owner
- Values are automatically dropped when owner goes out of scope
- No dangling pointers possible
-
Borrow Checking
- References cannot outlive their referents
- Aliasing XOR mutability rule enforced at compile time
- No data races in single-threaded code
-
Bounds Checking
- Array access is bounds-checked by default
- Slice operations verify ranges
- Can be disabled in release builds with
-Drelease-fast
Input Validation
The validation framework (packages/validation) provides:
| Limit | Default | Strict Mode |
|---|---|---|
| Max recursion depth | 256 | 64 |
| Max input size | 10MB | 1MB |
| Max tokens | 1,000,000 | 100,000 |
| Max AST nodes | 500,000 | 50,000 |
| Parse timeout | 30s | 5s |
Type Safety
- Static type checking prevents type confusion
- No implicit type coercions
- Algebraic data types for safe error handling
- Null safety via Optional types
Security Assumptions
Trusted Components
The following are assumed to be trusted:
- Compiler binary - The Home compiler itself
- Standard library - Built-in packages
- Build system - Zig build infrastructure
- Operating system - Host OS kernel and runtime
Untrusted Components
The following are treated as potentially untrusted:
- User source code - Subject to validation limits
- External dependencies - Should be audited
- Runtime input - Must be validated by programs
- Network data - Never trusted by default
Known Limitations
Not Protected Against
- Logic bugs - Semantic errors in correct code
- Side channels - Timing attacks not mitigated
- Physical attacks - No protection against hardware attacks
- Supply chain - Dependency security not verified automatically
FFI Boundaries
Foreign function interface (FFI) code:
- Is inherently unsafe
- Can violate memory safety guarantees
- Should be minimized and carefully audited
- Must use
unsafeblocks (planned)
Vulnerability Reporting
Responsible Disclosure
Please report security vulnerabilities by:
- Email: security@home-lang.org (planned)
- GitHub: Private security advisory
- PGP: Use our public key for encrypted reports
What to Include
- Description of the vulnerability
- Steps to reproduce
- Potential impact
- Suggested fix (if any)
Response Timeline
| Phase | Timeframe |
|---|---|
| Initial response | 24-48 hours |
| Severity assessment | 1 week |
| Fix development | 2-4 weeks |
| Public disclosure | After fix released |
Security Best Practices
For Language Users
-
Enable strict validation for untrusted input
const config = ValidationConfig.strict(); -
Use Result types for error handling
fn read_file(path: string): Result<string, Error> -
Validate external data at system boundaries
fn handle_request(data: []u8): Result<Response, Error> { let validated = try validate(data); // ... } -
Minimize FFI usage and audit FFI code
For Compiler Development
- Fuzz all parsers - lexer, parser, codecs
- Limit resource usage - memory, recursion, time
- Fail safely - errors should not leak state
- Audit dependencies - minimize and verify
Cryptography
Current Status
Home does not include cryptographic primitives in the standard library. For cryptographic operations:
- Use well-audited external libraries
- Consider libsodium or similar
- Never implement custom cryptography
Planned Features
- Integration with system crypto APIs
- Secure random number generation
- Constant-time comparison utilities
Audit History
| Date | Scope | Findings | Status |
|---|---|---|---|
| - | - | No formal audits yet | Planned |
Compliance
Standards
Home aims to comply with:
- CERT Secure Coding Guidelines
- OWASP recommendations
- CWE/SANS Top 25
Security Testing
Regular security testing includes:
- Static analysis (linter)
- Fuzz testing (packages/fuzz)
- Code review for security-sensitive changes
Contact
For security-related questions, contact the maintainers through GitHub issues (for non-sensitive matters) or the security email for vulnerability reports.