Problem Statement
GitHub security scanning detected potential logging of sensitive data (apiKey) in the logging infrastructure.
What's the issue?
- The logging function at
sdk/runanywhere-swift/Sources/RunAnywhere/Infrastructure/Logging/Logging.swift:81 may receive and log sensitive information including API keys
- API keys should never be logged in plaintext
- This could lead to credential exposure through log files
Why does it matter?
- Security concern flagged by GitHub Advanced Security
- Could expose API keys in debug logs, crash reports, or log aggregation systems
- Violates security best practices for credential handling
Current State
- File:
sdk/runanywhere-swift/Sources/RunAnywhere/Infrastructure/Logging/Logging.swift
- Line: 81
- Detection: GitHub Advanced Security - Cleartext logging of sensitive information
Proposed Solution
- Audit all logging call sites - Identify where sensitive data might be passed to logging functions
- Implement log sanitization - Add redaction for known sensitive patterns (API keys, tokens, etc.)
- Add documentation - Document which data should never be passed to logging functions
- Consider structured logging - Use typed log events that explicitly exclude sensitive fields
Example Sanitization Pattern
private func sanitize(_ message: String) -> String {
// Redact API key patterns
let apiKeyPattern = /(?:api[_-]?key|apikey|key)[=:]\s*["']?[\w-]+["']?/i
return message.replacing(apiKeyPattern, with: "[REDACTED]")
}
Implementation Plan
Success Criteria
Related Links
🤖 Generated with Claude Code
Problem Statement
GitHub security scanning detected potential logging of sensitive data (apiKey) in the logging infrastructure.
What's the issue?
sdk/runanywhere-swift/Sources/RunAnywhere/Infrastructure/Logging/Logging.swift:81may receive and log sensitive information including API keysWhy does it matter?
Current State
sdk/runanywhere-swift/Sources/RunAnywhere/Infrastructure/Logging/Logging.swiftProposed Solution
Example Sanitization Pattern
Implementation Plan
Success Criteria
Related Links
🤖 Generated with Claude Code