Skip to content

Commit 34fcaff

Browse files
authored
Remove JDBC sensitive information output (#14857) (#14863)
1 parent 946fcbc commit 34fcaff

File tree

5 files changed

+63
-12
lines changed

5 files changed

+63
-12
lines changed

.github/workflows/todos-check.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Check TODOs and FIXMEs in Changed Files
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
- 'dev/*'
8+
- 'rel/*'
9+
- "rc/*"
10+
- 'force_ci/**'
11+
paths-ignore:
12+
- 'docs/**'
13+
- 'site/**'
14+
# allow manually run the action:
15+
workflow_dispatch:
16+
17+
jobs:
18+
todo-check:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Check for TODOs and FIXMEs in changed files
26+
run: |
27+
# Fetch the target branch
28+
git fetch origin $GITHUB_BASE_REF
29+
30+
git switch -c check_branch
31+
32+
# Get the diff of the changes
33+
echo Get the diff of the changes
34+
DIFF=$(git diff origin/$GITHUB_BASE_REF check_branch -- . ':(exclude).github/workflows/todos-check.yml')
35+
36+
if [ -z "$DIFF" ]; then
37+
echo "No changes detected."
38+
exit 0
39+
fi
40+
41+
42+
# Check the diff for TODOs
43+
44+
# Check the diff for TODOs
45+
echo Check the diff for TODOs
46+
TODOsCOUNT=$(echo "$DIFF" | grep -E '^\+.*(TODO|FIXME)' | wc -l)
47+
if [ "$TODOsCOUNT" -eq 0 ]; then
48+
echo "No TODOs or FIXMEs found in changed content.";
49+
exit 0
50+
fi
51+
52+
echo "TODO or FIXME found in the changes. Please resolve it before merging."
53+
echo "$DIFF" | grep -E '^\+.*(TODO|FIXME)' | tee -a output.log
54+
exit 1

iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBDataSourceFactory.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,13 @@ public void setProperties(IoTDBDataSource ds, Properties prop) {
4545
String url = (String) properties.remove(DataSourceFactory.JDBC_URL);
4646
if (url != null) {
4747
ds.setUrl(url);
48-
logger.info("URL set {}", url);
4948
}
5049

5150
String user = (String) properties.remove(DataSourceFactory.JDBC_USER);
5251
ds.setUser(user);
53-
logger.info("User set {}", user);
5452

5553
String password = (String) properties.remove(DataSourceFactory.JDBC_PASSWORD);
5654
ds.setPassword(password);
57-
logger.info("Password set {}", password);
5855

5956
logger.info("Remaining properties {}", properties.size());
6057

iotdb-core/datanode/src/test/java/org/apache/iotdb/db/auth/entity/UserTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ public void testUser() throws IllegalPathException {
3737
user.setPrivilegeList(Collections.singletonList(pathPrivilege));
3838
user.setPathPrivileges(new PartialPath("root.ln"), Collections.singleton(1));
3939
Assert.assertEquals(
40-
"User{name='user', password='password', pathPrivilegeList=[root.ln : WRITE_DATA], sysPrivilegeSet=[], roleList=[], "
40+
"User{name='user', pathPrivilegeList=[root.ln : WRITE_DATA], sysPrivilegeSet=[], roleList=[], "
4141
+ "isOpenIdUser=false, useWaterMark=false}",
4242
user.toString());
4343
User user1 = new User("user1", "password1");
4444
user1.deserialize(user.serialize());
4545
Assert.assertEquals(
46-
"User{name='user', password='password', pathPrivilegeList=[root.ln : WRITE_DATA], sysPrivilegeSet=[], roleList=[], "
46+
"User{name='user', pathPrivilegeList=[root.ln : WRITE_DATA], sysPrivilegeSet=[], roleList=[], "
4747
+ "isOpenIdUser=false, useWaterMark=false}",
4848
user1.toString());
4949
Assert.assertTrue(user1.equals(user));

iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/auth/authorizer/OpenIdAuthorizer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ private static OIDCProviderMetadata fetchMetadata(String providerUrl)
148148
public boolean login(String token, String password) throws AuthException {
149149
if (password != null && !password.isEmpty()) {
150150
logger.error(
151-
"JWT Login failed as a non-empty Password was given username (token): {}, password: {}",
152-
token,
153-
password);
151+
"JWT Login failed as a non-empty Password was given username (token): {}", token);
154152
return false;
155153
}
156154
if (token == null || token.isEmpty()) {
@@ -162,7 +160,7 @@ public boolean login(String token, String password) throws AuthException {
162160
try {
163161
claims = validateToken(token);
164162
} catch (JwtException e) {
165-
logger.error("Unable to login the user wit jwt {}", password, e);
163+
logger.error("Unable to login the user with Username (token) {}", token, e);
166164
return false;
167165
}
168166
logger.debug("JWT was validated successfully!");

iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/auth/entity/User.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,17 @@ public void deserialize(ByteBuffer buffer) {
187187
roleList = SerializeUtils.deserializeStringList(buffer);
188188
}
189189

190+
/**
191+
* TestOnly, get the string representation of the user.
192+
*
193+
* @return string representation of the user
194+
*/
190195
@Override
191196
public String toString() {
192197
return "User{"
193198
+ "name='"
194199
+ super.getName()
195200
+ '\''
196-
+ ", password='"
197-
+ password
198-
+ '\''
199201
+ ", pathPrivilegeList="
200202
+ super.getPathPrivilegeList()
201203
+ ", sysPrivilegeSet="

0 commit comments

Comments
 (0)