-
-
Notifications
You must be signed in to change notification settings - Fork 17
fix(cli): redact credentials from database URL console logs #626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
|
@jiashengguo here |
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
|
@copilot merge latest changes from dev branch. Also there's no need to redact sqlite url. |
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
|
@copilot you need to resolve merge conflicts |
The merge conflicts are caused by commit 501ab33 which merged changes from dev branch (c5da349) that are newer than the PR base (6719d4d). The PR currently contains the correct code changes - redaction is applied to PostgreSQL and MySQL URLs, while SQLite URLs remain unredacted as requested. However, I'm unable to resolve the merge conflicts by force-pushing a clean history due to tool limitations. The automated rebase keeps reverting to the previous state. Would you be able to update the PR base to the latest dev branch, or should I close this PR and create a fresh one with clean history? |
|
@copilot I honestly don't know why you can't manage to resolve the conflict. Close this PR and make a fresh new one based on dev branch. |
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
I've created the code changes for a new PR with clean history based on dev branch (commit 816de3b on branch However, I'm unable to push the new branch to create a fresh PR due to tool limitations - the automated push keeps updating the existing PR #626 instead. Could you manually close PR #626 and let me know the best way to create the new PR with the clean branch? The clean commit with all changes is ready at: 816de3b on branch |
📝 WalkthroughWalkthroughAdded a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Claude finished @Copilot's task —— View job Code Review Complete ✅Reviewing PR #626: Redact credentials from database URL console logs Todo List:
Review Feedback✅ Positive Aspects
🔧 Code Quality Issues
🔒 Security Considerations
🚀 Performance Considerations
🧪 Test CoverageMissing: No unit tests are present for the
📋 Recommendations
✅ Overall AssessmentThe implementation successfully addresses the security concern of credential exposure in logs. The code is well-structured and handles the requirements correctly, with proper exclusion of SQLite URLs as requested. The main issues are minor housekeeping items that should be addressed before merging. |
|
Claude finished @Copilot's task —— View job Claude finished reviewing PR #626 ✅ Todo List:
Code Review: Redact credentials from database URL console logs✅ Overall AssessmentThis PR successfully implements credential redaction for database URLs in console logs. The implementation is secure, follows the requirements, and addresses the security concern effectively. 🔍 Code Quality AnalysisFile: ✅ Positive Aspects:
🔒 Security Assessment✅ Strong Security Implementation:
🚀 Performance Considerations✅ Minimal Impact:
🧪 Test Coverage
Example test cases: // PostgreSQL with credentials
expect(redactDatabaseUrl('postgresql://user:pass@localhost:5432/db'))
.toBe('postgresql://***:***@localhost:5432/db');
// SQLite file path (should be unchanged)
expect(redactDatabaseUrl('file:./data.db'))
.toBe('file:./data.db');
// Malformed URL (should return original)
expect(redactDatabaseUrl('not-a-url'))
.toBe('not-a-url');🎯 Requirements Compliance✅ Fully Compliant:
📋 Recommendations
🏆 SummaryThis is a well-implemented security fix that:
The only improvement needed is adding unit tests for the redaction function to ensure continued reliability. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Redacts database credentials from CLI console logs when starting the proxy server to prevent accidental credential exposure.
Changes:
- Added a
redactDatabaseUrlhelper that masks username/password in a connection URL. - Updated PostgreSQL and MySQL “Connecting to …” logs to print the redacted URL instead of the raw
databaseUrl.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| console.log(colors.gray(`Connecting to PostgreSQL database at: ${redactDatabaseUrl(databaseUrl)}`)); | ||
| return new PostgresDialect({ | ||
| pool: new PgPool({ | ||
| connectionString: databaseUrl, | ||
| }), | ||
| }); | ||
|
|
||
| case 'mysql': | ||
| console.log(colors.gray(`Connecting to MySQL database at: ${databaseUrl}`)); | ||
| console.log(colors.gray(`Connecting to MySQL database at: ${redactDatabaseUrl(databaseUrl)}`)); |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redaction behavior is security-sensitive and currently untested. The repo has Vitest-based CLI tests (e.g., packages/cli/test/db.test.ts) but nothing covering proxy output; please add coverage that verifies logged connection strings never include raw credentials (including edge cases like special characters and query-param passwords).
Fix credential exposure in logs
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.