فینورا پرو - سامانه جامع حسابداری و صدور فاکتور
test(holoo): add fail-closed lab readiness check
Davood Mehraban committed
Nov 22, 2026 at 19:56 UTC
dca2e8ab83a2a2b6b33c274e7dd6777abe32ae4b
1 file changed
+47
scripts/holoo-lab-readiness.ps1
new
+47
@@ -0,0 +1,47 @@
1
+# Read-only Holoo lab prerequisite check. Never prints credentials or database contents.
2
+[CmdletBinding()]
3
+param([switch]$Json)
4
+$ErrorActionPreference = 'Stop'
5
+$checks = New-Object System.Collections.Generic.List[object]
6
+function Add-Check([string]$Name,[string]$Status,[string]$Detail) {
7
+ $checks.Add([pscustomobject]@{ name=$Name; status=$Status; detail=$Detail })
8
+}
9
+try {
10
+ $cpu = Get-CimInstance Win32_Processor | Select-Object -First 1
11
+ if ($null -eq $cpu) { Add-Check 'virtualization' 'UNKNOWN' 'CPU query returned no result' }
12
+ elseif ($cpu.VirtualizationFirmwareEnabled -eq $true) {
13
+ Add-Check 'virtualization' 'PASS' 'Firmware virtualization enabled'
14
+ } else {
15
+ Add-Check 'virtualization' 'BLOCKED' 'Firmware virtualization disabled; owner must enable it in BIOS/UEFI'
16
+ }
17
+} catch { Add-Check 'virtualization' 'UNKNOWN' 'Unable to query CPU virtualization state' }
18
+try {
19
+ $source = 'H:\Holoo\Holoo_dataSource.txt'
20
+ if (-not (Test-Path -LiteralPath $source -PathType Leaf)) {
21
+ Add-Check 'runtime-source' 'UNKNOWN' 'Runtime source file not found'
22
+ } else {
23
+ # Do not print connection strings, server names, usernames, or secrets.
24
+ Add-Check 'runtime-source' 'INFO' 'Runtime source file exists; isolation not established by this check'
25
+ }
26
+} catch { Add-Check 'runtime-source' 'UNKNOWN' 'Runtime source file could not be inspected' }
27
+try {
28
+ $svc = @(Get-Service -Name 'MSSQL$FINORA_LAB' -ErrorAction SilentlyContinue)
29
+ if ($svc.Count -gt 0) {
30
+ Add-Check 'dedicated-sql-service' 'INFO' 'Candidate lab service exists; independence and permissions require separate validation'
31
+ } else {
32
+ Add-Check 'dedicated-sql-service' 'BLOCKED' 'No dedicated FINORA_LAB SQL service detected; service name is configurable'
33
+ }
34
+} catch { Add-Check 'dedicated-sql-service' 'UNKNOWN' 'Could not inspect SQL services' }
35
+Add-Check 'synthetic-data' 'UNVERIFIED' 'Synthetic-only dataset must be validated manually before behavioral tests'
36
+Add-Check 'least-privilege' 'UNVERIFIED' 'Lab-only restricted account must be validated manually'
37
+Add-Check 'network-isolation' 'UNVERIFIED' 'Offline or isolated VM network must be validated manually'
38
+$blocked = @($checks | Where-Object { $_.status -in @('BLOCKED','UNVERIFIED','UNKNOWN') }).Count
39
+$result = [pscustomobject]@{
40
+ schemaVersion = 1
41
+ readyForTrace = ($blocked -eq 0)
42
+ checks = $checks.ToArray()
43
+}
44
+if ($Json) { $result | ConvertTo-Json -Depth 5 }
45
+else { $checks | Format-Table -AutoSize; Write-Output ('READY_FOR_TRACE=' + $result.readyForTrace) }
46
+# A read-only check cannot authorize trace or write operations.
47
+if ($blocked -gt 0) { exit 2 }