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
Feature/urlparser improve3 pr2 #2646
base: master
Are you sure you want to change the base?
Conversation
…nd "password" is supported: "jdbc:postgresql://[[user][:password]@][host1]...". Connection properties come from different sources. Override order is more clear: 1) URL arguments (values after "?" mark) 2) URL values (values before "?" mark) 3) Properties given to DriverManager.getConnection() 4) values provided by "service" (from resource .pg_service.conf) 5) values in Java System Properties 6) values in Operating System environment 7) values from driverconfig file(s) (org/postgresql/driverconfig.properties) 8) global defaults (four: host, port, user, dbname)
|
GitGuardian id | Secret | Commit | Filename | |
---|---|---|---|---|
- | Generic Database Assignment | fe48244 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | Generic Password | fe48244 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | Generic Password | fe48244 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | Generic Password | fe48244 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | Generic Password | fe48244 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | Generic Password | fe48244 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | Generic Password | fe48244 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | Generic Password | fe48244 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | Generic Password | fe48244 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | PostgreSQL Credentials | fe48244 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | PostgreSQL Credentials | fe48244 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | Generic Password | fe48244 | pgjdbc/src/test/resources/pg_service/pgservicefileProps.conf | View secret |
- | Generic Password | fe48244 | pgjdbc/src/test/resources/pg_service/pgservicefileProps.conf | View secret |
- | Generic Password | 902d9b0 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | Generic Password | 902d9b0 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | PostgreSQL Credentials | 902d9b0 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | PostgreSQL Credentials | 902d9b0 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | PostgreSQL Credentials | 902d9b0 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | PostgreSQL Credentials | 902d9b0 | pgjdbc/src/test/java/org/postgresql/jdbcurlresolver/JdbcUrlResolverTest.java | View secret |
- | Generic Password | 902d9b0 | pgjdbc/src/test/resources/pg_service/pgservicefileProps.conf | View secret |
- | Generic Password | 902d9b0 | pgjdbc/src/test/resources/pg_service/pgservicefileProps.conf | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Our GitHub checks need improvements? Share your feedbacks!
if (resourceName == null) { | ||
return null; | ||
} | ||
// | ||
String result = null; |
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.
If we are looking to provide psql compatibility we should probably check the permissions of the file to ensure they are 0600 on *nix systems.
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.
Good observation. Permission check is added: https://github.com/pgjdbc/pgjdbc/compare/581edc3..736f2cb
…en warning is logged and file is not used) on posix filesystems.
# Conflicts: # README.md
@davecramer |
@MarekUniq currently my plans are 1) merge in the issue with longs #2710 will be reopened and merged. A release with this fix will be released. I would hold off rebasing until after the above happens. Thanks for your patience |
@davecramer |
@davecramer Hi! What are merge plans? |
Is there any progress on merging this? |
I'm generally in favour of this PR. It will need to be rebased. |
} | ||
|
||
private void verifyUrl(Driver drv, String url, String hosts, String ports, String dbName) | ||
private void verifyUrl(Driver drv, String url, String hosts, String ports, String dbName, String user, @Nullable String pass) |
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.
How about adding an overload for the old private verifyUrl(...)
to call the new one?
private void verifyUrl(Driver drv, String url, String hosts, String ports, String dbName) {
verifyUrl(drv, url, hosts, ports, dbName, "osUser", null);
}
That way the majority of the above test cases would not duplicate that info and it would better showcase that none of the expected behavior for those tests have changed.
1. Compatibility with libpq is improved regarding URL syntax and resolving url values
1.1.
user
andpassword
are supportedComplete syntax:
jdbc:postgresql://[[user][:password]@][host1[:port1][,host2[:port2]][,...]][/database][?property1=value1[&property2=value2][&...]]
URL may include:
user
(Optional) is the user to connect. Defaults to operating system username.password
(Optional) is the password to connect. No default value.1.2. property
passfile
is supportedExample:
1.3. Code is more clear regarding Properties override rules (source and result are logged at FINE logging level)
There are multiple sources for connection properties. If same property is specified in multiple sources then highest priority source is used. Priority list is here:
1.4. References
Related to: #2260 #2278 #2398 #2393 #2395 #2424 #2569 #2641 #2644
All Submissions:
New Feature Submissions:
./gradlew autostyleCheck checkstyleAll
pass ?Changes to Existing Features: