Conversation
…ert #34) This fix addresses CWE-312, CWE-315, and CWE-359 vulnerabilities where sensitive data from secret configurations could flow through error messages to logging output. Changes: - Removed detailed error messages from workflow compilation failures - Changed from logging full error details to generic error messages - Added security-focused comments explaining the fix 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR attempts to fix a CodeQL-reported security vulnerability (Alert #34) by removing detailed error information from workflow compilation failures in the mcp add command. The fix replaces specific error messages with generic ones to prevent potential exposure of sensitive information through logs.
Key Changes:
- Modified error logging in
mcp_add.goto use generic messages instead of detailed error output - Added security-focused comments explaining the CWE references
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Security fix for CWE-312, CWE-315, CWE-359: Avoid logging detailed error messages | ||
| // that could contain sensitive information from secret references | ||
| mcpAddLog.Print("Workflow compilation failed") | ||
| fmt.Println(console.FormatWarningMessage("Workflow compilation failed. Please check your workflow configuration.")) |
There was a problem hiding this comment.
This security fix is overly broad and doesn't address the actual vulnerability. The fix suppresses all compilation error details, but the actual risk is specifically from logging secret values or references.
Analysis of the claim:
The PR description states that "sensitive data from secret configurations could flow through error messages to logging output." However:
-
Secret references are safe to log: Expressions like
${{ secrets.MY_SECRET }}are placeholder references, not the actual secret values. GitHub Actions never exposes the actual secret values in error messages - it only shows the reference syntax. -
CompileWorkflow errors don't contain secret values: The compilation errors come from validation logic (schema validation, permission checks, expression safety, etc.) and contain structural information about the workflow configuration, not secret values.
-
Actual secret values are never in the workflow file: The workflow markdown file only contains secret references (e.g.,
${{ secrets.API_KEY }}), never actual secret values. Secret values are stored in GitHub's encrypted secrets store and are only injected at runtime by GitHub Actions.
Better solution:
Instead of suppressing all error details (which hurts debugging), implement targeted sanitization of the error message if specific sensitive patterns are detected. However, based on the code review, there's no evidence that CompileWorkflow errors actually contain sensitive information that needs redaction.
Impact on user experience:
Users lose valuable debugging information when compilation fails. The generic message "Workflow compilation failed. Please check your workflow configuration." doesn't tell them what's wrong, forcing them to run gh aw compile separately to see the actual error.
| // Security fix for CWE-312, CWE-315, CWE-359: Avoid logging detailed error messages | |
| // that could contain sensitive information from secret references | |
| mcpAddLog.Print("Workflow compilation failed") | |
| fmt.Println(console.FormatWarningMessage("Workflow compilation failed. Please check your workflow configuration.")) | |
| mcpAddLog.Print(fmt.Sprintf("Workflow compilation failed: %v", err)) | |
| fmt.Println(console.FormatErrorMessage(fmt.Sprintf("Workflow compilation failed: %v", err))) |
Security Fix: Prevent Clear-text Logging of Sensitive Information
Alert Number: #34
Severity: High
Rule: go/clear-text-logging
Vulnerability Description
CodeQL detected that sensitive data from secret configurations could flow through error messages to logging output. When workflow compilation fails in the
mcp addcommand, the error message (which may contain secret references or values) was being logged in clear text to both debug logs and console output.The vulnerability was identified at
pkg/cli/mcp_add.go:148where workflow compilation errors were logged with full error details using:mcpAddLog.Printf("Workflow compilation failed: %v", err)fmt.Println(console.FormatWarningMessage(fmt.Sprintf("Workflow compilation failed: %v", err)))This creates a data flow path where sensitive information from
secretKeysand related secret processing could be exposed in logs.Fix Applied
Modified the error handling in
pkg/cli/mcp_add.go(lines 147-150) to:Before:
After:
Security Best Practices
This fix follows OWASP recommendations for handling sensitive information:
${{ secrets.NAME }}, we avoid any potential leakage through error messagesTesting Considerations
gh aw compiledirectly for detailed debugging if neededReferences
🤖 Generated with Claude Code
Co-Authored-By: Claude (noreply@anthropic.com)