Skip to content
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

feat: jdbc sink user password #19822

Merged
merged 5 commits into from
Dec 18, 2024
Merged

feat: jdbc sink user password #19822

merged 5 commits into from
Dec 18, 2024

Conversation

fuyufjh
Copy link
Member

@fuyufjh fuyufjh commented Dec 17, 2024

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

Fix #19766.

The root cause of #19766 is that JDBC URL is included in many JDBC Driver's error message, which is okay. But we put username and password in that URL, which is not a good practice.

This PR uses getConnection(jdbcUrl, user, password) instead of getConnection(jdbcUrl), so that the error message won't show the password.

No breaking change - the old syntax can work as well.

Checklist

  • I have written necessary rustdoc comments.
  • I have added necessary unit tests and integration tests.
  • I have added test labels as necessary.
  • I have added fuzzing tests or opened an issue to track them.
  • My PR contains breaking changes.
  • My PR changes performance-critical code, so I will run (micro) benchmarks and present the results.
  • My PR contains critical fixes that are necessary to be merged into the latest release.

Documentation

  • My PR needs documentation updates.

Need to update the docs of JDBC sink to use the new format.

No need to add release note - it's just a minor change.

Release note

@fuyufjh fuyufjh requested a review from StrikeW December 17, 2024 06:05
@fuyufjh fuyufjh added user-facing-changes Contains changes that are visible to users user-experience Issue to improve the user experience of RW labels Dec 17, 2024

This comment was marked as outdated.

info.put("password", config.getPassword());
}

try (Connection conn = DriverManager.getConnection(jdbcUrl, info);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can directly use Connection getConnection(String url, String user, String password) and it has null check inside.

Copy link
Member Author

@fuyufjh fuyufjh Dec 17, 2024

Choose a reason for hiding this comment

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

Yeah, that's my original code (as written in the PR description). Here I use getConnection(jdbcUrl, info) is to unify the function call in this try (...), avoiding an ugly if...else.

Copy link
Contributor

@StrikeW StrikeW Dec 17, 2024

Choose a reason for hiding this comment

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

Don’t get it.😂 It seems Connection conn = DriverManager.getConnection(jdbcUrl, config.getUser(), config.getPassword()) is ok. correct me if I am wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

Make sense. Fixed.

Copy link
Contributor

@StrikeW StrikeW left a comment

Choose a reason for hiding this comment

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

Rest lgtm

info.put("password", config.getPassword());
}

try (Connection conn = DriverManager.getConnection(jdbcUrl, info);
Copy link
Contributor

@StrikeW StrikeW Dec 17, 2024

Choose a reason for hiding this comment

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

Don’t get it.😂 It seems Connection conn = DriverManager.getConnection(jdbcUrl, config.getUser(), config.getPassword()) is ok. correct me if I am wrong.

@graphite-app graphite-app bot requested a review from a team December 18, 2024 07:11
@fuyufjh fuyufjh added this pull request to the merge queue Dec 18, 2024
Merged via the queue into main with commit 1804c80 Dec 18, 2024
30 of 31 checks passed
@fuyufjh fuyufjh deleted the eric/jdbc_sink_user_password branch December 18, 2024 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: error reporting accidentally leaked the secret
2 participants