mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-10-21 06:11:31 +08:00
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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user