Skip to content

Commit

Permalink
SNOW-969200: Remove to look into temp directory for security reason (#…
Browse files Browse the repository at this point in the history
…1558)

* Remove to look into temp directory for security reason

* Removed the code as suggested by code review feedback
  • Loading branch information
sfc-gh-igarish authored Nov 14, 2023
1 parent b5ed386 commit 6ca726b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ public static SFClientConfig loadSFClientConfig(String configFilePath) throws IO
Paths.get(systemGetProperty("user.home"), SF_CLIENT_CONFIG_FILE_NAME).toString();
if (Files.exists(Paths.get(userHomeFilePath))) {
derivedConfigFilePath = userHomeFilePath;
} else {
// 5. Read SF_CLIENT_CONFIG_FILE_NAME if it is present in tmpdir.
String tmpFilePath =
Paths.get(systemGetProperty("java.io.tmpdir"), SF_CLIENT_CONFIG_FILE_NAME).toString();
if (Files.exists(Paths.get(tmpFilePath))) {
derivedConfigFilePath = tmpFilePath;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,6 @@ public void testloadSFClientConfigWithUserHome() {
}
}

@Test
public void testloadSFClientConfigWithTmpDirectory() {
Path configFilePath =
Paths.get(systemGetProperty("java.io.tmpdir"), SF_CLIENT_CONFIG_FILE_NAME);
try {
Files.write(configFilePath, CONFIG_JSON.getBytes());
SFClientConfig actualConfig = SFClientConfigParser.loadSFClientConfig(null);
assertEquals("info", actualConfig.getCommonProps().getLogLevel());
assertEquals("/jdbc.log", actualConfig.getCommonProps().getLogPath());

Files.delete(configFilePath);
} catch (IOException e) {
fail("testloadSFClientConfigWithTmpDirectory failed");
}
}

@Test
public void testloadSFClientNoConditionsMatch() throws IOException {
SFClientConfig actualConfig = SFClientConfigParser.loadSFClientConfig(null);
Expand Down

0 comments on commit 6ca726b

Please sign in to comment.