Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/smoke-macos-arm64.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/stringutil/sanitize.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func SanitizeErrorMessage(message string) string {
if commonWorkflowKeywords[match] {
return match
}
// Don't redact gh-aw public configuration variables (e.g., GH_AW_SKIP_NPX_VALIDATION)
if strings.HasPrefix(match, "GH_AW_") {
return match
}
sanitizeLog.Printf("Redacted snake_case secret pattern: %s", match)
return "[REDACTED]"
})
Expand Down
43 changes: 43 additions & 0 deletions pkg/stringutil/sanitize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,49 @@ func TestSanitizeErrorMessage_EdgeCases(t *testing.T) {
}
}

func TestSanitizeErrorMessage_GhAwVariables(t *testing.T) {
tests := []struct {
name string
message string
expected string
}{
{
name: "GH_AW_SKIP_NPX_VALIDATION not redacted",
message: "Alternatively, disable validation by setting GH_AW_SKIP_NPX_VALIDATION=true",
expected: "Alternatively, disable validation by setting GH_AW_SKIP_NPX_VALIDATION=true",
},
{
name: "GH_AW_SKIP_UV_VALIDATION not redacted",
message: "Alternatively, disable validation by setting GH_AW_SKIP_UV_VALIDATION=true",
expected: "Alternatively, disable validation by setting GH_AW_SKIP_UV_VALIDATION=true",
},
{
name: "GH_AW_SKIP_PIP_VALIDATION not redacted",
message: "Alternatively, disable validation by setting GH_AW_SKIP_PIP_VALIDATION=true",
expected: "Alternatively, disable validation by setting GH_AW_SKIP_PIP_VALIDATION=true",
},
{
name: "generic GH_AW prefix not redacted",
message: "Set GH_AW_SOME_OPTION to configure this feature",
expected: "Set GH_AW_SOME_OPTION to configure this feature",
},
{
name: "non-GH_AW still redacted",
message: "Error accessing MY_SECRET_KEY",
expected: "Error accessing [REDACTED]",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := SanitizeErrorMessage(tt.message)
if result != tt.expected {
t.Errorf("SanitizeErrorMessage(%q) = %q; want %q", tt.message, result, tt.expected)
}
})
}
}

func TestSanitizeErrorMessage_RealWorldExamples(t *testing.T) {
tests := []struct {
name string
Expand Down