Skip to content

Security: cryptuon/commit-reveal

Security

SECURITY.md

Security Policy

Supported Versions

Version Supported
1.0.x
< 1.0

Security Features

This library implements several security measures to ensure safe cryptographic operations:

Core Security Features

  1. Cryptographically Secure Randomness: Uses Python's secrets module for all random number generation
  2. Timing-Safe Comparisons: Uses hmac.compare_digest() to prevent timing attacks
  3. Input Validation: Comprehensive validation of all inputs to prevent injection attacks
  4. Secure Hash Algorithms: Only allows secure hash algorithms (SHA-256, SHA-384, SHA-512, SHA-3, BLAKE2)
  5. Zero-Knowledge Proofs: Proper Schnorr signatures on secp256k1 for proving knowledge without revelation

CLI Security

  • No Plaintext Storage: The secure CLI never stores sensitive values on disk
  • Secure File Permissions: All storage files use 0600 permissions (owner read/write only)
  • Secure Input: Sensitive values are prompted without echo using getpass
  • Migration Tool: Safe migration from legacy insecure format to secure format

Zero-Knowledge Proof Security

  • Elliptic Curve Cryptography: Uses secp256k1 (same as Bitcoin)
  • Non-Interactive Proofs: Fiat-Shamir heuristic for non-interactive ZKPs
  • Proper Challenge Generation: Cryptographically secure challenge derivation
  • Point Validation: All elliptic curve points are validated before use

Best Practices

For Users

  1. Use the Secure CLI: Always use commit-reveal-secure instead of the legacy CLI
  2. Migrate Legacy Data: Use commit-reveal-migrate to upgrade from old formats
  3. Secure Environment: Run in a trusted environment with proper access controls
  4. Regular Updates: Keep the library updated to the latest version
  5. Backup Management: Securely handle any backups of commitment data

For Developers

  1. Input Validation: Always validate inputs using the provided validation functions
  2. Error Handling: Handle ValidationError and SecurityError appropriately
  3. Memory Management: Clear sensitive data when no longer needed
  4. ZKP Usage: Understand the security model of zero-knowledge proofs before use
  5. Testing: Use the comprehensive test suite for any modifications

Security Considerations

Hash Algorithm Selection

The library supports only cryptographically secure hash algorithms:

  • Recommended: SHA-256 (default), SHA-384, SHA-512
  • Alternative: SHA-3 variants, BLAKE2
  • Forbidden: MD5, SHA-1 (deprecated and insecure)

Zero-Knowledge Proof Limitations

While the ZKP implementation is cryptographically sound, consider these limitations:

  1. Simplified Implementation: This is not a general-purpose ZKP library
  2. Single-Use Proofs: Each proof should only be verified once
  3. Public Key Reuse: Don't reuse public keys across different commitments
  4. Implementation Maturity: Consider established ZKP libraries for high-stakes applications

Known Attack Vectors

The library is designed to resist:

  • Timing Attacks: Constant-time comparisons for reveal operations
  • Side-Channel Attacks: Secure random number generation
  • Injection Attacks: Comprehensive input validation
  • Directory Traversal: Filename sanitization in CLI
  • Information Leakage: No plaintext storage in secure mode

Threat Model

Assumptions

  1. Trusted Environment: The library runs in a trusted environment
  2. Secure Transport: Network communication (if any) uses secure channels
  3. Access Control: Proper file system permissions are maintained
  4. Hardware Security: The underlying hardware is not compromised

Out of Scope

  1. Hardware Attacks: Physical access to the device
  2. Operating System Compromise: Kernel-level attacks
  3. Network Security: Secure communication between parties
  4. Key Management: Long-term cryptographic key storage

Reporting a Vulnerability

If you discover a security vulnerability, please report it responsibly:

Contact Information

  • Email: security@example.com (replace with actual contact)
  • PGP Key: [Provide PGP public key for encrypted communication]
  • Response Time: We aim to respond within 48 hours

Reporting Guidelines

  1. Describe the Vulnerability: Clear description of the issue
  2. Proof of Concept: Steps to reproduce (if safe to do so)
  3. Impact Assessment: Potential impact and affected versions
  4. Suggested Fix: Proposed solution (if you have one)

What to Expect

  1. Acknowledgment: Confirmation of receipt within 48 hours
  2. Assessment: Initial assessment within 5 business days
  3. Fix Development: Security patch development
  4. Disclosure: Coordinated disclosure once patch is available
  5. Credit: Public acknowledgment of responsible disclosure (if desired)

Vulnerability Disclosure Timeline

  • Day 0: Vulnerability reported
  • Day 1-2: Acknowledgment and initial triage
  • Day 3-7: Detailed assessment and impact analysis
  • Day 8-30: Security patch development and testing
  • Day 31+: Coordinated public disclosure

Security Audit History

Internal Audits

  • v1.0.0: Complete security review of all components
  • Ongoing: Automated security scanning via CI/CD pipeline

External Audits

No external security audits have been conducted yet. We welcome professional security audits from qualified firms.

Security Updates

How We Handle Security Issues

  1. Immediate Response: Critical issues are addressed immediately
  2. Security Patches: Released as patch versions (e.g., 1.0.1)
  3. Advance Notice: Registered users may receive advance notification
  4. Public Disclosure: Full disclosure after patches are available

Staying Informed

  • GitHub Releases: Subscribe to release notifications
  • Security Advisories: GitHub Security Advisory system
  • Mailing List: [If available] Security-focused mailing list

Compliance and Standards

Cryptographic Standards

  • NIST Recommendations: Follows NIST cryptographic guidelines
  • RFC Compliance: Adheres to relevant RFC standards
  • Industry Best Practices: Implements recognized security patterns

Code Quality

  • Static Analysis: Bandit security linter integration
  • Dependency Scanning: Regular vulnerability scanning of dependencies
  • Type Safety: Comprehensive type hints and mypy checking
  • Test Coverage: >90% test coverage including security tests

FAQ

Is this library production-ready?

Yes, version 1.0+ is designed for production use with proper security measures.

Can I use this for high-value commitments?

The library implements sound cryptographic principles, but consider a professional audit for high-stakes applications.

What happens if a vulnerability is found?

We follow responsible disclosure practices and will patch vulnerabilities promptly.

How often should I update?

Stay current with the latest patch version for security updates.

Is the ZKP implementation secure?

The implementation follows established cryptographic principles, but it's a simplified version. For complex ZKP needs, consider specialized libraries.


Last Updated: 2024-01-01 Next Review: 2024-07-01

There aren’t any published security advisories