| Crates.io | crucible-compliance |
| lib.rs | crucible-compliance |
| version | 0.1.0 |
| created_at | 2025-12-28 03:32:44.035853+00 |
| updated_at | 2025-12-28 03:32:44.035853+00 |
| description | HIPAA/PCI-DSS/SOC2 compliance validation for Crucible architecture definitions |
| homepage | https://github.com/anvanster/crucible |
| repository | https://github.com/anvanster/crucible |
| max_upload_size | |
| id | 2008185 |
| size | 229,889 |
Compliance validation for Crucible architecture definitions. Validate your architecture against regulatory frameworks like HIPAA, PCI-DSS, and SOC2 before writing code.
Crucible Compliance validates your architecture definitions against compliance frameworks:
cargo install crucible-compliance
Or build from source (part of the Crucible monorepo):
git clone https://github.com/anvanster/crucible
cd crucible/crucible-compliance
cargo build --release
# Validate a project against all loaded frameworks
crucible-comply --project /path/to/project
# Validate against specific framework
crucible-comply --project . --frameworks HIPAA
# Use custom framework file
crucible-comply --project . --framework-path ./my-framework.json
# Output as JSON for CI/CD integration
crucible-comply --project . --output json
# Output as SARIF for IDE integration
crucible-comply --project . --output sarif
# Output as HTML for audit reports
crucible-comply --project . --output html -O report.html
# List available frameworks
crucible-comply --list-frameworks
# Strict mode (fail on warnings too)
crucible-comply --project . --strict
use crucible_compliance::{
ComplianceValidator, Framework, FrameworkLoader,
OutputFormat, ReportConfig, Reporter,
};
use crucible_core::Parser;
// Load compliance frameworks
let mut loader = FrameworkLoader::new();
loader.load_directory("./frameworks")?;
// Load your Crucible project
let parser = Parser::new(".crucible");
let project = parser.parse_project()?;
// Validate against HIPAA
let framework = loader.get("HIPAA").unwrap();
let validator = ComplianceValidator::new(framework);
let report = validator.validate(&project)?;
// Check results
if report.passed() {
println!("Compliance validation passed!");
} else {
println!("Found {} errors and {} warnings",
report.error_count(),
report.warning_count()
);
}
// Generate formatted output
let reporter = Reporter::html();
let html = reporter.format(&report);
Crucible Compliance uses annotations in your architecture definitions to validate compliance. Common annotations include:
@phi - Protected Health Information (HIPAA)@pii - Personally Identifiable Information@ephi - Electronic PHI@requires-auth - Requires authentication@requires-role - Requires role-based authorization@phi-access - Method accesses PHI@encrypted - Data is encrypted at rest@https-only - Requires TLS transport@audit-logged - Access is audit logged{
"module": "patient",
"version": "1.0.0",
"exports": {
"PatientRecord": {
"type": "class",
"properties": {
"ssn": {
"type": "string",
"annotations": ["@phi", "@encrypted"]
},
"name": {
"type": "string",
"annotations": ["@pii"]
}
},
"methods": {
"getRecord": {
"annotations": ["@requires-auth", "@phi-access"],
"effects": ["audit.log"],
"returns": { "type": "PatientRecord" }
}
}
}
}
}
| Format | Description | Use Case |
|---|---|---|
text |
Human-readable terminal output | Development |
json |
Structured JSON | CI/CD pipelines, automation |
sarif |
Static Analysis Results Format | IDE integration, GitHub |
markdown |
Markdown report | Documentation, PRs |
html |
Styled HTML report | Audits, compliance evidence |
The HIPAA framework includes 53 rules covering:
Administrative Safeguards (164.308)
Technical Safeguards (164.312)
Organizational Requirements (164.314)
Each rule includes:
Create custom compliance frameworks by defining JSON files:
{
"compliance_framework": "MyFramework",
"version": "1.0.0",
"description": "Custom compliance rules",
"requirements": [...],
"rules": [
{
"id": "my-rule",
"severity": "error",
"description": "Description of the rule",
"validates": {
"type": "effect_check",
"when_effect": ["logging"],
"forbidden_data": ["@sensitive"]
}
}
]
}
Validates that certain effects don't access forbidden data:
{
"type": "effect_check",
"when_effect": ["logging"],
"forbidden_data": ["@phi"]
}
Requires certain effects when accessing specific data:
{
"type": "effect_requirement",
"when_accessing": ["@phi-access"],
"required_effects": ["audit.log"]
}
Validates storage annotations for data types:
{
"type": "storage_check",
"when_accessing": ["@phi"],
"required_annotations": ["@encrypted"]
}
Validates method annotations for data access:
{
"type": "data_access_check",
"when_accessing": ["@phi"],
"required_annotations": ["@requires-auth"]
}
This software is licensed under the Business Source License 1.1.
The Licensed Work will become available under the Apache License 2.0 on December 31, 2029.