This document provides security guidelines and best practices for using rules_rocq_rust in production environments, especially for security-critical applications like those in pulseengine repositories.
rules_rocq_rust is designed with security in mind, following these principles:
- Hermetic Builds: All toolchains are downloaded and verified
- Checksum Verification: All downloads are verified with SHA256 checksums
- No System Dependencies: Tools are self-contained and isolated
- Enterprise Support: Designed for air-gap and corporate environments
- Checksum Verification: All toolchain downloads are verified using SHA256 checksums
- Hermetic Downloads: Tools are downloaded from verified sources only
- No System Tools: No reliance on system-installed tools that could be compromised
- Air-Gap Support: Full offline mode with vendored toolchains
- Corporate Mirror Support: Download from internal mirrors
- Vendor Directory Support: Use shared network storage for toolchains
- Environment Variables: All sensitive configurations use environment variables
- No Hardcoded Secrets: No credentials or secrets in source code
- Minimal Permissions: Toolchain operations use least privilege
- Verify Checksums: Always verify checksums before using toolchains
- Use Vendored Toolchains: For production, use vendored toolchains in air-gap mode
- Regular Updates: Keep toolchains updated with security patches
- Monitor Dependencies: Watch for security advisories in dependencies
- Use Verified Toolchains: Only use toolchains from trusted sources
- Check Proof Validity: Always verify that proofs are valid and complete
- Review Generated Code: Check coq-of-rust generated code for correctness
- Follow Secure Coding: Apply security best practices to Rust and Coq code
- Sign Build Artifacts: Sign all build outputs and verification results
- Verify Before Deployment: Ensure all proofs pass before deployment
- Monitor Build Environment: Protect build servers from tampering
- Audit Logs: Maintain comprehensive logs of verification activities
# Enable offline mode for air-gap environments
export BAZEL_ROCQ_OFFLINE=1
# Use corporate mirror
export BAZEL_ROCQ_MIRROR=https://internal-mirror.company.com
# Use custom vendor directory
export BAZEL_ROCQ_VENDOR_DIR=/secure/vendor/toolchains
# Enable local testing (development only)
export BAZEL_ROCQ_LOCAL_TEST=1# In MODULE.bazel - use verified toolchains
rocq = use_extension("@rules_rocq_rust//rocq:extensions.bzl", "rocq")
rocq.toolchain(
version = "2025.01.0",
strategy = "download", # Hermetic download only
)
# For air-gap environments
coq_of_rust = use_extension("@rules_rocq_rust//coq_of_rust:extensions.bzl", "coq_of_rust")
coq_of_rust.toolchain(
version = "0.5.0",
strategy = "build", # Build from verified source
)- Verify all toolchain checksums
- Test toolchain downloads in staging environment
- Configure proper access controls for toolchains
- Set up monitoring for toolchain updates
- Document security procedures for your team
- Verify cryptographic algorithm implementations
- Prove security properties formally
- Test with known attack vectors
- Review proof assumptions carefully
- Document security guarantees explicitly
- Prove semantic preservation
- Verify termination properties
- Check performance guarantees
- Test edge cases thoroughly
- Document optimization invariants
# Test toolchain integrity
bazel test //test:toolchain_test
# Test download functionality
bazel test //test:real_download_test
# Test complete workflow
bazel test //test:complete_workflow_test# Validate all proofs
bazel test //examples/advanced_validation:test_all
# Test proof metrics
bazel test //examples/advanced_validation:test_comprehensive
# Check proof coverage
bazel test //examples/advanced_validation:test_coverage- Isolate: Stop using potentially compromised toolchains immediately
- Verify: Check checksums of all toolchain files
- Replace: Use known-good toolchains from secure source
- Investigate: Determine how compromise occurred
- Report: Notify security team and upstream providers
- Check Environment: Verify build environment integrity
- Re-run Tests: Confirm failure is reproducible
- Review Changes: Check for recent code changes
- Isolate Issue: Determine if it's code, toolchain, or environment
- Rollback: Use last known-good configuration if needed
For security issues with rules_rocq_rust:
- Report Privately: Contact the maintainers directly
- Responsible Disclosure: Allow time for fixes before public disclosure
- Provide Details: Include reproduction steps and impact assessment
Stay informed about security updates:
- Watch the GitHub repository for security advisories
- Subscribe to Coq and Rust security announcements
- Monitor formal verification toolchain security
rules_rocq_rust is licensed under Apache 2.0. This license:
- Allows free use, modification, and distribution
- Requires preservation of copyright notices
- Provides license and patent grants
- Does not impose copyleft requirements
Security Note: While the license is permissive, security is a shared responsibility. Users must ensure their specific configurations and integrations are secure.
rules_rocq_rust provides a secure foundation for formal verification, but security is a continuous process. Follow these guidelines, stay vigilant, and contribute to improving the security of the formal verification ecosystem.
Security is everyone's responsibility in the verification workflow.