test(mxc): redact probe output before logging

Detect and redact a raw provider token before the credential probe result can reach console or CI logs.

Signed-off-by: Akber Raza <akberr@nvidia.com>
This commit is contained in:
Akber Raza
2026-09-16 17:29:15 -07:00
committed by Drew Newberry
parent 621443bd1c
commit 0815ec87d7
@@ -275,6 +275,11 @@ try {
throw "probe did not produce $resultFile within 150 seconds"
}
$resultText = [System.IO.File]::ReadAllText($resultFile, [System.Text.Encoding]::UTF8)
if (-not [string]::IsNullOrWhiteSpace($githubToken) -and $resultText.Contains($githubToken)) {
$rawTokenLeak = $true
$resultText = $resultText.Replace($githubToken, "***REDACTED***")
[System.IO.File]::WriteAllText($resultFile, $resultText, $utf8NoBom)
}
Write-Host $resultText
if ($resultText -notmatch 'OVERALL: PASS') {
throw "in-sandbox provider credential checks failed"