Avoid string eval in service execution runbooks
This commit is contained in:
parent
1e143678f9
commit
3ebc7452a3
4 changed files with 25 additions and 15 deletions
|
|
@ -73,7 +73,7 @@ remembers doctrine; the branch remembers the blade.
|
|||
- 2026-06-18: `swarm-overview` action rows now enumerate every sealed service-lifecycle attention receipt instead of only the selected global recommendation. Each non-mutating readback row carries the receipt's service-manager artifact ref/status/hash/private flag; live wrapper proof `local-20260618-214044-049-a63d008c` printed priority 40 `cluster-service-execution-audit` with `artifactStatus=external-ref`, `sha256=none`, and `artifact=service-manager://windows/epiphany-cluster-daemon-services/cluster-execution-audit`, priority 41 `service-execution-audit` with `artifactStatus=external-ref`, `sha256=none`, and `artifact=service-manager://windows/epiphany-daemon-supervisor-service/execution-audit`, and the priority-50 elevated runbook row unchanged.
|
||||
- 2026-06-18: Service execution failed-check rows now carry `serviceId` and the compact TUI/PowerShell summaries render `serviceId::action=status`. Single-service overview audits are scoped to service ids from current service-lifecycle attention rows instead of blending all non-cluster receipts, so old EventLog proof scars cannot masquerade as Epiphany supervisor service evidence. Failed-check TUI rows also carry `followUp=<wrapper command>` for the receipt-producing/readback route; live wrapper proof `local-20260618-224925-221-8e114063` printed cluster follow-ups such as `cluster-service-execution-readiness`, `cluster-service-install-execute`, and `cluster-service-execution-audit`, plus supervisor-service follow-ups such as `service-execution-readiness`, `service-install-execute`, `service-status`, and `service-reconcile`, with `privateStateExposed=false`. Standalone `service-execution-audit` proof `local-20260618-215828-537-12b29ecf` printed the supervisor-service prefix on runbook witness and failed-check rows, and standalone `cluster-service-execution-audit` proof `local-20260618-215948-348-7be0110c` printed the cluster service prefix on runbook witness and failed-check rows.
|
||||
- 2026-06-18: Direct wrapper audit summaries now print actionable `failed check rows` for `cluster-service-execution-audit` and `service-execution-audit`: each row carries `serviceId::action=status`, artifact ref, local artifact SHA-256 when present, and `followUp=<wrapper command>`. Live proofs `local-20260618-225923-468-d818951a` and `local-20260618-225923-529-7cfa2bb3` showed the cluster execution scar and supervisor-service scar with exact follow-up wrapper modes while preserving `privateStateExposed=false`.
|
||||
- 2026-06-18: Direct execution-runbook summaries now print the explicit elevated invocation and post-run audit command. `cluster-service-execution-runbook` proof `local-20260618-230302-532-ba02c01c` printed `elevatedCommand=Start-Process PowerShell -Verb RunAs -Wait ...` and `aftercare=tools/epiphany_local_run.ps1 -Mode cluster-service-execution-audit`; `service-execution-runbook` proof `local-20260618-230302-517-cb2b650c` printed the matching single-service RunAs command plus `aftercare=tools/epiphany_local_run.ps1 -Mode service-execution-audit`. Both are non-mutating artifact rites until the operator explicitly runs the elevated command.
|
||||
- 2026-06-18/19: Direct execution-runbook summaries print the explicit elevated invocation and post-run audit command, and the generated child execution runbooks now invoke `tools/epiphany_local_run.ps1` through an explicit `ScriptPath` plus `Arguments` array instead of `Invoke-Expression` command strings. `cluster-service-execution-runbook` proof `local-20260619-010940-407-b0744f08` and `service-execution-runbook` proof `local-20260619-010940-287-a36a3df3` generated elevated artifacts with no `Invoke-Expression`, explicit argument arrays, artifact hashes, RunAs commands, and audit aftercare. Both are non-mutating artifact rites until the operator explicitly runs the elevated command.
|
||||
- 2026-06-18: Those direct execution-runbook summaries now also print `artifactSha256=<hash>` beside the elevated command and aftercare. Proof `local-20260618-230624-842-6bf65bee` printed cluster hash `3239ac17008b1ce857970e40b17d37a1ecf1631a3a6636bb2b8678312fb604a0`; proof `local-20260618-230624-759-fa808050` printed supervisor-service hash `b213a3c11a8f11a03061fcd743f507edaa59bc6767257b79cef63329596375e7`.
|
||||
- 2026-06-18: Direct start/stop control summaries now print receipt-producing readback and aftercare wrappers. Cluster control plan proof `local-20260618-231419-577-bf46881d` and non-elevated execute proof `local-20260618-231433-306-46912a0c` append `followUp=tools/epiphany_local_run.ps1 -Mode cluster-service-audit` plus `aftercare=tools/epiphany_local_run.ps1 -Mode cluster-service-execution-audit`; single-service plan proof `local-20260618-231446-756-ad230196` and non-elevated execute proof `local-20260618-231503-197-e86342f1` append `followUp=tools/epiphany_local_run.ps1 -Mode service-status` plus `aftercare=tools/epiphany_local_run.ps1 -Mode service-execution-audit`. Plan paths remain non-mutating, and execute paths remain elevation-gated.
|
||||
- 2026-06-18: Direct status/reconcile/readiness summaries now print the next wrapper route beside the sealed receipt. `service-status` proof `local-20260618-231732-162-b1abd238` points missing supervisor-service status to `service-reconcile` plus `service-execution-audit`; `service-reconcile` proof `local-20260618-231754-575-25cc8a48` points the missing service to `service-install-plan` plus `service-execution-audit`; `service-execution-readiness` proof `local-20260618-231825-381-8d28f3a9` points `not-elevated` to `service-execution-runbook` plus `service-execution-audit`; and `cluster-service-execution-readiness` proof `local-20260618-231849-435-65651fe1` points the seven-service `not-elevated` cluster wound to `cluster-service-execution-runbook` plus `cluster-service-execution-audit`.
|
||||
|
|
|
|||
Binary file not shown.
File diff suppressed because one or more lines are too long
|
|
@ -182,6 +182,16 @@ function ConvertTo-PowerShellLiteral {
|
|||
return "'" + $Value.Replace("'", "''") + "'"
|
||||
}
|
||||
|
||||
function ConvertTo-PowerShellArrayLiteral {
|
||||
param([string[]]$Values)
|
||||
|
||||
if ($null -eq $Values -or $Values.Count -eq 0) {
|
||||
return "@()"
|
||||
}
|
||||
|
||||
return "@(" + (($Values | ForEach-Object { ConvertTo-PowerShellLiteral $_ }) -join ", ") + ")"
|
||||
}
|
||||
|
||||
function Get-ElevatedRunbookCommand {
|
||||
param([string]$RunbookPath)
|
||||
|
||||
|
|
@ -1228,17 +1238,16 @@ if ($Mode -eq "cluster-service-execution-runbook") {
|
|||
)
|
||||
$clusterExecutionRunbookFinalAuditMode = "cluster-service-execution-audit"
|
||||
|
||||
function New-ClusterRunbookCommand {
|
||||
function New-ClusterRunbookArgs {
|
||||
param([string]$RunbookMode)
|
||||
|
||||
$args = @("-Mode", $RunbookMode) + $baseWrapperArgs
|
||||
return "& " + (ConvertTo-NativeArgument $wrapperScriptPath) + " " + (($args | ForEach-Object { ConvertTo-NativeArgument $_ }) -join " ")
|
||||
return @("-Mode", $RunbookMode) + $baseWrapperArgs
|
||||
}
|
||||
|
||||
function New-RunbookStepLine {
|
||||
param([string]$RunbookMode)
|
||||
|
||||
return "Invoke-EpiphanyRunbookStep -Name " + (ConvertTo-NativeArgument $RunbookMode) + " -Command " + (ConvertTo-NativeArgument (New-ClusterRunbookCommand $RunbookMode))
|
||||
return "Invoke-EpiphanyRunbookStep -Name " + (ConvertTo-PowerShellLiteral $RunbookMode) + " -ScriptPath " + (ConvertTo-PowerShellLiteral $wrapperScriptPath) + " -Arguments " + (ConvertTo-PowerShellArrayLiteral (New-ClusterRunbookArgs $RunbookMode))
|
||||
}
|
||||
|
||||
$runbookLines = @(
|
||||
|
|
@ -1256,12 +1265,13 @@ if ($Mode -eq "cluster-service-execution-runbook") {
|
|||
"function Invoke-EpiphanyRunbookStep {",
|
||||
" param(",
|
||||
" [Parameter(Mandatory = `$true)][string]`$Name,",
|
||||
" [Parameter(Mandatory = `$true)][string]`$Command",
|
||||
" [Parameter(Mandatory = `$true)][string]`$ScriptPath,",
|
||||
" [Parameter(Mandatory = `$true)][string[]]`$Arguments",
|
||||
" )",
|
||||
" Write-Host `"==> `$Name`"",
|
||||
" try {",
|
||||
" `$global:LASTEXITCODE = 0",
|
||||
" Invoke-Expression `$Command",
|
||||
" & `$ScriptPath @Arguments",
|
||||
" if (`$null -ne `$global:LASTEXITCODE -and `$global:LASTEXITCODE -ne 0) {",
|
||||
" throw `"Command exited with code `$global:LASTEXITCODE`"",
|
||||
" }",
|
||||
|
|
@ -1387,17 +1397,16 @@ if ($Mode -eq "service-execution-runbook") {
|
|||
$baseWrapperArgs += @("-ServiceDisplayName", $ServiceDisplayName)
|
||||
}
|
||||
|
||||
function New-RunbookCommand {
|
||||
function New-ServiceRunbookArgs {
|
||||
param([string]$RunbookMode)
|
||||
|
||||
$args = @("-Mode", $RunbookMode) + $baseWrapperArgs
|
||||
return "& " + (ConvertTo-NativeArgument $wrapperScriptPath) + " " + (($args | ForEach-Object { ConvertTo-NativeArgument $_ }) -join " ")
|
||||
return @("-Mode", $RunbookMode) + $baseWrapperArgs
|
||||
}
|
||||
|
||||
function New-ServiceRunbookStepLine {
|
||||
param([string]$RunbookMode)
|
||||
|
||||
return "Invoke-EpiphanyRunbookStep -Name " + (ConvertTo-NativeArgument $RunbookMode) + " -Command " + (ConvertTo-NativeArgument (New-RunbookCommand $RunbookMode))
|
||||
return "Invoke-EpiphanyRunbookStep -Name " + (ConvertTo-PowerShellLiteral $RunbookMode) + " -ScriptPath " + (ConvertTo-PowerShellLiteral $wrapperScriptPath) + " -Arguments " + (ConvertTo-PowerShellArrayLiteral (New-ServiceRunbookArgs $RunbookMode))
|
||||
}
|
||||
|
||||
$runbookLines = @(
|
||||
|
|
@ -1415,12 +1424,13 @@ if ($Mode -eq "service-execution-runbook") {
|
|||
"function Invoke-EpiphanyRunbookStep {",
|
||||
" param(",
|
||||
" [Parameter(Mandatory = `$true)][string]`$Name,",
|
||||
" [Parameter(Mandatory = `$true)][string]`$Command",
|
||||
" [Parameter(Mandatory = `$true)][string]`$ScriptPath,",
|
||||
" [Parameter(Mandatory = `$true)][string[]]`$Arguments",
|
||||
" )",
|
||||
" Write-Host `"==> `$Name`"",
|
||||
" try {",
|
||||
" `$global:LASTEXITCODE = 0",
|
||||
" Invoke-Expression `$Command",
|
||||
" & `$ScriptPath @Arguments",
|
||||
" if (`$null -ne `$global:LASTEXITCODE -and `$global:LASTEXITCODE -ne 0) {",
|
||||
" throw `"Command exited with code `$global:LASTEXITCODE`"",
|
||||
" }",
|
||||
|
|
|
|||
Reference in a new issue