SmrtHub Retention & Legal Hold Plan (Phase 3)¶
Last updated: 2025-11-20
1. Purpose & Scope¶
- Establish the canonical models, config locations, and evidence flows for retention policies and legal holds introduced in Phase 3 of the Compliance roadmap.
- Provide a single reference that engineering, support, and compliance teams can follow while HubWindow’s WinUI3 UI is still under construction.
- Applies to all SmrtHub runtimes (Supervisor, Storage Guard service host, Support Bundle exporter, python_core automation).
2. Control Surfaces¶
2.1 Production (future)¶
- HubWindow Settings ➜ Advanced ➜ "Retention & Legal Holds" (WinUI3)
- Two panels: Retention Policies and Legal Holds.
- Uses shared models from
Smrt.Retention(see section 3) and persists viaSmrt.Configinto canonical JSON files. - Presents audit metadata (last verification time, next run, outstanding alerts).
2.2 Interim (development/testing)¶
- Supervisor configuration
appsettings.jsongainsRetentionPolicies+LegalHoldStoresections referencing shared JSON artifacts.- Supervisor CLI verbs:
--retention-status(dump effective policy + verification health)--add-legal-hold --name <string> --provider <slug> --scope <path/pattern> --reason <string>--clear-legal-hold --id <guid>--export-retention-evidence(copies the latest verification report + policy snapshots for manual review).
- Temporary system tray action
- HubWindow tray menu exposes "Open Retention Config Folder" to help admins edit JSON until WinUI landing page is ready.
3. Shared Models (SmrtApps/src/Smrt.Retention)¶
| Type | Purpose | Fields |
|---|---|---|
RetentionPolicy |
Defines per-provider windows & safeguards | ProviderSlug, DisplayName, RetentionDays, MinimumCopies, FreeSpaceFloorPercent, MaxArtifactSizeMb, Notes |
LegalHold |
Represents an active hold | Id (Guid), Name, ProviderSlug, Scope (path pattern or label), CreatedUtc, CreatedBy, ExpiresUtc?, Reason, Tickets, IsSystemHold |
RetentionConfiguration |
Root persisted via Smrt.Config |
DefaultPolicy, Policies[], LegalHolds[], EmergencyPurgeAllowed, LastUpdatedUtc, UpdatedBy |
RetentionEvidence |
Output of verification worker | VerificationId, GeneratedUtc, PoliciesHash, LegalHoldHash, Providers[], Warnings[], Errors[], SignaturePath |
3.1 Validation Rules¶
RetentionDays: 1–9999 and ≤ 731: enforce corporate upper bounds (default 365).MinimumCopies: default 1, cannot exceed 10.FreeSpaceFloorPercent: default 15%; if breached, verification logs a warning and marks providerDegraded.LegalHold.Scope: supports folder glob (c:\data\*), provider-native label (sharepoint:Site/Library), or artifact tag.- Legal holds override retention windows; artifacts matching any active hold are excluded from purge plans.
- All models serialized via
ConfigJson.AtomicWriteto%ProgramData%/SmrtHub/Config/retention/retention-policy.json(shared) with.bakbackup.
4. Evidence & Storage Locations¶
| Artifact | Path | Producer | Notes |
|---|---|---|---|
| Policies JSON | %ProgramData%/SmrtHub/Config/retention/retention-policy.json |
Supervisor/HubWindow | Shared by all hosts; fall back to %LocalAppData% on dev boxes. |
| Legal holds JSON | %ProgramData%/SmrtHub/Config/retention/legal-holds.json |
Supervisor/HubWindow | Same atomic write guarantees. |
| Verification reports | %ProgramData%/SmrtHub/Logs/system-info/retention/retention-verification.json (daily) + .sig |
Storage Guard service | Signed by Storage Guard shared secret; includes hash of policies + holds. |
| CLI exports | %ProgramData%/SmrtHub/Logs/system-info/retention/exports/* |
Supervisor CLI | Zips latest policy + evidence for auditors. |
4.1 Development Seed Data¶
- The repo now ships mocked retention artifacts so Support Bundle previews and SmrtSupport presets surface realistic evidence without waiting on the production verification worker.
- Seeds live under
SmrtHub/Config/retention/(policies + legal holds) andSmrtHub/Logs/system-info/retention/(verification JSON,.sig, health summary, provider logs). - The sample verification references OneDrive Enterprise and iCloud Drive so the Compliance preset aligns with the seeded legal holds. Refresh the files whenever presets introduce new providers or hashes.
5. Scheduled Verification Job¶
5.1 Host & Cadence¶
- Lives inside
Smrt.StorageGuard.ServiceHostasRetentionVerificationWorker. - Default cadence: every 6 hours (
RetentionVerification:IntervalMinutes), overridable via config. - Shares the existing secret + signing infrastructure; writes JSON + HMAC signature per run.
5.2 Workflow¶
- Load
RetentionConfiguration+LegalHoldsviaSmrt.Config. - Enumerate providers using provider adapters (OneDrive, SharePoint, SMB, LocalArchive) defined in
Smrt.Retention.Providers. - For each provider, gather:
- Actual stored artifacts (counts, age distribution, free space, applied labels).
- Legal hold coverage (which artifacts are hold-protected).
- Compare findings to policy constraints and record results (Pass/Warning/Error) with remediation guidance.
- Emit structured log events under slug
retention-verifierand append to the signed report. - Notify Supervisor by writing a health summary to
%ProgramData%/SmrtHub/Logs/system-info/retention/retention-health.jsonwithStatus: Healthy|Warning|ErrorandConsecutiveFailures.
5.3 Alerting & Telemetry¶
- Smrt.Logging: events include
VerificationId,Provider,Status,ActionRequired,LegalHoldCount. - Supervisor metrics: ingestion thread reads
retention-health.jsonand surfaces status on the health endpoint + CLI. - Support Bundle: new provider (section 7) copies the latest
retention-verification.json,.sig, andretention-health.json.
6. Interim Automation & CLI¶
- Supervisor CLI verbs (see section 2.2) call into
Smrt.Retentionhelpers to mutate policies/holds with validation. - Add
SmrtHubSupervisor:Retentionconfig section documenting: - Provide PowerShell helper script
Tools/Retention/Invoke-RetentionCli.ps1for unattended automation.
7. Support Bundle Integration¶
Smrt.SupportBundlenow ships withRetentionEvidenceProvider, which packages:retention-policy.jsonlegal-holds.json- Latest
retention-verification.json+.sig retention-health.json- Provider-specific automation logs dropped under
%ProgramData%/SmrtHub/Logs/system-info/retention/providers/<slug>/*.json - The provider mirrors Storage Guard handling—artifacts are copied under
system-info/retention/and participate in sanitization, manifest hashing, and review reports. - Follow-up: update bundle manifest schema to expose a
RetentionEvidencesummary (per-provider status + verification timestamp) and add redaction-focused tests for legal hold reasons.
8. Operator Workflow & Evidence Checklist¶
- Daily/weekly validation
- Supervisor CLI – run
SmrtHubSupervisor.exe --retention-statusto confirm the active policy, legal holds, and last verification time. Use--retention-export --output <network share>to stage the JSON artifacts whenever compliance requests evidence. - Storage Guard verification – confirm that
retention-verifierevents are present inSmrtHub/Logs/system-info/retention/retention-health.jsonand that the signed snapshot (storage-guard.json+.sig) now includes theRetentionpayload. If theStatusisWarning/Error, capture the associated log files before remediation. - Support Bundle capture – trigger
SupportBundleExporter(through HubWindow tray or CLI harness) withExportCategories.SystemInfoenabled. Validate that the bundle containssystem-info/storage-guard.json,system-info/storage-guard.sig,system-info/storage-guard-verification.json, and the fullsystem-info/retention/folder (policies, legal holds, verification JSON +.sig, health summary, provider logs). - Archive & ticket – attach the retention export directory and the Support Bundle ZIP to the compliance ticket, recording operator ID and timestamp. SnapRun support deletes received bundles after the case closes per the Privacy/Security policy.
- Escalation path
- If Supervisor CLI returns a validation error, fix the JSON locally and retry
--retention-apply. For production, always supply--updated-by <corp operator>so audit trails capture ownership. - If Storage Guard verification fails cryptographically, run
SmrtHubSupervisor.exe --retention-exportand attach the failing snapshot/signature pair so engineering can diagnose mismatches. - If Support Bundle is missing retention evidence, ensure the Storage Guard/retention directories exist under
%ProgramData%/SmrtHuband rerun with elevated privileges.
9. Provider Automation & Runbooks¶
| Provider | Automation | Evidence Captured |
|---|---|---|
| OneDrive / SharePoint | Microsoft Graph PowerShell module scripts assign retention labels + legal holds. Scripts output JSON summaries stored under providers/sharepoint/*.json. |
Label status per site/library, hold coverage list, last run timestamp. |
| SMB / File Server | Windows FSRM templates enforce quotas + retention tasks (scheduled via Task Scheduler). Logs under providers/smb/*.json show job outcome + list of deleted/preserved files. |
|
| Local Archive / External Drives | Operator checklist (signed) maintained in %ProgramData%/SmrtHub/Logs/system-info/retention/providers/local-archive/acknowledgement.json. Includes device serial, seal status, handoff ticket. |
|
| Cloud Buckets (future) | Placeholder for S3/Azure Blob policies; spec reserved for Phase 4+. |
Runbacks live in MKDocs/docs/runbooks/Retention/ with mirrored entries summarized in README.Files/SmrtHub-Retention-and-LegalHold.README.md once automation ships.
10. Testing Expectations¶
- Unit tests inside
SmrtApps/tests/Smrt.Retention.Testscovering model validation, serialization, and policy conflict detection. - Integration tests for Storage Guard worker verifying signed outputs + failure scenarios (missing provider adapter, insufficient free space, expired hold).
- Supervisor CLI tests ensuring commands mutate JSON atomically and reject invalid inputs.
- Support Bundle tests verifying new provider captures files and redactions.
11. Implementation Roadmap¶
- Scaffold
Smrt.Retentionlibrary + tests. - Wire Supervisor config + CLI to use shared library.
- Implement
RetentionVerificationWorkerinside Storage Guard host; produce evidence files + telemetry. - Add Support Bundle provider + automation logs ingestion.
- Author runbooks + MKDocs page referencing this plan.
- Integrate HubWindow UI once advanced settings shell is ready.
Questions or updates: coordinate via Phase 3 tracking issue; update this README when behavior changes or new providers are added.