Skip to content

Commit de3c2c3

Browse files
avrabeclaude
andcommitted
feat(security): TARA compliance and security hardening
Critical security fixes: - Fix timing attack vulnerability: replace == with ct_equal() for cryptographic comparisons in simple.rs and multi.rs - Add zeroization for intermediate message buffers using Zeroizing<Vec<u8>> - Enable overflow-checks in release profile for integer overflow detection Certificate pinning enforcement: - Create PinnedRustlsConnector using ureq's Connector trait - Enforce certificate pinning for Fulcio and Rekor connections - Custom ServerCertVerifier with SHA256 fingerprint validation TARA documentation for ISO/SAE 21434 and IEC 62443: - THREAT_MODEL.md: Complete STRIDE threat analysis - TARA_COMPLIANCE.md: Standards compliance mapping - KEY_LIFECYCLE.md: Key generation to destruction procedures - INCIDENT_RESPONSE.md: Security incident runbook - SECURITY.md: Document known limitations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 2e65540 commit de3c2c3

File tree

12 files changed

+1872
-66
lines changed

12 files changed

+1872
-66
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ panic = "abort"
2323
opt-level = "z" # Optimize for size
2424
lto = true # Enable link-time optimization
2525
strip = true # Strip symbols
26+
# SECURITY: Detect integer overflow in release builds (TARA requirement)
27+
overflow-checks = true

SECURITY.md

Lines changed: 94 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -416,23 +416,19 @@ Certificate pinning adds defense-in-depth protection for TLS connections to Sigs
416416

417417
### Implementation Status
418418

419-
**Current State:** Infrastructure complete, enforcement pending HTTP client support
419+
**Current State:** ✅ Fully implemented and enforced
420420

421-
The wsc library includes complete certificate pinning infrastructure:
422-
- SHA256 fingerprint validation
423-
- Configurable pins via environment variables
421+
The wsc library includes complete certificate pinning with enforcement:
422+
- SHA256 fingerprint validation for Fulcio and Rekor endpoints
423+
- Custom `PinnedRustlsConnector` using ureq's `Connector` trait
424424
- Custom `ServerCertVerifier` implementation using rustls
425425
- Support for multiple pinned certificates (rotation)
426-
427-
**Limitation:** The current HTTP client (`ureq` v3.x) does not expose APIs for custom TLS certificate verification. Certificate pinning will be automatically enforced once:
428-
429-
1. `ureq` adds support for custom `ServerCertVerifier`, OR
430-
2. wsc migrates to `reqwest` or another HTTP client with TLS customization
426+
- Configurable pins via environment variables
431427

432428
**Current Behavior:**
433-
- Standard WebPKI validation is performed
434-
- Pinning checks are logged for monitoring
435-
- Connections succeed even if pins don't match
429+
- Certificate pinning is enforced for all Fulcio/Rekor connections
430+
- Connections fail if certificates don't match expected pins
431+
- Falls back to standard WebPKI validation only if pinning initialization fails
436432

437433
### Configuration
438434

@@ -544,6 +540,79 @@ wsc's keyless signing **is built on** Sigstore infrastructure (Fulcio + Rekor) b
544540

545541
---
546542

543+
## Known Limitations
544+
545+
This section documents known security limitations that users should be aware of.
546+
547+
### 1. No OCSP/CRL Certificate Revocation (IEC 62443 Gap)
548+
549+
**Limitation:** WSC does not implement OCSP (Online Certificate Status Protocol) or CRL (Certificate Revocation Lists) checking.
550+
551+
**Impact:** Cannot revoke a compromised signing certificate before its natural expiration.
552+
553+
**Mitigation:** Fulcio certificates have a 10-minute validity window, inherently limiting the exposure window. For long-lived certificates (non-Fulcio deployments), use short validity periods (1-7 days).
554+
555+
**Roadmap:** OCSP stapling planned for Q2 2026 for non-Fulcio deployments.
556+
557+
### 2. HSM Integration Incomplete (IEC 62443 SL3+ Gap)
558+
559+
**Limitation:** Hardware Security Module support is scaffolded but not complete.
560+
561+
**Impact:** Cannot achieve Security Level 3+ under IEC 62443 without hardware-backed key storage.
562+
563+
**Mitigation:** Use file-based keys with strict permissions (0600), process isolation, and encrypted filesystems. The `platform/` module provides the interface for future HSM integration.
564+
565+
**Roadmap:** HSM integration for ATECC608A, TPM 2.0, and NXP SE050 planned for Q2 2026.
566+
567+
### 3. Swap File Exposure
568+
569+
**Limitation:** Key material in memory could be swapped to disk by the operating system.
570+
571+
**Impact:** Forensic recovery of key material from swap space theoretically possible.
572+
573+
**Mitigation:**
574+
- Use `mlock()` on production systems to prevent swapping
575+
- Use encrypted swap partitions
576+
- Ephemeral keys reduce exposure (sub-second lifetime)
577+
- Zeroization on drop minimizes window
578+
579+
**Note:** The `zeroize` crate ensures keys are cleared from memory, but cannot prevent OS-level swap writes before Drop is called.
580+
581+
### 4. Offline Verification Requires Trust Bundle Distribution
582+
583+
**Limitation:** Keyless signature verification requires Rekor access for inclusion proof verification.
584+
585+
**Impact:** Air-gapped or offline environments cannot verify keyless signatures without pre-fetching Rekor entries.
586+
587+
**Mitigation:**
588+
- Use certificate-based signing for offline environments
589+
- Pre-fetch and distribute Rekor entries with modules
590+
- The `--offline` flag supports verification with pre-distributed trust bundles
591+
592+
### 5. OIDC Token Exposure Window
593+
594+
**Limitation:** OIDC tokens exist in memory for the duration of the signing operation.
595+
596+
**Impact:** Memory dump during signing could expose token (until expiration).
597+
598+
**Mitigation:**
599+
- Tokens are zeroized immediately after use
600+
- Token lifetime is typically <15 minutes
601+
- GitHub Actions OIDC tokens are bound to specific workflow runs
602+
603+
---
604+
605+
## TARA Compliance Documentation
606+
607+
For automotive (ISO/SAE 21434) and industrial IoT (IEC 62443) deployments, see:
608+
609+
- [docs/THREAT_MODEL.md](docs/THREAT_MODEL.md) - STRIDE threat analysis
610+
- [docs/TARA_COMPLIANCE.md](docs/TARA_COMPLIANCE.md) - Standards compliance mapping
611+
- [docs/KEY_LIFECYCLE.md](docs/KEY_LIFECYCLE.md) - Key management procedures
612+
- [docs/INCIDENT_RESPONSE.md](docs/INCIDENT_RESPONSE.md) - Security incident runbook
613+
614+
---
615+
547616
## Reporting Security Issues
548617

549618
**Do not open public issues for security vulnerabilities.**
@@ -560,6 +629,17 @@ Include:
560629

561630
## Security Changelog
562631

632+
### v0.5.0 (Security Hardening Release)
633+
- ✅ **Fixed timing attack vulnerability** - Replaced `==` with constant-time comparison (`ct_codecs::verify`) for all cryptographic material comparisons in `simple.rs` and `multi.rs`
634+
- ✅ **Added intermediate buffer zeroization** - Message buffers now wrapped with `Zeroizing<Vec<u8>>` to prevent secret residue in memory
635+
- ✅ **Release profile hardening** - Added `overflow-checks = true` to detect integer overflow in release builds
636+
- ✅ **Certificate pinning enforcement** - Created custom `PinnedRustlsConnector` using ureq's `Connector` trait to enforce certificate pinning for Fulcio and Rekor connections
637+
- ✅ **TARA compliance documentation** - Added comprehensive documentation for ISO/SAE 21434 and IEC 62443 compliance:
638+
- `docs/THREAT_MODEL.md` - STRIDE analysis
639+
- `docs/TARA_COMPLIANCE.md` - Standards mapping
640+
- `docs/KEY_LIFECYCLE.md` - Key management procedures
641+
- `docs/INCIDENT_RESPONSE.md` - Security incident runbook
642+
563643
### v0.2.7
564644
- ✅ Added ephemeral key zeroization (Issue #14)
565645
- ✅ Added OIDC token zeroization (Issue #11)
@@ -569,7 +649,6 @@ Include:
569649
- ✅ Implemented certificate pinning infrastructure (Issue #12)
570650
- Complete SHA256 fingerprint validation
571651
- Support for custom pins via environment variables
572-
- Pending enforcement (requires HTTP client update)
573652

574653
### Previous
575654
- ✅ Implemented Rekor checkpoint-based verification (Issue #1)
@@ -588,5 +667,5 @@ Include:
588667

589668
---
590669

591-
**Last Updated:** 2025-01-15
592-
**Addresses:** Issues #2 (Security Model Documentation), #4 (Ephemeral Key Lifecycle)
670+
**Last Updated:** 2026-01-04
671+
**Addresses:** Issues #2 (Security Model Documentation), #4 (Ephemeral Key Lifecycle), #12 (Certificate Pinning)

0 commit comments

Comments
 (0)