Skip to content

Conversation

alexluong
Copy link
Collaborator

@alexluong alexluong commented Sep 7, 2025

resolves #470

The original issue is caused by an external package go-migrate printing credentials in the log. This PR sanitizes that error from go-migrate while attempting to maintain as much context as possible.

Beyond this PR, I also created issue #480 for a more systematic solution regarding credentials & logging. Once implemented, we can consider revisting this and remove the custom sanitizer logic if applicable.

Copy link

vercel bot commented Sep 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
outpost-docs Ready Ready Preview Comment Oct 5, 2025 0:39am
outpost-website Ready Ready Preview Comment Oct 5, 2025 0:39am

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses credential exposure in database migration error logs by implementing sanitization logic for the go-migrate library errors. The issue stems from the go-migrate library including full database URLs (with credentials) in error messages when connections fail.

  • Implements comprehensive credential sanitization for database connection errors
  • Adds robust test coverage for various error scenarios and URL formats
  • Integrates sanitization into the migrator's New() function to prevent credential leaks

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
internal/migrator/sanitize.go Core sanitization logic for removing credentials from error messages
internal/migrator/sanitize_test.go Unit tests for the sanitization functions
internal/migrator/migrator_test.go Integration tests verifying credential protection in real connection scenarios
internal/migrator/migrator.go Integration of sanitization into the New() function

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@leggetter
Copy link
Collaborator

@alexluong - I would have okayed this but also asked copilot to give it a once over and it left a couple of comments.

@alexluong
Copy link
Collaborator Author

alexluong commented Oct 3, 2025

@leggetter thanks, I'm working on another task and will circle back to this later today.

@alexluong alexluong merged commit ab0e63c into main Oct 5, 2025
2 of 4 checks passed
@alexluong alexluong deleted the fix-log-secrets branch October 5, 2025 12:21
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.

Secrets are printed in the log

2 participants