Skip to content

Commit

Permalink
<fix>(build,utils): upgrade dependencies, fix path manipulation bug. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonRay committed Mar 21, 2023
1 parent ac2d5c0 commit 569d32e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
**更新**

* log4j版本升级至2.19
* 更新gson、snakeyaml版本以修复安全问题
* WeCross stub 版本号更新到1.3.0
*去除netty和tcnative的依赖
* 去除netty和tcnative的依赖

### v1.2.1

Expand Down
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ List logger = [
dependencies {
compile logger

implementation 'com.moandjiezana.toml:toml4j:0.7.2'
implementation ('com.moandjiezana.toml:toml4j:0.7.2') {
exclude group: 'com.google.code.gson', module: 'gson'
}
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'com.google.guava:guava:30.1-jre'
implementation 'org.yaml:snakeyaml:1.27'
implementation 'org.yaml:snakeyaml:2.0'

// Fabric
implementation 'javassist:javassist:3.12.1.GA'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ public static PrivateKey buildPemPrivateKey(String keyContent) throws Exception
}

public static String loadPemCert(String certPath) throws Exception {

// to avoid path manipulation
certPath = certPath.replace("..", "");
if (certPath.indexOf("classpath:") == 0) {
PathMatchingResourcePatternResolver resolver =
new PathMatchingResourcePatternResolver();
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/webank/wecross/utils/FabricUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public static long bytesToLong(byte[] bytes) {

public static String getPath(String fileName) throws Exception {
try {
// to avoid path manipulation
fileName = fileName.replace("..", "");
if (fileName.indexOf("classpath:") != 0) {
return fileName;
}
Expand All @@ -62,6 +64,8 @@ public static String getPath(String fileName) throws Exception {

public static String readFileContent(String fileName) throws Exception {
try {
// to avoid path manipulation
fileName = fileName.replace("..", "");
Path path;

if (fileName.indexOf("classpath:") != 0) {
Expand Down

0 comments on commit 569d32e

Please sign in to comment.