Skip to content

fix(api): remove connection string from logs entirely#232

Merged
KaueReinbold merged 2 commits intomainfrom
fix/remove-connection-string-from-logs
Jan 25, 2026
Merged

fix(api): remove connection string from logs entirely#232
KaueReinbold merged 2 commits intomainfrom
fix/remove-connection-string-from-logs

Conversation

@KaueReinbold
Copy link
Owner

Problem: Previous attempts to redact passwords in connection strings still triggered CodeQL alerts because it tracks data flow from GetConnectionString().

Solution: Remove connection string logging entirely. No need to log database connection details - generic error messages are sufficient.

Changes:

  • ✅ Removed GetRedactedConnectionString() helper method
  • ✅ Removed RedactPassword() helper method
  • ✅ Updated log messages to exclude connection string
  • ✅ Simplified code by removing unnecessary complexity

Before:

logger?.LogWarning(exception, "Database connectivity attempt {RetryCount} failed for {ConnectionPreview}. Next retry in {Delay}.", retryCount, connPreview, timeSpan);

After:

logger?.LogWarning(exception, "Database connectivity attempt {RetryCount} failed. Next retry in {Delay}.", retryCount, timeSpan);

Impact:

  • Eliminates CodeQL cleartext storage concerns completely
  • Cleaner, simpler code
  • No sensitive information in logs

Supersedes PRs #230 and #231 which attempted redaction but CodeQL still detected data flow.

Remove all connection string references from logs to eliminate
any potential exposure of sensitive information. Logs now only
show generic retry messages without database connection details.

Changes:
- Removed GetRedactedConnectionString() helper method
- Removed RedactPassword() helper method
- Updated log messages to exclude connection string preview
- Logs now show: 'Database connectivity attempt {RetryCount} failed'

Resolves CodeQL cleartext storage alerts by not logging connection
string at all, even in redacted form.
Also remove connection string logging from MigrationsRunner service
to maintain consistency across all services.

Changes:
- Removed RedactConnectionString() helper method
- Updated startup log to only show provider name
- Log now shows: 'Migration runner starting with provider: {Provider}'
@KaueReinbold KaueReinbold merged commit 1834794 into main Jan 25, 2026
4 checks passed
@KaueReinbold KaueReinbold deleted the fix/remove-connection-string-from-logs branch January 25, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant