@xiangyang9999/folib-server-sync-a8be7ecd6f05 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -2
- package/bin/folib-commit-sync.js +70 -0
- package/package.json +22 -4
- package/payload/INSTRUCTIONS.docx +0 -0
- package/payload/changes.patch +1538 -0
- package/payload/manifest.json +367 -0
- package/payload/manifest.sha256 +41 -0
- package/payload/source-files.zip +0 -0
- package/source/SECURITY_DEPENDENCY_UPGRADE.md +97 -0
- package/source/folib-client/pom.xml +160 -0
- package/source/folib-commons/folib-commons-core/pom.xml +297 -0
- package/source/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/ArchiveExtractionPaths.java +86 -0
- package/source/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/CompressUtils.java +148 -0
- package/source/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/ArchiveExtractionPathsTest.java +77 -0
- package/source/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/CompressUtilsTest.java +286 -0
- package/source/folib-commons/folib-commons-io/pom.xml +184 -0
- package/source/folib-data-service/pom.xml +259 -0
- package/source/folib-data-service/src/test/java/com/veadan/folib/config/hazelcast/HazelcastClusterCompatibilityTest.java +124 -0
- package/source/folib-rest-client/pom.xml +166 -0
- package/source/folib-security/folib-authentication-registry/pom.xml +117 -0
- package/source/folib-security/folib-security-api/pom.xml +416 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianGroupInterceptor.java +251 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianPackagesMetadataIndexer.java +72 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-docker-layout-provider/pom.xml +236 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-gitlfs-layout-provider/pom.xml +187 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-go-layout-provider/pom.xml +180 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-helm-layout-provider/pom.xml +125 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-huggingface-layout-provider/pom.xml +193 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-maven-metadata-api/pom.xml +101 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-storage-maven-layout-provider/pom.xml +179 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-npm-layout-provider/pom.xml +162 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-nuget-layout-provider/pom.xml +155 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-p2-layout-provider/pom.xml +116 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-php-layout-provider/pom.xml +170 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-pypi-layout-provider/pom.xml +278 -0
- package/source/folib-storage/folib-storage-layout-providers/folib-storage-raw-layout-provider/pom.xml +183 -0
- package/source/folib-web-core/pom.xml +1089 -0
- package/source/folib-web-core/src/main/java/com/veadan/folib/app/FolibSpringBootApplication.java +67 -0
- package/source/folib-web-core/src/main/java/com/veadan/folib/config/LegacySpringDataWebConfig.java +41 -0
- package/source/folib-web-core/src/main/java/com/veadan/folib/config/WebConfig.java +377 -0
- package/source/folib-web-core/src/main/java/com/veadan/folib/model/response/OhpmPublishRes.java +16 -0
- package/source/folib-web-core/src/main/java/com/veadan/folib/promotion/DockerParsePacketsUtil.java +202 -0
- package/source/folib-web-core/src/test/java/com/veadan/folib/config/LegacySpringDataWebConfigTest.java +75 -0
- package/source/folib-web-core/src/test/java/com/veadan/folib/config/WebConfigResourceHandlersTest.java +31 -0
- package/source/folib-web-core/src/test/java/com/veadan/folib/promotion/DockerArchiveExtractionTest.java +112 -0
- package/source/folib-web-core/src/test/java/com/veadan/folib/utils/DependencyCompatibilityTest.java +62 -0
|
@@ -0,0 +1,1538 @@
|
|
|
1
|
+
diff --git a/SECURITY_DEPENDENCY_UPGRADE.md b/SECURITY_DEPENDENCY_UPGRADE.md
|
|
2
|
+
new file mode 100644
|
|
3
|
+
index 0000000000..7e39895173
|
|
4
|
+
--- /dev/null
|
|
5
|
+
+++ b/SECURITY_DEPENDENCY_UPGRADE.md
|
|
6
|
+
@@ -0,0 +1,97 @@
|
|
7
|
+
+# Folib Server 安全依赖升级说明
|
|
8
|
+
+
|
|
9
|
+
+## 1. 部署前提
|
|
10
|
+
+
|
|
11
|
+
+本仓库继续使用独立发布的父 POM `com.veadan.folib:folib-parent:3.0-SNAPSHOT`,原有 `<relativePath/>` 及模块继承关系不变。本次提交不包含父 POM 源码。请先在目标环境的独立 folib-parent 工程中完成以下升级,安装或发布到该环境使用的 Maven 仓库,再应用本次 Server 代码变更、重新解析依赖并构建。
|
|
12
|
+
+
|
|
13
|
+
+以下版本为本轮实际构建、专项测试使用的版本,不代表扫描器中所有漏洞均已销项。
|
|
14
|
+
+
|
|
15
|
+
+## 2. 父 POM 版本清单
|
|
16
|
+
+
|
|
17
|
+
+| Maven 坐标(groupId:artifactId) | 目标版本 | 父 POM 属性 / 说明 |
|
|
18
|
+
+| --- | --- | --- |
|
|
19
|
+
+| com.fasterxml.jackson.core:jackson-databind | 2.18.12 | version.jackson |
|
|
20
|
+
+| com.fasterxml.jackson:jackson-bom | 2.18.12 | version.jackson;Jackson 同系列统一版本 |
|
|
21
|
+
+| com.hazelcast:hazelcast | 5.7.0 | version.hazelcast |
|
|
22
|
+
+| com.hazelcast:hazelcast-spring | 5.7.0 | version.hazelcast |
|
|
23
|
+
+| org.jsoup:jsoup | 1.23.2 | version.jsoup |
|
|
24
|
+
+| com.github.junrar:junrar | 8.1.2 | version.junrar;最终版本,不是中间版本 7.6.1 |
|
|
25
|
+
+| org.apache.commons:commons-compress | 1.28.0 | version.apache.commons.compress |
|
|
26
|
+
+| org.apache.tika:tika-core | 3.3.3 | version.tika |
|
|
27
|
+
+| org.apache.groovy:groovy-bom | 4.0.32 | version.groovy4;运行时 Groovy 4 全系列 |
|
|
28
|
+
+| org.codehaus.groovy:groovy / groovy-all / groovy-json / groovy-xml | 3.0.25 | version.groovy;仅兼容仍声明旧坐标的依赖,不得在 BES 运行包中同时装入 Groovy 3 与 4 核心 |
|
|
29
|
+
+| io.rest-assured:rest-assured-bom | 5.5.7 | version.rest.assured;测试依赖升级,移除 Groovy 2.5.8 引入路径 |
|
|
30
|
+
+| org.springframework.boot:spring-boot-dependencies | 3.5.15 | version.spring.boot |
|
|
31
|
+
+| org.springframework.boot:spring-boot-maven-plugin | 3.5.15 | version.spring.boot;与 Boot BOM 保持一致 |
|
|
32
|
+
+| org.springframework:spring-framework-bom | 6.2.19 | version.spring.framework;包括 spring-expression、spring-core、spring-web、spring-webmvc、spring-tx 等 |
|
|
33
|
+
+| org.springframework.security:spring-security-bom | 6.5.11 | version.spring.security;包括 spring-security-web、spring-security-ldap、spring-security-core 等 |
|
|
34
|
+
+| commons-io:commons-io | 2.20.0 | version.apache.commons.io;Compress 兼容依赖 |
|
|
35
|
+
+| commons-codec:commons-codec | 1.19.0 | version.apache.commons.codec;Compress 兼容依赖 |
|
|
36
|
+
+| org.apache.commons:commons-lang3 | 3.18.0 | version.apache.commons.lang3;Compress 兼容依赖 |
|
|
37
|
+
+
|
|
38
|
+
+将独立父 POM 的相关 properties 设置为:
|
|
39
|
+
+
|
|
40
|
+
+```xml
|
|
41
|
+
+<version.jackson>2.18.12</version.jackson>
|
|
42
|
+
+<version.hazelcast>5.7.0</version.hazelcast>
|
|
43
|
+
+<version.jsoup>1.23.2</version.jsoup>
|
|
44
|
+
+<version.junrar>8.1.2</version.junrar>
|
|
45
|
+
+<version.apache.commons.compress>1.28.0</version.apache.commons.compress>
|
|
46
|
+
+<version.apache.commons.io>2.20.0</version.apache.commons.io>
|
|
47
|
+
+<version.apache.commons.codec>1.19.0</version.apache.commons.codec>
|
|
48
|
+
+<version.apache.commons.lang3>3.18.0</version.apache.commons.lang3>
|
|
49
|
+
+<version.tika>3.3.3</version.tika>
|
|
50
|
+
+<version.groovy>3.0.25</version.groovy>
|
|
51
|
+
+<version.groovy4>4.0.32</version.groovy4>
|
|
52
|
+
+<version.rest.assured>5.5.7</version.rest.assured>
|
|
53
|
+
+<version.spring.boot>3.5.15</version.spring.boot>
|
|
54
|
+
+<version.spring.framework>6.2.19</version.spring.framework>
|
|
55
|
+
+<version.spring.security>6.5.11</version.spring.security>
|
|
56
|
+
+```
|
|
57
|
+
+
|
|
58
|
+
+在 `dependencyManagement/dependencies` 中,按以下顺序导入 BOM(每项 `type=pom`、`scope=import`),新增 BOM 放在现有 Boot BOM 之前;已有 Boot BOM 修改版本,不要重复声明:
|
|
59
|
+
+
|
|
60
|
+
+1. `com.fasterxml.jackson:jackson-bom:${version.jackson}`
|
|
61
|
+
+2. `org.apache.groovy:groovy-bom:${version.groovy4}`
|
|
62
|
+
+3. `io.rest-assured:rest-assured-bom:${version.rest.assured}`
|
|
63
|
+
+4. `org.springframework:spring-framework-bom:${version.spring.framework}`
|
|
64
|
+
+5. `org.springframework.security:spring-security-bom:${version.spring.security}`
|
|
65
|
+
+6. `org.springframework.boot:spring-boot-dependencies:${version.spring.boot}`
|
|
66
|
+
+
|
|
67
|
+
+在原 dependencyManagement 中补充或更新以下直接管理项(有旧声明则更新,不增加重复项):
|
|
68
|
+
+
|
|
69
|
+
+| 坐标 | version |
|
|
70
|
+
+| --- | --- |
|
|
71
|
+
+| org.jsoup:jsoup | ${version.jsoup} |
|
|
72
|
+
+| com.github.junrar:junrar | ${version.junrar} |
|
|
73
|
+
+| commons-codec:commons-codec | ${version.apache.commons.codec} |
|
|
74
|
+
+| org.apache.commons:commons-lang3 | ${version.apache.commons.lang3} |
|
|
75
|
+
+| org.codehaus.groovy:groovy-json | ${version.groovy} |
|
|
76
|
+
+| org.codehaus.groovy:groovy-xml | ${version.groovy} |
|
|
77
|
+
+| org.springframework:spring-core | ${version.spring.framework} |
|
|
78
|
+
+| org.springframework:spring-tx | ${version.spring.framework} |
|
|
79
|
+
+| org.springframework.security:spring-security-web | ${version.spring.security} |
|
|
80
|
+
+| org.springframework.security:spring-security-ldap | ${version.spring.security} |
|
|
81
|
+
+
|
|
82
|
+
+原有使用上述 properties 的管理项(Jackson core/annotations/databind/dataformat-xml/dataformat-yaml/module-jaxb-annotations/jaxrs-json-provider、Hazelcast、Commons IO/Compress、旧 Groovy、Rest Assured、Tika、Boot starters 及 Boot 打包插件)继续引用对应升级后的属性。不要保留显式旧版本覆盖 BOM。独立的 folib-client、folib-rest-client 不继承此父 POM,必要版本已在本次 Server 提交中单独调整。
|
|
83
|
+
+
|
|
84
|
+
+## 3. 代码兼容及集群边界
|
|
85
|
+
+
|
|
86
|
+
+- 子模块去除与父 POM 冲突的版本覆盖,Groovy 直接依赖改为 `org.apache.groovy:groovy`,排除 JFrog 客户端引入的旧 Groovy 核心。
|
|
87
|
+
+- 保留 `org.springframework.data:spring-data-commons:2.4.15`、`org.springframework.data:spring-data-neo4j:5.2.1.RELEASE` 和现有 Neo4j OGM 事务;不要随 Boot BOM 直接升级这些遗留依赖。Server 已增加对应分页/排序兼容配置,并修正新版 Spring MVC 不接受的 classpath 根资源映射。
|
|
88
|
+
+- Junrar 8.1.2 及 ZIP、RAR、TAR.GZ、GZIP 解包路径防护已在 Server 中实现;Commons Compress 新异常继承关系已适配。
|
|
89
|
+
+- BES 容器版本保持 11.5.0.005。生产集群成员、TCP/IP 发现及分布式锁/脑裂保护配置保持原状;不改数据库、ES 或部署参数。
|
|
90
|
+
+- Hazelcast 5.7.0 已满足原报告推荐,但社区版新增安全公告仍需后续官方安全补丁或适用授权版本。生产应以网络访问控制限制集群端口至可信成员/必要客户端;这属于风险缓解,不是漏洞销项。
|
|
91
|
+
+
|
|
92
|
+
+## 4. 目标环境验证
|
|
93
|
+
+
|
|
94
|
+
+独立父 POM 按第 2 节更新并发布到目标环境 Maven 仓库后,再构建 Server(使用目标环境原有 Maven settings):
|
|
95
|
+
+
|
|
96
|
+
+```bash
|
|
97
|
+
+mvn -U -Pcontainer-bes -pl folib-web-core -am dependency:tree
|
|
98
|
+
+mvn -Pcontainer-bes -pl folib-web-core -am -Dtest=ArchiveExtractionPathsTest,DockerArchiveExtractionTest,WebConfigResourceHandlersTest,LegacySpringDataWebConfigTest,DependencyCompatibilityTest,WebSecurityConfigTest,JacksonSerializationUtilTest,HazelcastConfigurationTest,HazelcastClusterCompatibilityTest,DistributedLockComponentTest,CompressUtilsTest,SecurityTokenProviderTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false package
|
|
99
|
+
+```
|
|
100
|
+
+
|
|
101
|
+
+核对可执行 BES JAR 的 BOOT-INF/lib:重点组件应为上述版本,仅一套 Groovy 4 核心,Junrar 不应残留 7.x。使用目标环境的原启动参数检查完整启动、HTTP 就绪、达梦、ES 和多机集群业务,随后使用原 SCA 工具复扫。不能仅以 POM 声明或构建成功判断漏洞已修复。
|
|
102
|
+
+
|
|
103
|
+
+本地等效父 POM 验证结果:47 个 Reactor 模块成功构建,73 项专项测试全部通过(含双成员真实 Hazelcast 组网、缓存与分布式锁),RAR4/RAR5 样本实际解压成功;之前的 BES 包已完成本地启动。最后一轮归档修复包未进行完整应用重启;目标环境独立父 POM、生产多机集群及原 SCA 复扫仍需单独验证。
|
|
104
|
+
diff --git a/folib-client/pom.xml b/folib-client/pom.xml
|
|
105
|
+
index 5215702907..f3655e83df 100644
|
|
106
|
+
--- a/folib-client/pom.xml
|
|
107
|
+
+++ b/folib-client/pom.xml
|
|
108
|
+
@@ -56,7 +56,7 @@
|
|
109
|
+
<dependency>
|
|
110
|
+
<groupId>org.springframework.security</groupId>
|
|
111
|
+
<artifactId>spring-security-core</artifactId>
|
|
112
|
+
- <version>6.2.8</version>
|
|
113
|
+
+ <version>6.5.11</version>
|
|
114
|
+
</dependency>
|
|
115
|
+
<dependency>
|
|
116
|
+
<groupId>org.glassfish.jersey.core</groupId>
|
|
117
|
+
@@ -125,17 +125,17 @@
|
|
118
|
+
<dependency>
|
|
119
|
+
<groupId>org.springframework</groupId>
|
|
120
|
+
<artifactId>spring-core</artifactId>
|
|
121
|
+
- <version>6.2.10</version>
|
|
122
|
+
+ <version>6.2.19</version>
|
|
123
|
+
</dependency>
|
|
124
|
+
<dependency>
|
|
125
|
+
<groupId>org.springframework</groupId>
|
|
126
|
+
<artifactId>spring-web</artifactId>
|
|
127
|
+
- <version>6.2.10</version>
|
|
128
|
+
+ <version>6.2.19</version>
|
|
129
|
+
</dependency>
|
|
130
|
+
<dependency>
|
|
131
|
+
<groupId>org.springframework</groupId>
|
|
132
|
+
<artifactId>spring-webmvc</artifactId>
|
|
133
|
+
- <version>6.2.10</version>
|
|
134
|
+
+ <version>6.2.19</version>
|
|
135
|
+
</dependency>
|
|
136
|
+
<dependency>
|
|
137
|
+
<artifactId>jakarta.xml.bind-api</artifactId>
|
|
138
|
+
diff --git a/folib-commons/folib-commons-core/pom.xml b/folib-commons/folib-commons-core/pom.xml
|
|
139
|
+
index d064091d1e..c7244e88dd 100644
|
|
140
|
+
--- a/folib-commons/folib-commons-core/pom.xml
|
|
141
|
+
+++ b/folib-commons/folib-commons-core/pom.xml
|
|
142
|
+
@@ -285,7 +285,6 @@
|
|
143
|
+
<dependency>
|
|
144
|
+
<groupId>org.jsoup</groupId>
|
|
145
|
+
<artifactId>jsoup</artifactId>
|
|
146
|
+
- <version>1.15.3</version>
|
|
147
|
+
</dependency>
|
|
148
|
+
<!-- <dependency>-->
|
|
149
|
+
<!-- <groupId>com.googlecode.juniversalchardet</groupId>-->
|
|
150
|
+
diff --git a/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/ArchiveExtractionPaths.java b/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/ArchiveExtractionPaths.java
|
|
151
|
+
new file mode 100644
|
|
152
|
+
index 0000000000..10210436a0
|
|
153
|
+
--- /dev/null
|
|
154
|
+
+++ b/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/ArchiveExtractionPaths.java
|
|
155
|
+
@@ -0,0 +1,86 @@
|
|
156
|
+
+package com.veadan.folib.util;
|
|
157
|
+
+
|
|
158
|
+
+import java.io.IOException;
|
|
159
|
+
+import java.io.OutputStream;
|
|
160
|
+
+import java.nio.file.FileAlreadyExistsException;
|
|
161
|
+
+import java.nio.file.Files;
|
|
162
|
+
+import java.nio.file.InvalidPathException;
|
|
163
|
+
+import java.nio.file.LinkOption;
|
|
164
|
+
+import java.nio.file.Path;
|
|
165
|
+
+import java.nio.file.StandardOpenOption;
|
|
166
|
+
+
|
|
167
|
+
+/**
|
|
168
|
+
+ * Resolves untrusted archive names inside a caller-selected extraction directory.
|
|
169
|
+
+ * The directory must not be concurrently writable by untrusted local processes.
|
|
170
|
+
+ */
|
|
171
|
+
+public final class ArchiveExtractionPaths {
|
|
172
|
+
+
|
|
173
|
+
+ private ArchiveExtractionPaths() {
|
|
174
|
+
+ }
|
|
175
|
+
+
|
|
176
|
+
+ public static Path createRoot(String destination) throws IOException {
|
|
177
|
+
+ return Files.createDirectories(Path.of(destination)).toRealPath();
|
|
178
|
+
+ }
|
|
179
|
+
+
|
|
180
|
+
+ private static Path resolve(Path root, String entryName) throws IOException {
|
|
181
|
+
+ if (entryName == null || entryName.isEmpty()) {
|
|
182
|
+
+ throw new IOException("Empty archive entry name");
|
|
183
|
+
+ }
|
|
184
|
+
+ String name = entryName.replace('\\', '/');
|
|
185
|
+
+ // Reject both Unix absolute paths and Windows rooted/drive-relative paths on all platforms.
|
|
186
|
+
+ if (name.startsWith("/") || name.matches("^[A-Za-z]:.*")) {
|
|
187
|
+
+ throw new IOException("Absolute archive entry path");
|
|
188
|
+
+ }
|
|
189
|
+
+ try {
|
|
190
|
+
+ Path relative = Path.of(name);
|
|
191
|
+
+ if (relative.isAbsolute()) {
|
|
192
|
+
+ throw new IOException("Absolute archive entry path");
|
|
193
|
+
+ }
|
|
194
|
+
+ for (Path part : relative) {
|
|
195
|
+
+ if ("..".equals(part.toString())) {
|
|
196
|
+
+ throw new IOException("Parent traversal in archive entry");
|
|
197
|
+
+ }
|
|
198
|
+
+ }
|
|
199
|
+
+ Path result = root.resolve(relative).normalize();
|
|
200
|
+
+ if (!result.startsWith(root)) {
|
|
201
|
+
+ throw new IOException("Archive entry outside destination");
|
|
202
|
+
+ }
|
|
203
|
+
+ return result;
|
|
204
|
+
+ } catch (InvalidPathException e) {
|
|
205
|
+
+ throw new IOException("Invalid archive entry path", e);
|
|
206
|
+
+ }
|
|
207
|
+
+ }
|
|
208
|
+
+
|
|
209
|
+
+ public static void directory(Path root, String entryName) throws IOException {
|
|
210
|
+
+ ensureDirectory(root, resolve(root, entryName));
|
|
211
|
+
+ }
|
|
212
|
+
+
|
|
213
|
+
+ public static OutputStream openFile(Path root, String entryName) throws IOException {
|
|
214
|
+
+ Path target = resolve(root, entryName);
|
|
215
|
+
+ if (target.equals(root)) {
|
|
216
|
+
+ throw new IOException("Archive file entry names the destination directory");
|
|
217
|
+
+ }
|
|
218
|
+
+ ensureDirectory(root, target.getParent());
|
|
219
|
+
+ if (Files.exists(target, LinkOption.NOFOLLOW_LINKS)
|
|
220
|
+
+ && !Files.isRegularFile(target, LinkOption.NOFOLLOW_LINKS)) {
|
|
221
|
+
+ throw new IOException("Archive entry would overwrite a link or non-regular file");
|
|
222
|
+
+ }
|
|
223
|
+
+ return Files.newOutputStream(target, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING,
|
|
224
|
+
+ StandardOpenOption.WRITE, LinkOption.NOFOLLOW_LINKS);
|
|
225
|
+
+ }
|
|
226
|
+
+
|
|
227
|
+
+ private static void ensureDirectory(Path root, Path directory) throws IOException {
|
|
228
|
+
+ Path current = root;
|
|
229
|
+
+ for (Path part : root.relativize(directory)) {
|
|
230
|
+
+ current = current.resolve(part);
|
|
231
|
+
+ try {
|
|
232
|
+
+ Files.createDirectory(current);
|
|
233
|
+
+ } catch (FileAlreadyExistsException ignored) {
|
|
234
|
+
+ // Validate the existing component without following symbolic links.
|
|
235
|
+
+ }
|
|
236
|
+
+ if (!Files.isDirectory(current, LinkOption.NOFOLLOW_LINKS)) {
|
|
237
|
+
+ throw new IOException("Archive entry traverses a link or non-directory");
|
|
238
|
+
+ }
|
|
239
|
+
+ }
|
|
240
|
+
+ }
|
|
241
|
+
+}
|
|
242
|
+
diff --git a/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/CompressUtils.java b/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/CompressUtils.java
|
|
243
|
+
index cafa1bc764..4ec926e376 100644
|
|
244
|
+
--- a/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/CompressUtils.java
|
|
245
|
+
+++ b/folib-commons/folib-commons-core/src/main/java/com/veadan/folib/util/CompressUtils.java
|
|
246
|
+
@@ -10,7 +10,8 @@ import java.io.*;
|
|
247
|
+
import java.nio.charset.Charset;
|
|
248
|
+
import java.nio.charset.StandardCharsets;
|
|
249
|
+
import java.nio.file.Files;
|
|
250
|
+
-import java.nio.file.Paths;
|
|
251
|
+
+import java.nio.file.Path;
|
|
252
|
+
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
|
253
|
+
import java.util.Objects;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
@@ -42,6 +43,7 @@ public class CompressUtils {
|
|
257
|
+
*/
|
|
258
|
+
public static void unzip(InputStream inputStream, String destDir) throws IOException {
|
|
259
|
+
// ========== 核心改造:大文件用临时文件缓存,替代内存字节数组 ==========
|
|
260
|
+
+ Path root = ArchiveExtractionPaths.createRoot(destDir);
|
|
261
|
+
File tempZipFile = null;
|
|
262
|
+
try {
|
|
263
|
+
// 1. 创建临时文件(JVM退出时自动删除,避免磁盘残留)
|
|
264
|
+
@@ -66,22 +68,14 @@ public class CompressUtils {
|
|
265
|
+
ArchiveEntry entry = null;
|
|
266
|
+
while (Objects.nonNull(entry = in.getNextEntry())) {
|
|
267
|
+
if (in.canReadEntryData(entry)) {
|
|
268
|
+
- // 路径分隔符兼容处理
|
|
269
|
+
- String entryName = entry.getName().replace("\\", File.separator).replace("/", File.separator);
|
|
270
|
+
- File file = Paths.get(destDir, entryName).toFile();
|
|
271
|
+
-
|
|
272
|
+
- // 确保父目录存在
|
|
273
|
+
- if (!file.getParentFile().exists()) {
|
|
274
|
+
- Files.createDirectories(file.getParentFile().toPath());
|
|
275
|
+
+ if (entry instanceof ZipArchiveEntry && ((ZipArchiveEntry) entry).isUnixSymlink()) {
|
|
276
|
+
+ throw new IOException("Symbolic links in ZIP archives are not supported");
|
|
277
|
+
}
|
|
278
|
+
-
|
|
279
|
+
if (entry.isDirectory()) {
|
|
280
|
+
- if (!file.exists()) {
|
|
281
|
+
- Files.createDirectories(file.toPath());
|
|
282
|
+
- }
|
|
283
|
+
+ ArchiveExtractionPaths.directory(root, entry.getName());
|
|
284
|
+
} else {
|
|
285
|
+
- // 流式写入文件,避免大文件内容加载到内存
|
|
286
|
+
- try (OutputStream out = new FileOutputStream(file)) {
|
|
287
|
+
+ // Stream file contents, but never follow links or write outside the destination.
|
|
288
|
+
+ try (OutputStream out = ArchiveExtractionPaths.openFile(root, entry.getName())) {
|
|
289
|
+
IOUtils.copy(in, out);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
diff --git a/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/ArchiveExtractionPathsTest.java b/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/ArchiveExtractionPathsTest.java
|
|
293
|
+
new file mode 100644
|
|
294
|
+
index 0000000000..167132c778
|
|
295
|
+
--- /dev/null
|
|
296
|
+
+++ b/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/ArchiveExtractionPathsTest.java
|
|
297
|
+
@@ -0,0 +1,77 @@
|
|
298
|
+
+package com.veadan.folib.util;
|
|
299
|
+
+
|
|
300
|
+
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
|
301
|
+
+import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
|
|
302
|
+
+import org.junit.jupiter.api.Test;
|
|
303
|
+
+import org.junit.jupiter.api.io.TempDir;
|
|
304
|
+
+
|
|
305
|
+
+import java.io.IOException;
|
|
306
|
+
+import java.io.OutputStream;
|
|
307
|
+
+import java.nio.charset.StandardCharsets;
|
|
308
|
+
+import java.nio.file.Files;
|
|
309
|
+
+import java.nio.file.Path;
|
|
310
|
+
+
|
|
311
|
+
+import static org.junit.jupiter.api.Assertions.*;
|
|
312
|
+
+
|
|
313
|
+
+class ArchiveExtractionPathsTest {
|
|
314
|
+
+
|
|
315
|
+
+ @TempDir
|
|
316
|
+
+ Path temp;
|
|
317
|
+
+
|
|
318
|
+
+ @Test
|
|
319
|
+
+ void nestedFilesAndDirectoryEntriesRemainSupported() throws Exception {
|
|
320
|
+
+ Path root = ArchiveExtractionPaths.createRoot(temp.resolve("output").toString());
|
|
321
|
+
+ ArchiveExtractionPaths.directory(root, "./");
|
|
322
|
+
+ ArchiveExtractionPaths.directory(root, "目录/sub");
|
|
323
|
+
+ try (OutputStream out = ArchiveExtractionPaths.openFile(root, "目录/sub/test.txt")) {
|
|
324
|
+
+ out.write("hello".getBytes(StandardCharsets.UTF_8));
|
|
325
|
+
+ }
|
|
326
|
+
+ assertEquals("hello", Files.readString(root.resolve("目录/sub/test.txt")));
|
|
327
|
+
+ try (OutputStream out = ArchiveExtractionPaths.openFile(root, "目录/sub/test.txt")) {
|
|
328
|
+
+ out.write('x');
|
|
329
|
+
+ }
|
|
330
|
+
+ assertEquals("x", Files.readString(root.resolve("目录/sub/test.txt")));
|
|
331
|
+
+ }
|
|
332
|
+
+
|
|
333
|
+
+ @Test
|
|
334
|
+
+ void rejectsPathsOutsideDestination() throws Exception {
|
|
335
|
+
+ Path root = ArchiveExtractionPaths.createRoot(temp.resolve("output").toString());
|
|
336
|
+
+ for (String name : new String[]{"../outside.txt", "..\\outside.txt", "/outside.txt",
|
|
337
|
+
+ "C:\\outside.txt", "C:outside.txt", "\\\\host\\share\\outside.txt", "dir/../../outside.txt"}) {
|
|
338
|
+
+ assertThrows(IOException.class, () -> ArchiveExtractionPaths.openFile(root, name), name);
|
|
339
|
+
+ assertThrows(IOException.class, () -> ArchiveExtractionPaths.directory(root, name), name);
|
|
340
|
+
+ }
|
|
341
|
+
+ assertFalse(Files.exists(temp.resolve("outside.txt")));
|
|
342
|
+
+ }
|
|
343
|
+
+
|
|
344
|
+
+ @Test
|
|
345
|
+
+ void refusesExistingSymbolicLinkParentsAndFiles() throws Exception {
|
|
346
|
+
+ Path root = ArchiveExtractionPaths.createRoot(temp.resolve("output").toString());
|
|
347
|
+
+ Path outside = Files.createDirectory(temp.resolve("outside"));
|
|
348
|
+
+ Path sentinel = Files.writeString(outside.resolve("sentinel.txt"), "unchanged");
|
|
349
|
+
+ try {
|
|
350
|
+
+ Files.createSymbolicLink(root.resolve("linked-directory"), outside);
|
|
351
|
+
+ Files.createSymbolicLink(root.resolve("linked-file"), sentinel);
|
|
352
|
+
+ } catch (UnsupportedOperationException | IOException e) {
|
|
353
|
+
+ org.junit.jupiter.api.Assumptions.assumeTrue(false, "Symbolic links unavailable: " + e);
|
|
354
|
+
+ }
|
|
355
|
+
+ assertThrows(IOException.class, () -> ArchiveExtractionPaths.openFile(root, "linked-directory/new.txt"));
|
|
356
|
+
+ assertThrows(IOException.class, () -> ArchiveExtractionPaths.openFile(root, "linked-file"));
|
|
357
|
+
+ assertFalse(Files.exists(outside.resolve("new.txt")));
|
|
358
|
+
+ assertEquals("unchanged", Files.readString(sentinel));
|
|
359
|
+
+ }
|
|
360
|
+
+
|
|
361
|
+
+ @Test
|
|
362
|
+
+ void commonsZipExtractionRejectsOutsideEntry() throws Exception {
|
|
363
|
+
+ Path archive = temp.resolve("test.zip");
|
|
364
|
+
+ Path root = Files.createDirectory(temp.resolve("output"));
|
|
365
|
+
+ try (ZipArchiveOutputStream out = new ZipArchiveOutputStream(archive.toFile())) {
|
|
366
|
+
+ ZipArchiveEntry entry = new ZipArchiveEntry("../outside.txt");
|
|
367
|
+
+ out.putArchiveEntry(entry);
|
|
368
|
+
+ out.write('x');
|
|
369
|
+
+ out.closeArchiveEntry();
|
|
370
|
+
+ }
|
|
371
|
+
+ assertThrows(IOException.class, () -> CompressUtils.unzip(archive.toString(), root.toString()));
|
|
372
|
+
+ assertFalse(Files.exists(temp.resolve("outside.txt")));
|
|
373
|
+
+ }
|
|
374
|
+
+}
|
|
375
|
+
diff --git a/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/CompressUtilsTest.java b/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/CompressUtilsTest.java
|
|
376
|
+
index 1ef8aee825..21f65a103b 100644
|
|
377
|
+
--- a/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/CompressUtilsTest.java
|
|
378
|
+
+++ b/folib-commons/folib-commons-core/src/test/java/com/veadan/folib/util/CompressUtilsTest.java
|
|
379
|
+
@@ -148,15 +148,16 @@ class CompressUtilsTest {
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
@Test
|
|
383
|
+
- void testUnzip_NonExistentSourceFile_ThrowsIOException() {
|
|
384
|
+
- String nonExistentFile = "/non/existent/file.zip";
|
|
385
|
+
-
|
|
386
|
+
- // 执行并验证抛出IOException
|
|
387
|
+
- IOException exception = assertThrows(IOException.class,
|
|
388
|
+
- () -> CompressUtils.unzip(nonExistentFile, destDir.toString()));
|
|
389
|
+
-
|
|
390
|
+
- assertFalse(exception.getMessage().contains("No such file") ||
|
|
391
|
+
- exception.getMessage().contains("FileNotFoundException"));
|
|
392
|
+
+ void testUnzip_NonExistentSourceFile_ThrowsIOException() throws IOException {
|
|
393
|
+
+ Path nonExistentFile = destDir.resolve("missing.zip");
|
|
394
|
+
+ assertFalse(Files.exists(nonExistentFile));
|
|
395
|
+
+
|
|
396
|
+
+ // FileInputStream reports missing input as FileNotFoundException, independent of OS locale.
|
|
397
|
+
+ assertThrows(FileNotFoundException.class,
|
|
398
|
+
+ () -> CompressUtils.unzip(nonExistentFile.toString(), destDir.toString()));
|
|
399
|
+
+ try (java.util.stream.Stream<Path> entries = Files.list(destDir)) {
|
|
400
|
+
+ assertEquals(0, entries.count());
|
|
401
|
+
+ }
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
@Test
|
|
405
|
+
diff --git a/folib-commons/folib-commons-io/pom.xml b/folib-commons/folib-commons-io/pom.xml
|
|
406
|
+
index a5943723d6..4d7dcb31e5 100644
|
|
407
|
+
--- a/folib-commons/folib-commons-io/pom.xml
|
|
408
|
+
+++ b/folib-commons/folib-commons-io/pom.xml
|
|
409
|
+
@@ -90,13 +90,6 @@
|
|
410
|
+
</build>
|
|
411
|
+
|
|
412
|
+
<dependencies>
|
|
413
|
+
- <dependency>
|
|
414
|
+
- <groupId>commons-io</groupId>
|
|
415
|
+
- <artifactId>commons-io</artifactId>
|
|
416
|
+
- <version>2.4</version>
|
|
417
|
+
- <scope>test</scope>
|
|
418
|
+
- </dependency>
|
|
419
|
+
-
|
|
420
|
+
<dependency>
|
|
421
|
+
<groupId>com.veadan.folib.commons</groupId>
|
|
422
|
+
<artifactId>folib-commons-http</artifactId>
|
|
423
|
+
@@ -129,7 +122,6 @@
|
|
424
|
+
<dependency>
|
|
425
|
+
<groupId>commons-io</groupId>
|
|
426
|
+
<artifactId>commons-io</artifactId>
|
|
427
|
+
- <version>2.15.1</version>
|
|
428
|
+
</dependency>
|
|
429
|
+
</dependencies>
|
|
430
|
+
|
|
431
|
+
diff --git a/folib-data-service/pom.xml b/folib-data-service/pom.xml
|
|
432
|
+
index a50277a291..f19c28ad46 100644
|
|
433
|
+
--- a/folib-data-service/pom.xml
|
|
434
|
+
+++ b/folib-data-service/pom.xml
|
|
435
|
+
@@ -116,7 +116,6 @@
|
|
436
|
+
<dependency>
|
|
437
|
+
<groupId>org.springframework</groupId>
|
|
438
|
+
<artifactId>spring-web</artifactId>
|
|
439
|
+
- <version>6.2.10</version>
|
|
440
|
+
</dependency>
|
|
441
|
+
<dependency>
|
|
442
|
+
<groupId>org.springframework</groupId>
|
|
443
|
+
diff --git a/folib-data-service/src/test/java/com/veadan/folib/config/hazelcast/HazelcastClusterCompatibilityTest.java b/folib-data-service/src/test/java/com/veadan/folib/config/hazelcast/HazelcastClusterCompatibilityTest.java
|
|
444
|
+
new file mode 100644
|
|
445
|
+
index 0000000000..6dc61ab57c
|
|
446
|
+
--- /dev/null
|
|
447
|
+
+++ b/folib-data-service/src/test/java/com/veadan/folib/config/hazelcast/HazelcastClusterCompatibilityTest.java
|
|
448
|
+
@@ -0,0 +1,124 @@
|
|
449
|
+
+package com.veadan.folib.config.hazelcast;
|
|
450
|
+
+
|
|
451
|
+
+import com.hazelcast.config.Config;
|
|
452
|
+
+import com.hazelcast.config.EvictionPolicy;
|
|
453
|
+
+import com.hazelcast.config.MaxSizePolicy;
|
|
454
|
+
+import com.hazelcast.core.HazelcastInstance;
|
|
455
|
+
+import com.veadan.folib.components.DistributedCacheComponent;
|
|
456
|
+
+import com.veadan.folib.components.DistributedLockComponent;
|
|
457
|
+
+import org.junit.jupiter.api.Test;
|
|
458
|
+
+import org.junit.jupiter.api.Timeout;
|
|
459
|
+
+
|
|
460
|
+
+import java.lang.reflect.Field;
|
|
461
|
+
+import java.net.InetAddress;
|
|
462
|
+
+import java.net.ServerSocket;
|
|
463
|
+
+import java.util.UUID;
|
|
464
|
+
+import java.util.concurrent.TimeUnit;
|
|
465
|
+
+
|
|
466
|
+
+import static org.junit.jupiter.api.Assertions.*;
|
|
467
|
+
+
|
|
468
|
+
+class HazelcastClusterCompatibilityTest {
|
|
469
|
+
+
|
|
470
|
+
+ @Test
|
|
471
|
+
+ @Timeout(value = 90, unit = TimeUnit.SECONDS)
|
|
472
|
+
+ void twoTcpMembersShareCacheAndDistributedLocks() throws Exception {
|
|
473
|
+
+ int firstPort;
|
|
474
|
+
+ int secondPort;
|
|
475
|
+
+ try (ServerSocket first = new ServerSocket(0, 1, InetAddress.getLoopbackAddress());
|
|
476
|
+
+ ServerSocket second = new ServerSocket(0, 1, InetAddress.getLoopbackAddress())) {
|
|
477
|
+
+ firstPort = first.getLocalPort();
|
|
478
|
+
+ secondPort = second.getLocalPort();
|
|
479
|
+
+ }
|
|
480
|
+
+
|
|
481
|
+
+ String clusterName = "folib-compat-" + UUID.randomUUID();
|
|
482
|
+
+ String[] members = {"127.0.0.1:" + firstPort, "127.0.0.1:" + secondPort};
|
|
483
|
+
+ HazelcastConfiguration firstConfig = configuration(clusterName, firstPort, members);
|
|
484
|
+
+ HazelcastConfiguration secondConfig = configuration(clusterName, secondPort, members);
|
|
485
|
+
+
|
|
486
|
+
+ HazelcastInstance first = null;
|
|
487
|
+
+ HazelcastInstance second = null;
|
|
488
|
+
+ try {
|
|
489
|
+
+ first = firstConfig.hazelcastInstance(memberConfig(firstConfig, "compat-first-" + clusterName));
|
|
490
|
+
+ second = secondConfig.hazelcastInstance(memberConfig(secondConfig, "compat-second-" + clusterName));
|
|
491
|
+
+
|
|
492
|
+
+ long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(20);
|
|
493
|
+
+ while ((first.getCluster().getMembers().size() != 2 || second.getCluster().getMembers().size() != 2)
|
|
494
|
+
+ && System.nanoTime() < deadline) {
|
|
495
|
+
+ Thread.sleep(100);
|
|
496
|
+
+ }
|
|
497
|
+
+ assertEquals(2, first.getCluster().getMembers().size());
|
|
498
|
+
+ assertEquals(2, second.getCluster().getMembers().size());
|
|
499
|
+
+
|
|
500
|
+
+ DistributedCacheComponent cache1 = inject(new DistributedCacheComponent(), first);
|
|
501
|
+
+ DistributedCacheComponent cache2 = inject(new DistributedCacheComponent(), second);
|
|
502
|
+
+ cache1.put("cluster-compat-key", "value");
|
|
503
|
+
+ assertEquals("value", cache2.get("cluster-compat-key"));
|
|
504
|
+
+ cache2.delete("cluster-compat-key");
|
|
505
|
+
+ assertNull(cache1.get("cluster-compat-key"));
|
|
506
|
+
+
|
|
507
|
+
+ DistributedLockComponent lock1 = inject(new DistributedLockComponent(), first);
|
|
508
|
+
+ DistributedLockComponent lock2 = inject(new DistributedLockComponent(), second);
|
|
509
|
+
+ assertTrue(lock1.lock("cluster-compat-lock", 5, TimeUnit.SECONDS));
|
|
510
|
+
+ try {
|
|
511
|
+
+ assertFalse(lock2.lock("cluster-compat-lock", 200, TimeUnit.MILLISECONDS));
|
|
512
|
+
+ } finally {
|
|
513
|
+
+ lock1.unLock("cluster-compat-lock");
|
|
514
|
+
+ }
|
|
515
|
+
+ assertTrue(lock2.lock("cluster-compat-lock", 5, TimeUnit.SECONDS));
|
|
516
|
+
+ lock2.unLock("cluster-compat-lock");
|
|
517
|
+
+ } finally {
|
|
518
|
+
+ if (second != null) {
|
|
519
|
+
+ second.getLifecycleService().shutdown();
|
|
520
|
+
+ }
|
|
521
|
+
+ if (first != null) {
|
|
522
|
+
+ first.getLifecycleService().shutdown();
|
|
523
|
+
+ }
|
|
524
|
+
+ }
|
|
525
|
+
+ }
|
|
526
|
+
+
|
|
527
|
+
+ private Config memberConfig(HazelcastConfiguration source, String instanceName) {
|
|
528
|
+
+ Config config = source.hazelcastConfig(new HazelcastInstanceId(instanceName));
|
|
529
|
+
+ // Restrict only this test's nodes. The production network settings are untouched.
|
|
530
|
+
+ config.getNetworkConfig().getInterfaces().setEnabled(true).addInterface("127.0.0.1");
|
|
531
|
+
+ config.getNetworkConfig().setPortAutoIncrement(false);
|
|
532
|
+
+ config.getNetworkConfig().getJoin().getAutoDetectionConfig().setEnabled(false);
|
|
533
|
+
+ config.setProperty("hazelcast.partition.count", "17");
|
|
534
|
+
+ config.setProperty("hazelcast.operation.thread.count", "2");
|
|
535
|
+
+ config.setProperty("hazelcast.operation.generic.thread.count", "2");
|
|
536
|
+
+ config.setProperty("hazelcast.io.input.thread.count", "1");
|
|
537
|
+
+ config.setProperty("hazelcast.io.output.thread.count", "1");
|
|
538
|
+
+ config.setProperty("hazelcast.event.thread.count", "2");
|
|
539
|
+
+ config.setProperty("hazelcast.shutdownhook.enabled", "false");
|
|
540
|
+
+ return config;
|
|
541
|
+
+ }
|
|
542
|
+
+
|
|
543
|
+
+ private HazelcastConfiguration configuration(String clusterName, int port, String[] members) {
|
|
544
|
+
+ HazelcastConfiguration configuration = new HazelcastConfiguration();
|
|
545
|
+
+ configuration.groupConfigName = clusterName;
|
|
546
|
+
+ configuration.tcpIpPort = port;
|
|
547
|
+
+ configuration.enableTcpIpConfig = true;
|
|
548
|
+
+ configuration.tcpIpMembers = members;
|
|
549
|
+
+ configuration.tcpIpTimeoutSeconds = 5;
|
|
550
|
+
+ configuration.splitBrainProtectionEnabled = true;
|
|
551
|
+
+ configuration.splitBrainProtectionMinimumClusterSize = 2;
|
|
552
|
+
+ configuration.remoteRepositoryAlivenessMaxSizeLimit = 1000;
|
|
553
|
+
+ configuration.remoteRepositoryAlivenessMaxSizePolicy = MaxSizePolicy.FREE_HEAP_SIZE;
|
|
554
|
+
+ configuration.remoteRepositoryAlivenessEvictionPolicy = EvictionPolicy.LFU;
|
|
555
|
+
+ configuration.tagsMaxSizeLimit = 1000;
|
|
556
|
+
+ configuration.tagsMaxSizePolicy = MaxSizePolicy.FREE_HEAP_SIZE;
|
|
557
|
+
+ configuration.tagsEvictionPolicy = EvictionPolicy.LFU;
|
|
558
|
+
+ configuration.authenticationsCacheInvalidateInterval = 10;
|
|
559
|
+
+ configuration.authenticationsCacheCacheLocalEntries = true;
|
|
560
|
+
+ configuration.authenticationsCacheEvictionConfigSize = 1000;
|
|
561
|
+
+ configuration.authenticationsCacheEvictionConfigMaxSizePolicy = MaxSizePolicy.ENTRY_COUNT;
|
|
562
|
+
+ configuration.authenticationsCacheInvalidateOnChange = true;
|
|
563
|
+
+ return configuration;
|
|
564
|
+
+ }
|
|
565
|
+
+
|
|
566
|
+
+ private <T> T inject(T component, HazelcastInstance instance) throws Exception {
|
|
567
|
+
+ Field field = component.getClass().getDeclaredField("hazelcastInstance");
|
|
568
|
+
+ field.setAccessible(true);
|
|
569
|
+
+ field.set(component, instance);
|
|
570
|
+
+ return component;
|
|
571
|
+
+ }
|
|
572
|
+
+}
|
|
573
|
+
diff --git a/folib-rest-client/pom.xml b/folib-rest-client/pom.xml
|
|
574
|
+
index 737d3dc65e..6442459584 100644
|
|
575
|
+
--- a/folib-rest-client/pom.xml
|
|
576
|
+
+++ b/folib-rest-client/pom.xml
|
|
577
|
+
@@ -46,6 +46,39 @@
|
|
578
|
+
</plugins>
|
|
579
|
+
</build>
|
|
580
|
+
|
|
581
|
+
+ <dependencyManagement>
|
|
582
|
+
+ <dependencies>
|
|
583
|
+
+ <dependency>
|
|
584
|
+
+ <groupId>com.fasterxml.jackson</groupId>
|
|
585
|
+
+ <artifactId>jackson-bom</artifactId>
|
|
586
|
+
+ <version>2.18.12</version>
|
|
587
|
+
+ <type>pom</type>
|
|
588
|
+
+ <scope>import</scope>
|
|
589
|
+
+ </dependency>
|
|
590
|
+
+ <dependency>
|
|
591
|
+
+ <groupId>org.springframework</groupId>
|
|
592
|
+
+ <artifactId>spring-framework-bom</artifactId>
|
|
593
|
+
+ <version>6.2.19</version>
|
|
594
|
+
+ <type>pom</type>
|
|
595
|
+
+ <scope>import</scope>
|
|
596
|
+
+ </dependency>
|
|
597
|
+
+ <dependency>
|
|
598
|
+
+ <groupId>io.rest-assured</groupId>
|
|
599
|
+
+ <artifactId>rest-assured-bom</artifactId>
|
|
600
|
+
+ <version>5.5.7</version>
|
|
601
|
+
+ <type>pom</type>
|
|
602
|
+
+ <scope>import</scope>
|
|
603
|
+
+ </dependency>
|
|
604
|
+
+ <dependency>
|
|
605
|
+
+ <groupId>org.apache.groovy</groupId>
|
|
606
|
+
+ <artifactId>groovy-bom</artifactId>
|
|
607
|
+
+ <version>4.0.32</version>
|
|
608
|
+
+ <type>pom</type>
|
|
609
|
+
+ <scope>import</scope>
|
|
610
|
+
+ </dependency>
|
|
611
|
+
+ </dependencies>
|
|
612
|
+
+ </dependencyManagement>
|
|
613
|
+
+
|
|
614
|
+
<dependencies>
|
|
615
|
+
<dependency>
|
|
616
|
+
<groupId>com.veadan.folib</groupId>
|
|
617
|
+
@@ -70,7 +103,7 @@
|
|
618
|
+
<dependency>
|
|
619
|
+
<groupId>com.fasterxml.jackson.core</groupId>
|
|
620
|
+
<artifactId>jackson-databind</artifactId>
|
|
621
|
+
- <version>2.15.4</version>
|
|
622
|
+
+ <version>2.18.12</version>
|
|
623
|
+
</dependency>
|
|
624
|
+
<dependency>
|
|
625
|
+
<groupId>com.alibaba</groupId>
|
|
626
|
+
@@ -101,7 +134,7 @@
|
|
627
|
+
<dependency>
|
|
628
|
+
<groupId>io.rest-assured</groupId>
|
|
629
|
+
<artifactId>spring-mock-mvc</artifactId>
|
|
630
|
+
- <version>4.2.0</version>
|
|
631
|
+
+ <version>5.5.7</version>
|
|
632
|
+
</dependency>
|
|
633
|
+
|
|
634
|
+
<dependency>
|
|
635
|
+
diff --git a/folib-security/folib-authentication-registry/pom.xml b/folib-security/folib-authentication-registry/pom.xml
|
|
636
|
+
index 8471b1e9e2..edfd75521b 100644
|
|
637
|
+
--- a/folib-security/folib-authentication-registry/pom.xml
|
|
638
|
+
+++ b/folib-security/folib-authentication-registry/pom.xml
|
|
639
|
+
@@ -104,7 +104,6 @@
|
|
640
|
+
<dependency>
|
|
641
|
+
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
642
|
+
<artifactId>jackson-datatype-jsr310</artifactId>
|
|
643
|
+
- <version>2.15.4</version>
|
|
644
|
+
</dependency>
|
|
645
|
+
|
|
646
|
+
<!-- <dependency>-->
|
|
647
|
+
diff --git a/folib-security/folib-security-api/pom.xml b/folib-security/folib-security-api/pom.xml
|
|
648
|
+
index 34580bbbc4..b5f3a4de69 100644
|
|
649
|
+
--- a/folib-security/folib-security-api/pom.xml
|
|
650
|
+
+++ b/folib-security/folib-security-api/pom.xml
|
|
651
|
+
@@ -89,13 +89,11 @@
|
|
652
|
+
<dependency>
|
|
653
|
+
<groupId>org.springframework</groupId>
|
|
654
|
+
<artifactId>spring-context</artifactId>
|
|
655
|
+
- <version>6.2.10</version>
|
|
656
|
+
</dependency>
|
|
657
|
+
|
|
658
|
+
<dependency>
|
|
659
|
+
<groupId>org.springframework</groupId>
|
|
660
|
+
<artifactId>spring-context-support</artifactId>
|
|
661
|
+
- <version>6.2.10</version>
|
|
662
|
+
</dependency>
|
|
663
|
+
|
|
664
|
+
<dependency>
|
|
665
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianGroupInterceptor.java b/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianGroupInterceptor.java
|
|
666
|
+
index 97fd24b4a0..5ba08026be 100644
|
|
667
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianGroupInterceptor.java
|
|
668
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianGroupInterceptor.java
|
|
669
|
+
@@ -12,7 +12,6 @@ import com.veadan.folib.storage.repository.Repository;
|
|
670
|
+
import com.veadan.folib.util.DebianUtils;
|
|
671
|
+
import com.veadan.folib.utils.PathUtils;
|
|
672
|
+
import lombok.extern.slf4j.Slf4j;
|
|
673
|
+
-import org.checkerframework.checker.units.qual.A;
|
|
674
|
+
import org.springframework.beans.factory.annotation.Autowired;
|
|
675
|
+
import org.springframework.stereotype.Component;
|
|
676
|
+
import org.springframework.util.StopWatch;
|
|
677
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianPackagesMetadataIndexer.java b/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianPackagesMetadataIndexer.java
|
|
678
|
+
index d97af00f2d..b00aaf1498 100644
|
|
679
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianPackagesMetadataIndexer.java
|
|
680
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-debian-layout-provider/src/main/java/com/veadan/folib/indexer/DebianPackagesMetadataIndexer.java
|
|
681
|
+
@@ -7,7 +7,6 @@ import com.veadan.folib.services.ArtifactManagementService;
|
|
682
|
+
import com.veadan.folib.storage.repository.Repository;
|
|
683
|
+
import com.veadan.folib.util.DebianUtils;
|
|
684
|
+
import lombok.extern.slf4j.Slf4j;
|
|
685
|
+
-import org.apache.commons.compress.compressors.CompressorException;
|
|
686
|
+
|
|
687
|
+
import java.io.BufferedWriter;
|
|
688
|
+
import java.io.File;
|
|
689
|
+
@@ -41,7 +40,7 @@ public class DebianPackagesMetadataIndexer extends DebianPackagesMetadataIndexer
|
|
690
|
+
log.debug("Indexing coordinates: {}", coordinates);
|
|
691
|
+
tmpFile = this.writePackagesIndex(mds, coordinates);
|
|
692
|
+
this.writePackagesFileContentToRepo(packagesContext, tmpFile);
|
|
693
|
+
- } catch (CompressorException | IOException e) {
|
|
694
|
+
+ } catch (IOException e) {
|
|
695
|
+
throw new RuntimeException(e);
|
|
696
|
+
} finally {
|
|
697
|
+
DebianUtils.deleteTempFile(tmpFile);
|
|
698
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-docker-layout-provider/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-docker-layout-provider/pom.xml
|
|
699
|
+
index 5ddf4c8eca..1200f4b28d 100644
|
|
700
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-docker-layout-provider/pom.xml
|
|
701
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-docker-layout-provider/pom.xml
|
|
702
|
+
@@ -208,7 +208,7 @@
|
|
703
|
+
</dependency>
|
|
704
|
+
|
|
705
|
+
<dependency>
|
|
706
|
+
- <groupId>org.codehaus.groovy</groupId>
|
|
707
|
+
+ <groupId>org.apache.groovy</groupId>
|
|
708
|
+
<artifactId>groovy</artifactId>
|
|
709
|
+
</dependency>
|
|
710
|
+
|
|
711
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-gitlfs-layout-provider/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-gitlfs-layout-provider/pom.xml
|
|
712
|
+
index 7f62a4965c..14048d1e48 100644
|
|
713
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-gitlfs-layout-provider/pom.xml
|
|
714
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-gitlfs-layout-provider/pom.xml
|
|
715
|
+
@@ -163,7 +163,7 @@
|
|
716
|
+
</dependency>
|
|
717
|
+
|
|
718
|
+
<dependency>
|
|
719
|
+
- <groupId>org.codehaus.groovy</groupId>
|
|
720
|
+
+ <groupId>org.apache.groovy</groupId>
|
|
721
|
+
<artifactId>groovy</artifactId>
|
|
722
|
+
<scope>test</scope>
|
|
723
|
+
</dependency>
|
|
724
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-go-layout-provider/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-go-layout-provider/pom.xml
|
|
725
|
+
index 058960d9d7..ca27f30c94 100644
|
|
726
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-go-layout-provider/pom.xml
|
|
727
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-go-layout-provider/pom.xml
|
|
728
|
+
@@ -145,7 +145,7 @@
|
|
729
|
+
</dependency>
|
|
730
|
+
|
|
731
|
+
<dependency>
|
|
732
|
+
- <groupId>org.codehaus.groovy</groupId>
|
|
733
|
+
+ <groupId>org.apache.groovy</groupId>
|
|
734
|
+
<artifactId>groovy</artifactId>
|
|
735
|
+
<scope>test</scope>
|
|
736
|
+
</dependency>
|
|
737
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-helm-layout-provider/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-helm-layout-provider/pom.xml
|
|
738
|
+
index 58b06fde4d..7630f62e3b 100644
|
|
739
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-helm-layout-provider/pom.xml
|
|
740
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-helm-layout-provider/pom.xml
|
|
741
|
+
@@ -112,7 +112,6 @@
|
|
742
|
+
<dependency>
|
|
743
|
+
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
|
744
|
+
<artifactId>jackson-dataformat-yaml</artifactId>
|
|
745
|
+
- <version>2.16.1</version>
|
|
746
|
+
</dependency>
|
|
747
|
+
<!-- https://mvnrepository.com/artifact/org.yaml/snakeyaml -->
|
|
748
|
+
<dependency>
|
|
749
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-huggingface-layout-provider/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-huggingface-layout-provider/pom.xml
|
|
750
|
+
index 2d56421fb4..3f534f2d13 100644
|
|
751
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-huggingface-layout-provider/pom.xml
|
|
752
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-huggingface-layout-provider/pom.xml
|
|
753
|
+
@@ -160,7 +160,7 @@
|
|
754
|
+
</dependency>
|
|
755
|
+
|
|
756
|
+
<dependency>
|
|
757
|
+
- <groupId>org.codehaus.groovy</groupId>
|
|
758
|
+
+ <groupId>org.apache.groovy</groupId>
|
|
759
|
+
<artifactId>groovy</artifactId>
|
|
760
|
+
<scope>test</scope>
|
|
761
|
+
</dependency>
|
|
762
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-maven-metadata-api/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-maven-metadata-api/pom.xml
|
|
763
|
+
index 42d2c2c358..f658326c3d 100644
|
|
764
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-maven-metadata-api/pom.xml
|
|
765
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-maven-metadata-api/pom.xml
|
|
766
|
+
@@ -71,7 +71,6 @@
|
|
767
|
+
<dependency>
|
|
768
|
+
<groupId>org.springframework</groupId>
|
|
769
|
+
<artifactId>spring-web</artifactId>
|
|
770
|
+
- <version>6.2.10</version>
|
|
771
|
+
</dependency>
|
|
772
|
+
<dependency>
|
|
773
|
+
<groupId>org.apache.maven.indexer</groupId>
|
|
774
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-storage-maven-layout-provider/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-storage-maven-layout-provider/pom.xml
|
|
775
|
+
index d4bc37c72b..a6a517fe02 100644
|
|
776
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-storage-maven-layout-provider/pom.xml
|
|
777
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-maven-layout/folib-storage-maven-layout-provider/pom.xml
|
|
778
|
+
@@ -152,7 +152,7 @@
|
|
779
|
+
</dependency>
|
|
780
|
+
|
|
781
|
+
<dependency>
|
|
782
|
+
- <groupId>org.codehaus.groovy</groupId>
|
|
783
|
+
+ <groupId>org.apache.groovy</groupId>
|
|
784
|
+
<artifactId>groovy</artifactId>
|
|
785
|
+
</dependency>
|
|
786
|
+
|
|
787
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-npm-layout-provider/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-npm-layout-provider/pom.xml
|
|
788
|
+
index e72e24228d..be937ee9cb 100644
|
|
789
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-npm-layout-provider/pom.xml
|
|
790
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-npm-layout-provider/pom.xml
|
|
791
|
+
@@ -150,11 +150,6 @@
|
|
792
|
+
<scope>test</scope>
|
|
793
|
+
</dependency>
|
|
794
|
+
|
|
795
|
+
- <dependency>
|
|
796
|
+
- <groupId>org.apache.commons</groupId>
|
|
797
|
+
- <artifactId>commons-compress</artifactId>
|
|
798
|
+
- <version>1.26.2</version>
|
|
799
|
+
- </dependency>
|
|
800
|
+
|
|
801
|
+
<!-- <dependency>-->
|
|
802
|
+
<!-- <groupId>io.github.classgraph</groupId>-->
|
|
803
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-nuget-layout-provider/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-nuget-layout-provider/pom.xml
|
|
804
|
+
index 493e575980..f37c44df7c 100644
|
|
805
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-nuget-layout-provider/pom.xml
|
|
806
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-nuget-layout-provider/pom.xml
|
|
807
|
+
@@ -134,7 +134,7 @@
|
|
808
|
+
</dependency>
|
|
809
|
+
|
|
810
|
+
<dependency>
|
|
811
|
+
- <groupId>org.codehaus.groovy</groupId>
|
|
812
|
+
+ <groupId>org.apache.groovy</groupId>
|
|
813
|
+
<artifactId>groovy</artifactId>
|
|
814
|
+
</dependency>
|
|
815
|
+
|
|
816
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-p2-layout-provider/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-p2-layout-provider/pom.xml
|
|
817
|
+
index 146ceb73c9..59cd6960b5 100644
|
|
818
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-p2-layout-provider/pom.xml
|
|
819
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-p2-layout-provider/pom.xml
|
|
820
|
+
@@ -103,7 +103,7 @@
|
|
821
|
+
</dependency>
|
|
822
|
+
|
|
823
|
+
<dependency>
|
|
824
|
+
- <groupId>org.codehaus.groovy</groupId>
|
|
825
|
+
+ <groupId>org.apache.groovy</groupId>
|
|
826
|
+
<artifactId>groovy</artifactId>
|
|
827
|
+
</dependency>
|
|
828
|
+
|
|
829
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-php-layout-provider/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-php-layout-provider/pom.xml
|
|
830
|
+
index da45631109..21d415b83e 100644
|
|
831
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-php-layout-provider/pom.xml
|
|
832
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-php-layout-provider/pom.xml
|
|
833
|
+
@@ -146,7 +146,7 @@
|
|
834
|
+
</dependency>
|
|
835
|
+
|
|
836
|
+
<dependency>
|
|
837
|
+
- <groupId>org.codehaus.groovy</groupId>
|
|
838
|
+
+ <groupId>org.apache.groovy</groupId>
|
|
839
|
+
<artifactId>groovy</artifactId>
|
|
840
|
+
<scope>test</scope>
|
|
841
|
+
</dependency>
|
|
842
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-pypi-layout-provider/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-pypi-layout-provider/pom.xml
|
|
843
|
+
index e9d435d7ab..f7a09d087b 100644
|
|
844
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-pypi-layout-provider/pom.xml
|
|
845
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-pypi-layout-provider/pom.xml
|
|
846
|
+
@@ -243,7 +243,7 @@
|
|
847
|
+
</dependency>
|
|
848
|
+
|
|
849
|
+
<dependency>
|
|
850
|
+
- <groupId>org.codehaus.groovy</groupId>
|
|
851
|
+
+ <groupId>org.apache.groovy</groupId>
|
|
852
|
+
<artifactId>groovy</artifactId>
|
|
853
|
+
<scope>test</scope>
|
|
854
|
+
</dependency>
|
|
855
|
+
diff --git a/folib-storage/folib-storage-layout-providers/folib-storage-raw-layout-provider/pom.xml b/folib-storage/folib-storage-layout-providers/folib-storage-raw-layout-provider/pom.xml
|
|
856
|
+
index 97aa30f804..a2f3e20929 100644
|
|
857
|
+
--- a/folib-storage/folib-storage-layout-providers/folib-storage-raw-layout-provider/pom.xml
|
|
858
|
+
+++ b/folib-storage/folib-storage-layout-providers/folib-storage-raw-layout-provider/pom.xml
|
|
859
|
+
@@ -159,7 +159,7 @@
|
|
860
|
+
</dependency>
|
|
861
|
+
|
|
862
|
+
<dependency>
|
|
863
|
+
- <groupId>org.codehaus.groovy</groupId>
|
|
864
|
+
+ <groupId>org.apache.groovy</groupId>
|
|
865
|
+
<artifactId>groovy</artifactId>
|
|
866
|
+
<scope>test</scope>
|
|
867
|
+
</dependency>
|
|
868
|
+
diff --git a/folib-web-core/pom.xml b/folib-web-core/pom.xml
|
|
869
|
+
index 5324c0f357..eb32a7357a 100644
|
|
870
|
+
--- a/folib-web-core/pom.xml
|
|
871
|
+
+++ b/folib-web-core/pom.xml
|
|
872
|
+
@@ -448,7 +448,6 @@
|
|
873
|
+
<dependency>
|
|
874
|
+
<groupId>org.springframework</groupId>
|
|
875
|
+
<artifactId>spring-core</artifactId>
|
|
876
|
+
- <version>6.2.10</version>
|
|
877
|
+
</dependency>
|
|
878
|
+
<dependency>
|
|
879
|
+
<groupId>org.springframework</groupId>
|
|
880
|
+
@@ -457,12 +456,10 @@
|
|
881
|
+
<dependency>
|
|
882
|
+
<groupId>org.springframework</groupId>
|
|
883
|
+
<artifactId>spring-web</artifactId>
|
|
884
|
+
- <version>6.2.10</version>
|
|
885
|
+
</dependency>
|
|
886
|
+
<dependency>
|
|
887
|
+
<groupId>org.springframework</groupId>
|
|
888
|
+
<artifactId>spring-webmvc</artifactId>
|
|
889
|
+
- <version>6.2.10</version>
|
|
890
|
+
</dependency>
|
|
891
|
+
<dependency>
|
|
892
|
+
<groupId>org.springframework</groupId>
|
|
893
|
+
@@ -763,7 +760,6 @@
|
|
894
|
+
<dependency>
|
|
895
|
+
<groupId>org.springframework</groupId>
|
|
896
|
+
<artifactId>spring-core</artifactId>
|
|
897
|
+
- <version>6.2.10</version>
|
|
898
|
+
</dependency>
|
|
899
|
+
<dependency>
|
|
900
|
+
<groupId>${project.groupId}</groupId>
|
|
901
|
+
@@ -789,6 +785,13 @@
|
|
902
|
+
<groupId>org.jfrog.artifactory.client</groupId>
|
|
903
|
+
<artifactId>artifactory-java-client-services</artifactId>
|
|
904
|
+
<version>2.12.0</version>
|
|
905
|
+
+ <exclusions>
|
|
906
|
+
+ <!-- Groovy 4 is already supplied by TinkerPop; do not load two core runtimes. -->
|
|
907
|
+
+ <exclusion>
|
|
908
|
+
+ <groupId>org.codehaus.groovy</groupId>
|
|
909
|
+
+ <artifactId>groovy</artifactId>
|
|
910
|
+
+ </exclusion>
|
|
911
|
+
+ </exclusions>
|
|
912
|
+
</dependency>
|
|
913
|
+
<dependency>
|
|
914
|
+
<groupId>org.springframework.boot</groupId>
|
|
915
|
+
@@ -838,7 +841,6 @@
|
|
916
|
+
<dependency>
|
|
917
|
+
<groupId>com.github.junrar</groupId>
|
|
918
|
+
<artifactId>junrar</artifactId>
|
|
919
|
+
- <version>7.5.5</version>
|
|
920
|
+
</dependency>
|
|
921
|
+
<!-- Project Reactor -->
|
|
922
|
+
<dependency>
|
|
923
|
+
@@ -871,7 +873,6 @@
|
|
924
|
+
<dependency>
|
|
925
|
+
<groupId>com.fasterxml.jackson.datatype</groupId>
|
|
926
|
+
<artifactId>jackson-datatype-guava</artifactId>
|
|
927
|
+
- <version>2.15.4</version>
|
|
928
|
+
</dependency>
|
|
929
|
+
<!-- sbom CycloneDX -->
|
|
930
|
+
<dependency>
|
|
931
|
+
@@ -930,12 +931,6 @@
|
|
932
|
+
<dependency>
|
|
933
|
+
<groupId>commons-io</groupId>
|
|
934
|
+
<artifactId>commons-io</artifactId>
|
|
935
|
+
- <version>2.15.1</version>
|
|
936
|
+
- </dependency>
|
|
937
|
+
- <dependency>
|
|
938
|
+
- <groupId>org.apache.commons</groupId>
|
|
939
|
+
- <artifactId>commons-compress</artifactId>
|
|
940
|
+
- <version>1.26.0</version>
|
|
941
|
+
</dependency>
|
|
942
|
+
<!-- 暂时禁用 mockito-inline,因为 Deepin JDK 不支持 agent attachment -->
|
|
943
|
+
<!--
|
|
944
|
+
diff --git a/folib-web-core/src/main/java/com/veadan/folib/app/FolibSpringBootApplication.java b/folib-web-core/src/main/java/com/veadan/folib/app/FolibSpringBootApplication.java
|
|
945
|
+
index 296b6f901e..69aca7b47a 100644
|
|
946
|
+
--- a/folib-web-core/src/main/java/com/veadan/folib/app/FolibSpringBootApplication.java
|
|
947
|
+
+++ b/folib-web-core/src/main/java/com/veadan/folib/app/FolibSpringBootApplication.java
|
|
948
|
+
@@ -1,6 +1,7 @@
|
|
949
|
+
package com.veadan.folib.app;
|
|
950
|
+
|
|
951
|
+
import com.veadan.folib.config.WebConfig;
|
|
952
|
+
+import com.veadan.folib.config.LegacySpringDataWebConfig;
|
|
953
|
+
import com.veadan.folib.config.janusgraph.FolibCassandraEmbeddedProperties;
|
|
954
|
+
import com.veadan.folib.config.janusgraph.JanusGraphDbProfile;
|
|
955
|
+
import org.mybatis.spring.annotation.MapperScan;
|
|
956
|
+
@@ -11,6 +12,7 @@ import org.springframework.boot.SpringApplication;
|
|
957
|
+
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
958
|
+
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
|
|
959
|
+
import org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration;
|
|
960
|
+
+import org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration;
|
|
961
|
+
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
962
|
+
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
|
|
963
|
+
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
|
|
964
|
+
@@ -26,8 +28,9 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
|
965
|
+
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,
|
|
966
|
+
HibernateJpaAutoConfiguration.class,
|
|
967
|
+
Neo4jDataAutoConfiguration.class,
|
|
968
|
+
- CassandraAutoConfiguration.class})
|
|
969
|
+
-@Import(WebConfig.class)
|
|
970
|
+
+ CassandraAutoConfiguration.class,
|
|
971
|
+
+ SpringDataWebAutoConfiguration.class})
|
|
972
|
+
+@Import({WebConfig.class, LegacySpringDataWebConfig.class})
|
|
973
|
+
@MapperScan(basePackages = {"com.veadan.folib.scanner.mapper", "com.veadan.folib.mapper"})
|
|
974
|
+
@EnableAsync
|
|
975
|
+
public class FolibSpringBootApplication {
|
|
976
|
+
diff --git a/folib-web-core/src/main/java/com/veadan/folib/config/LegacySpringDataWebConfig.java b/folib-web-core/src/main/java/com/veadan/folib/config/LegacySpringDataWebConfig.java
|
|
977
|
+
new file mode 100644
|
|
978
|
+
index 0000000000..89ee386d70
|
|
979
|
+
--- /dev/null
|
|
980
|
+
+++ b/folib-web-core/src/main/java/com/veadan/folib/config/LegacySpringDataWebConfig.java
|
|
981
|
+
@@ -0,0 +1,41 @@
|
|
982
|
+
+package com.veadan.folib.config;
|
|
983
|
+
+
|
|
984
|
+
+import org.springframework.context.annotation.Bean;
|
|
985
|
+
+import org.springframework.context.annotation.Configuration;
|
|
986
|
+
+import org.springframework.core.env.Environment;
|
|
987
|
+
+import org.springframework.data.domain.PageRequest;
|
|
988
|
+
+import org.springframework.data.web.config.EnableSpringDataWebSupport;
|
|
989
|
+
+import org.springframework.data.web.config.PageableHandlerMethodArgumentResolverCustomizer;
|
|
990
|
+
+import org.springframework.data.web.config.SortHandlerMethodArgumentResolverCustomizer;
|
|
991
|
+
+
|
|
992
|
+
+/**
|
|
993
|
+
+ * Neo4j OGM still uses Spring Data Commons 2.4. Boot 3.5's web auto-configuration
|
|
994
|
+
+ * requires Spring Data 3.x types that do not exist in that version. Retain the
|
|
995
|
+
+ * legacy web integration and the existing Boot pagination property contract.
|
|
996
|
+
+ */
|
|
997
|
+
+@Configuration(proxyBeanMethods = false)
|
|
998
|
+
+@EnableSpringDataWebSupport
|
|
999
|
+
+public class LegacySpringDataWebConfig {
|
|
1000
|
+
+
|
|
1001
|
+
+ private static final String PAGEABLE = "spring.data.web.pageable.";
|
|
1002
|
+
+
|
|
1003
|
+
+ @Bean
|
|
1004
|
+
+ PageableHandlerMethodArgumentResolverCustomizer pageableCustomizer(Environment environment) {
|
|
1005
|
+
+ return resolver -> {
|
|
1006
|
+
+ resolver.setPageParameterName(environment.getProperty(PAGEABLE + "page-parameter", "page"));
|
|
1007
|
+
+ resolver.setSizeParameterName(environment.getProperty(PAGEABLE + "size-parameter", "size"));
|
|
1008
|
+
+ resolver.setOneIndexedParameters(environment.getProperty(PAGEABLE + "one-indexed-parameters", Boolean.class, false));
|
|
1009
|
+
+ resolver.setPrefix(environment.getProperty(PAGEABLE + "prefix", ""));
|
|
1010
|
+
+ resolver.setQualifierDelimiter(environment.getProperty(PAGEABLE + "qualifier-delimiter", "_"));
|
|
1011
|
+
+ resolver.setFallbackPageable(PageRequest.of(0,
|
|
1012
|
+
+ environment.getProperty(PAGEABLE + "default-page-size", Integer.class, 20)));
|
|
1013
|
+
+ resolver.setMaxPageSize(environment.getProperty(PAGEABLE + "max-page-size", Integer.class, 2000));
|
|
1014
|
+
+ };
|
|
1015
|
+
+ }
|
|
1016
|
+
+
|
|
1017
|
+
+ @Bean
|
|
1018
|
+
+ SortHandlerMethodArgumentResolverCustomizer sortCustomizer(Environment environment) {
|
|
1019
|
+
+ return resolver -> resolver.setSortParameter(
|
|
1020
|
+
+ environment.getProperty("spring.data.web.sort.sort-parameter", "sort"));
|
|
1021
|
+
+ }
|
|
1022
|
+
+}
|
|
1023
|
+
diff --git a/folib-web-core/src/main/java/com/veadan/folib/config/WebConfig.java b/folib-web-core/src/main/java/com/veadan/folib/config/WebConfig.java
|
|
1024
|
+
index e16873ea1b..86ea15a9ac 100644
|
|
1025
|
+
--- a/folib-web-core/src/main/java/com/veadan/folib/config/WebConfig.java
|
|
1026
|
+
+++ b/folib-web-core/src/main/java/com/veadan/folib/config/WebConfig.java
|
|
1027
|
+
@@ -261,9 +261,8 @@ public class WebConfig
|
|
1028
|
+
.addResourceLocations("classpath:/META-INF/resources/docs/rest/")
|
|
1029
|
+
.setCachePeriod(3600);
|
|
1030
|
+
|
|
1031
|
+
- registry.addResourceHandler("*.html")
|
|
1032
|
+
- .addResourceLocations("classpath:/")
|
|
1033
|
+
- .setCachePeriod(3600);
|
|
1034
|
+
+ // Keep static resources scoped to their dedicated directories. Spring MVC
|
|
1035
|
+
+ // rejects a classpath-root location; Folib's HTML assets live under /ui and /docs.
|
|
1036
|
+
|
|
1037
|
+
String webUrlPrefix = System.getProperty(GlobalConstants.WEB_URL_PREFIX);
|
|
1038
|
+
if (StringUtils.isBlank(webUrlPrefix)) {
|
|
1039
|
+
diff --git a/folib-web-core/src/main/java/com/veadan/folib/model/response/OhpmPublishRes.java b/folib-web-core/src/main/java/com/veadan/folib/model/response/OhpmPublishRes.java
|
|
1040
|
+
index d1758a3321..adc6fc14b1 100644
|
|
1041
|
+
--- a/folib-web-core/src/main/java/com/veadan/folib/model/response/OhpmPublishRes.java
|
|
1042
|
+
+++ b/folib-web-core/src/main/java/com/veadan/folib/model/response/OhpmPublishRes.java
|
|
1043
|
+
@@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel;
|
|
1044
|
+
import lombok.Builder;
|
|
1045
|
+
import lombok.Data;
|
|
1046
|
+
import lombok.experimental.Accessors;
|
|
1047
|
+
-import org.checkerframework.checker.units.qual.A;
|
|
1048
|
+
|
|
1049
|
+
@Data
|
|
1050
|
+
@Builder
|
|
1051
|
+
diff --git a/folib-web-core/src/main/java/com/veadan/folib/promotion/DockerParsePacketsUtil.java b/folib-web-core/src/main/java/com/veadan/folib/promotion/DockerParsePacketsUtil.java
|
|
1052
|
+
index 944f9baad2..4e49c10e31 100644
|
|
1053
|
+
--- a/folib-web-core/src/main/java/com/veadan/folib/promotion/DockerParsePacketsUtil.java
|
|
1054
|
+
+++ b/folib-web-core/src/main/java/com/veadan/folib/promotion/DockerParsePacketsUtil.java
|
|
1055
|
+
@@ -4,7 +4,7 @@ import com.github.junrar.Archive;
|
|
1056
|
+
import com.github.junrar.exception.RarException;
|
|
1057
|
+
import com.github.junrar.rarfile.FileHeader;
|
|
1058
|
+
import com.veadan.folib.utils.CompressionFormatUtils;
|
|
1059
|
+
-import org.apache.commons.compress.archivers.ArchiveEntry;
|
|
1060
|
+
+import com.veadan.folib.util.ArchiveExtractionPaths;
|
|
1061
|
+
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
|
1062
|
+
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
|
|
1063
|
+
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
|
|
1064
|
+
@@ -84,89 +84,51 @@ public class DockerParsePacketsUtil {
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
public static void unzip(String zipFilePath, String destDirectory) throws IOException {
|
|
1068
|
+
- File destDir = new File(destDirectory);
|
|
1069
|
+
- if (!destDir.exists()) {
|
|
1070
|
+
- destDir.mkdir();
|
|
1071
|
+
- }
|
|
1072
|
+
+ Path root = ArchiveExtractionPaths.createRoot(destDirectory);
|
|
1073
|
+
try (ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath))) {
|
|
1074
|
+
- ZipEntry entry = zipIn.getNextEntry();
|
|
1075
|
+
- // Iterates over entries in the ZIP file
|
|
1076
|
+
- while (entry != null) {
|
|
1077
|
+
- String filePath = destDirectory + File.separator + entry.getName();
|
|
1078
|
+
- if (!entry.isDirectory()) {
|
|
1079
|
+
- // If the entry is a file, extracts it
|
|
1080
|
+
- extractFile(zipIn, filePath);
|
|
1081
|
+
+ ZipEntry entry;
|
|
1082
|
+
+ while ((entry = zipIn.getNextEntry()) != null) {
|
|
1083
|
+
+ if (entry.isDirectory()) {
|
|
1084
|
+
+ ArchiveExtractionPaths.directory(root, entry.getName());
|
|
1085
|
+
} else {
|
|
1086
|
+
- // If the entry is a directory, make the directory
|
|
1087
|
+
- File dir = new File(filePath);
|
|
1088
|
+
- dir.mkdirs();
|
|
1089
|
+
+ try (OutputStream out = new BufferedOutputStream(
|
|
1090
|
+
+ ArchiveExtractionPaths.openFile(root, entry.getName()))) {
|
|
1091
|
+
+ IOUtils.copy(zipIn, out);
|
|
1092
|
+
+ }
|
|
1093
|
+
}
|
|
1094
|
+
zipIn.closeEntry();
|
|
1095
|
+
- entry = zipIn.getNextEntry();
|
|
1096
|
+
- }
|
|
1097
|
+
- }
|
|
1098
|
+
- }
|
|
1099
|
+
-
|
|
1100
|
+
- private static void extractFile(ZipInputStream zipIn, String filePath) throws IOException {
|
|
1101
|
+
- try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath))) {
|
|
1102
|
+
- byte[] bytesIn = new byte[4096];
|
|
1103
|
+
- int read = 0;
|
|
1104
|
+
- while ((read = zipIn.read(bytesIn)) != -1) {
|
|
1105
|
+
- bos.write(bytesIn, 0, read);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
public static void decompressGzipFile(String gzipFilePath, String destDirectory) throws IOException {
|
|
1111
|
+
-
|
|
1112
|
+
- Path destDirPath = Paths.get(destDirectory);
|
|
1113
|
+
- if (Files.isDirectory(destDirPath)) {
|
|
1114
|
+
- String fileNameWithoutExtension = getFileNameWithoutExtension(gzipFilePath);
|
|
1115
|
+
- Path destFilePath = destDirPath.resolve(fileNameWithoutExtension);
|
|
1116
|
+
- try (GZIPInputStream gzipIn = new GZIPInputStream(new FileInputStream(gzipFilePath));
|
|
1117
|
+
- FileOutputStream fileOut = new FileOutputStream(destFilePath.toFile());
|
|
1118
|
+
- BufferedOutputStream bos = new BufferedOutputStream(fileOut)) {
|
|
1119
|
+
- byte[] buffer = new byte[4096];
|
|
1120
|
+
- int bytesRead;
|
|
1121
|
+
- while ((bytesRead = gzipIn.read(buffer)) != -1) {
|
|
1122
|
+
- bos.write(buffer, 0, bytesRead);
|
|
1123
|
+
- }
|
|
1124
|
+
- }
|
|
1125
|
+
- } else {
|
|
1126
|
+
+ if (!Files.isDirectory(Paths.get(destDirectory))) {
|
|
1127
|
+
throw new IOException("The destination path is not a directory: " + destDirectory);
|
|
1128
|
+
}
|
|
1129
|
+
+ Path root = ArchiveExtractionPaths.createRoot(destDirectory);
|
|
1130
|
+
+ try (GZIPInputStream gzipIn = new GZIPInputStream(new FileInputStream(gzipFilePath));
|
|
1131
|
+
+ OutputStream out = new BufferedOutputStream(
|
|
1132
|
+
+ ArchiveExtractionPaths.openFile(root, getFileNameWithoutExtension(gzipFilePath)))) {
|
|
1133
|
+
+ IOUtils.copy(gzipIn, out);
|
|
1134
|
+
+ }
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
-
|
|
1138
|
+
public static void decompressTarGzFile(String tarGzFilePath, String destDirectory) throws IOException {
|
|
1139
|
+
- File destDir = new File(destDirectory);
|
|
1140
|
+
- if (!destDir.exists()) {
|
|
1141
|
+
- destDir.mkdirs();
|
|
1142
|
+
- }
|
|
1143
|
+
-
|
|
1144
|
+
+ Path root = ArchiveExtractionPaths.createRoot(destDirectory);
|
|
1145
|
+
try (FileInputStream fis = new FileInputStream(tarGzFilePath);
|
|
1146
|
+
GzipCompressorInputStream gzipIn = new GzipCompressorInputStream(fis);
|
|
1147
|
+
TarArchiveInputStream tarIn = new TarArchiveInputStream(gzipIn)) {
|
|
1148
|
+
-
|
|
1149
|
+
- ArchiveEntry entry;
|
|
1150
|
+
+ TarArchiveEntry entry;
|
|
1151
|
+
while ((entry = tarIn.getNextEntry()) != null) {
|
|
1152
|
+
+ if (entry.isSymbolicLink() || entry.isLink() || (!entry.isFile() && !entry.isDirectory())) {
|
|
1153
|
+
+ throw new IOException("Unsupported TAR entry type");
|
|
1154
|
+
+ }
|
|
1155
|
+
if (entry.isDirectory()) {
|
|
1156
|
+
- File dir = new File(destDir, entry.getName());
|
|
1157
|
+
- if (!dir.exists()) {
|
|
1158
|
+
- dir.mkdirs();
|
|
1159
|
+
- }
|
|
1160
|
+
+ ArchiveExtractionPaths.directory(root, entry.getName());
|
|
1161
|
+
} else {
|
|
1162
|
+
- File outFile = new File(destDir, entry.getName());
|
|
1163
|
+
- File parentDir = outFile.getParentFile();
|
|
1164
|
+
- if (!parentDir.exists()) {
|
|
1165
|
+
- parentDir.mkdirs();
|
|
1166
|
+
- }
|
|
1167
|
+
- try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(outFile))) {
|
|
1168
|
+
- byte[] buffer = new byte[4096];
|
|
1169
|
+
- int bytesRead;
|
|
1170
|
+
- while ((bytesRead = tarIn.read(buffer)) != -1) {
|
|
1171
|
+
- bos.write(buffer, 0, bytesRead);
|
|
1172
|
+
- }
|
|
1173
|
+
+ try (OutputStream out = new BufferedOutputStream(
|
|
1174
|
+
+ ArchiveExtractionPaths.openFile(root, entry.getName()))) {
|
|
1175
|
+
+ IOUtils.copy(tarIn, out);
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
@@ -214,38 +176,27 @@ public class DockerParsePacketsUtil {
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+
public static void extractRar(String rarFilePath, String destDirectory) throws IOException {
|
|
1183
|
+
- File destDir = new File(destDirectory);
|
|
1184
|
+
- if (!destDir.exists()) {
|
|
1185
|
+
- destDir.mkdirs();
|
|
1186
|
+
- }
|
|
1187
|
+
-
|
|
1188
|
+
+ Path root = ArchiveExtractionPaths.createRoot(destDirectory);
|
|
1189
|
+
try (Archive archive = new Archive(new File(rarFilePath))) {
|
|
1190
|
+
+ extractRarEntries(archive, root);
|
|
1191
|
+
+ } catch (RarException e) {
|
|
1192
|
+
+ throw new IOException("Docker upload error extracting RAR file", e);
|
|
1193
|
+
+ }
|
|
1194
|
+
+ }
|
|
1195
|
+
|
|
1196
|
+
- FileHeader fileHeader;
|
|
1197
|
+
- while ((fileHeader = archive.nextFileHeader()) != null) {
|
|
1198
|
+
- if (!fileHeader.isDirectory()) {
|
|
1199
|
+
- File outFile = new File(destDir, fileHeader.getFileName());
|
|
1200
|
+
- File parentDir = outFile.getParentFile();
|
|
1201
|
+
- if (!parentDir.exists()) {
|
|
1202
|
+
- parentDir.mkdirs();
|
|
1203
|
+
- }
|
|
1204
|
+
-
|
|
1205
|
+
- try (OutputStream os = new FileOutputStream(outFile)) {
|
|
1206
|
+
- archive.extractFile(fileHeader, os);
|
|
1207
|
+
- } catch (RarException e) {
|
|
1208
|
+
- logger.error("docker upload Error extracting RAR file: {}", e.getMessage());
|
|
1209
|
+
- throw new RuntimeException(e);
|
|
1210
|
+
- }
|
|
1211
|
+
- } else {
|
|
1212
|
+
- File dir = new File(destDir, fileHeader.getFileName());
|
|
1213
|
+
- if (!dir.exists()) {
|
|
1214
|
+
- dir.mkdirs();
|
|
1215
|
+
- }
|
|
1216
|
+
+ static void extractRarEntries(Archive archive, Path root) throws IOException, RarException {
|
|
1217
|
+
+ FileHeader fileHeader;
|
|
1218
|
+
+ while ((fileHeader = archive.nextFileHeader()) != null) {
|
|
1219
|
+
+ if (fileHeader.getRedirection() != null) {
|
|
1220
|
+
+ throw new IOException("RAR link entries are not supported");
|
|
1221
|
+
+ }
|
|
1222
|
+
+ if (fileHeader.isDirectory()) {
|
|
1223
|
+
+ ArchiveExtractionPaths.directory(root, fileHeader.getFileName());
|
|
1224
|
+
+ } else {
|
|
1225
|
+
+ try (OutputStream out = ArchiveExtractionPaths.openFile(root, fileHeader.getFileName())) {
|
|
1226
|
+
+ archive.extractFile(fileHeader, out);
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
- } catch (RarException e) {
|
|
1230
|
+
- logger.error("docker upload Error extracting RAR file: {}", e.getMessage());
|
|
1231
|
+
- throw new RuntimeException(e);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
diff --git a/folib-web-core/src/test/java/com/veadan/folib/config/LegacySpringDataWebConfigTest.java b/folib-web-core/src/test/java/com/veadan/folib/config/LegacySpringDataWebConfigTest.java
|
|
1236
|
+
new file mode 100644
|
|
1237
|
+
index 0000000000..c03f6acf0d
|
|
1238
|
+
--- /dev/null
|
|
1239
|
+
+++ b/folib-web-core/src/test/java/com/veadan/folib/config/LegacySpringDataWebConfigTest.java
|
|
1240
|
+
@@ -0,0 +1,75 @@
|
|
1241
|
+
+package com.veadan.folib.config;
|
|
1242
|
+
+
|
|
1243
|
+
+import org.junit.jupiter.api.Test;
|
|
1244
|
+
+import org.springframework.context.annotation.Bean;
|
|
1245
|
+
+import org.springframework.context.annotation.Configuration;
|
|
1246
|
+
+import org.springframework.data.domain.Pageable;
|
|
1247
|
+
+import org.springframework.mock.web.MockServletContext;
|
|
1248
|
+
+import org.springframework.test.context.support.TestPropertySourceUtils;
|
|
1249
|
+
+import org.springframework.test.web.servlet.MockMvc;
|
|
1250
|
+
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
|
1251
|
+
+import org.springframework.web.bind.annotation.GetMapping;
|
|
1252
|
+
+import org.springframework.web.bind.annotation.RestController;
|
|
1253
|
+
+import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
|
|
1254
|
+
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|
1255
|
+
+
|
|
1256
|
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
|
1257
|
+
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
|
1258
|
+
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
|
1259
|
+
+
|
|
1260
|
+
+class LegacySpringDataWebConfigTest {
|
|
1261
|
+
+
|
|
1262
|
+
+ @Test
|
|
1263
|
+
+ void preservesDefaultPaginationAndSorting() throws Exception {
|
|
1264
|
+
+ try (AnnotationConfigWebApplicationContext context = context()) {
|
|
1265
|
+
+ MockMvc mvc = MockMvcBuilders.webAppContextSetup(context).build();
|
|
1266
|
+
+ mvc.perform(get("/pagination"))
|
|
1267
|
+
+ .andExpect(status().isOk()).andExpect(content().string("0:20:UNSORTED"));
|
|
1268
|
+
+ mvc.perform(get("/pagination").param("page", "2").param("size", "9999").param("sort", "name,desc"))
|
|
1269
|
+
+ .andExpect(status().isOk()).andExpect(content().string("2:2000:name: DESC"));
|
|
1270
|
+
+ }
|
|
1271
|
+
+ }
|
|
1272
|
+
+
|
|
1273
|
+
+ @Test
|
|
1274
|
+
+ void honorsConfiguredParametersAndBounds() throws Exception {
|
|
1275
|
+
+ try (AnnotationConfigWebApplicationContext context = context(
|
|
1276
|
+
+ "spring.data.web.pageable.page-parameter=p",
|
|
1277
|
+
+ "spring.data.web.pageable.size-parameter=n",
|
|
1278
|
+
+ "spring.data.web.pageable.one-indexed-parameters=true",
|
|
1279
|
+
+ "spring.data.web.pageable.default-page-size=15",
|
|
1280
|
+
+ "spring.data.web.pageable.max-page-size=50",
|
|
1281
|
+
+ "spring.data.web.sort.sort-parameter=order")) {
|
|
1282
|
+
+ MockMvc mvc = MockMvcBuilders.webAppContextSetup(context).build();
|
|
1283
|
+
+ mvc.perform(get("/pagination"))
|
|
1284
|
+
+ .andExpect(status().isOk()).andExpect(content().string("0:15:UNSORTED"));
|
|
1285
|
+
+ mvc.perform(get("/pagination").param("p", "3").param("n", "100").param("order", "name,asc"))
|
|
1286
|
+
+ .andExpect(status().isOk()).andExpect(content().string("2:50:name: ASC"));
|
|
1287
|
+
+ }
|
|
1288
|
+
+ }
|
|
1289
|
+
+
|
|
1290
|
+
+ private AnnotationConfigWebApplicationContext context(String... properties) {
|
|
1291
|
+
+ AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
|
|
1292
|
+
+ context.setServletContext(new MockServletContext());
|
|
1293
|
+
+ TestPropertySourceUtils.addInlinedPropertiesToEnvironment(context, properties);
|
|
1294
|
+
+ context.register(MvcConfig.class, LegacySpringDataWebConfig.class);
|
|
1295
|
+
+ context.refresh();
|
|
1296
|
+
+ return context;
|
|
1297
|
+
+ }
|
|
1298
|
+
+
|
|
1299
|
+
+ @Configuration
|
|
1300
|
+
+ @EnableWebMvc
|
|
1301
|
+
+ static class MvcConfig {
|
|
1302
|
+
+ @Bean
|
|
1303
|
+
+ PagingController pagingController() {
|
|
1304
|
+
+ return new PagingController();
|
|
1305
|
+
+ }
|
|
1306
|
+
+ }
|
|
1307
|
+
+
|
|
1308
|
+
+ @RestController
|
|
1309
|
+
+ static class PagingController {
|
|
1310
|
+
+ @GetMapping("/pagination")
|
|
1311
|
+
+ String page(Pageable pageable) {
|
|
1312
|
+
+ return pageable.getPageNumber() + ":" + pageable.getPageSize() + ":" + pageable.getSort();
|
|
1313
|
+
+ }
|
|
1314
|
+
+ }
|
|
1315
|
+
+}
|
|
1316
|
+
diff --git a/folib-web-core/src/test/java/com/veadan/folib/config/WebConfigResourceHandlersTest.java b/folib-web-core/src/test/java/com/veadan/folib/config/WebConfigResourceHandlersTest.java
|
|
1317
|
+
new file mode 100644
|
|
1318
|
+
index 0000000000..2aa51d6eed
|
|
1319
|
+
--- /dev/null
|
|
1320
|
+
+++ b/folib-web-core/src/test/java/com/veadan/folib/config/WebConfigResourceHandlersTest.java
|
|
1321
|
+
@@ -0,0 +1,31 @@
|
|
1322
|
+
+package com.veadan.folib.config;
|
|
1323
|
+
+
|
|
1324
|
+
+import org.junit.jupiter.api.Test;
|
|
1325
|
+
+import org.springframework.mock.web.MockServletContext;
|
|
1326
|
+
+import org.springframework.test.util.ReflectionTestUtils;
|
|
1327
|
+
+import org.springframework.web.context.support.StaticWebApplicationContext;
|
|
1328
|
+
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
1329
|
+
+import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
|
|
1330
|
+
+
|
|
1331
|
+
+import static org.junit.jupiter.api.Assertions.*;
|
|
1332
|
+
+
|
|
1333
|
+
+class WebConfigResourceHandlersTest {
|
|
1334
|
+
+
|
|
1335
|
+
+ @Test
|
|
1336
|
+
+ void initializesDedicatedResourceHandlersWithoutClasspathRoot() {
|
|
1337
|
+
+ MockServletContext servletContext = new MockServletContext();
|
|
1338
|
+
+ try (StaticWebApplicationContext context = new StaticWebApplicationContext()) {
|
|
1339
|
+
+ context.setServletContext(servletContext);
|
|
1340
|
+
+ context.refresh();
|
|
1341
|
+
+ ResourceHandlerRegistry registry = new ResourceHandlerRegistry(context, servletContext);
|
|
1342
|
+
+ new WebConfig().addResourceHandlers(registry);
|
|
1343
|
+
+
|
|
1344
|
+
+ SimpleUrlHandlerMapping mapping = ReflectionTestUtils.invokeMethod(registry, "getHandlerMapping");
|
|
1345
|
+
+ assertNotNull(mapping);
|
|
1346
|
+
+ assertTrue(mapping.getUrlMap().containsKey("/rest/**"));
|
|
1347
|
+
+ assertTrue(mapping.getUrlMap().containsKey("/help/**"));
|
|
1348
|
+
+ assertTrue(mapping.getUrlMap().containsKey("/webjars/**"));
|
|
1349
|
+
+ assertFalse(mapping.getUrlMap().containsKey("*.html"));
|
|
1350
|
+
+ }
|
|
1351
|
+
+ }
|
|
1352
|
+
+}
|
|
1353
|
+
diff --git a/folib-web-core/src/test/java/com/veadan/folib/promotion/DockerArchiveExtractionTest.java b/folib-web-core/src/test/java/com/veadan/folib/promotion/DockerArchiveExtractionTest.java
|
|
1354
|
+
new file mode 100644
|
|
1355
|
+
index 0000000000..08f3aab706
|
|
1356
|
+
--- /dev/null
|
|
1357
|
+
+++ b/folib-web-core/src/test/java/com/veadan/folib/promotion/DockerArchiveExtractionTest.java
|
|
1358
|
+
@@ -0,0 +1,112 @@
|
|
1359
|
+
+package com.veadan.folib.promotion;
|
|
1360
|
+
+
|
|
1361
|
+
+import com.github.junrar.Archive;
|
|
1362
|
+
+import com.github.junrar.rarfile.FileHeader;
|
|
1363
|
+
+import com.veadan.folib.util.ArchiveExtractionPaths;
|
|
1364
|
+
+import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
|
|
1365
|
+
+import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
|
|
1366
|
+
+import org.junit.jupiter.api.Test;
|
|
1367
|
+
+import org.junit.jupiter.api.io.TempDir;
|
|
1368
|
+
+
|
|
1369
|
+
+import java.io.IOException;
|
|
1370
|
+
+import java.io.OutputStream;
|
|
1371
|
+
+import java.nio.charset.StandardCharsets;
|
|
1372
|
+
+import java.nio.file.Files;
|
|
1373
|
+
+import java.nio.file.Path;
|
|
1374
|
+
+import java.util.zip.GZIPOutputStream;
|
|
1375
|
+
+import java.util.zip.ZipEntry;
|
|
1376
|
+
+import java.util.zip.ZipOutputStream;
|
|
1377
|
+
+
|
|
1378
|
+
+import static org.junit.jupiter.api.Assertions.*;
|
|
1379
|
+
+import static org.mockito.ArgumentMatchers.*;
|
|
1380
|
+
+import static org.mockito.Mockito.*;
|
|
1381
|
+
+
|
|
1382
|
+
+class DockerArchiveExtractionTest {
|
|
1383
|
+
+
|
|
1384
|
+
+ @TempDir
|
|
1385
|
+
+ Path temp;
|
|
1386
|
+
+
|
|
1387
|
+
+ @Test
|
|
1388
|
+
+ void zipNestedFileWithoutDirectoryEntryExtracts() throws Exception {
|
|
1389
|
+
+ Path zip = zip("folder/inner.txt");
|
|
1390
|
+
+ Path root = temp.resolve("output");
|
|
1391
|
+
+ DockerParsePacketsUtil.unzip(zip.toString(), root.toString());
|
|
1392
|
+
+ assertEquals("content", Files.readString(root.resolve("folder/inner.txt")));
|
|
1393
|
+
+ }
|
|
1394
|
+
+
|
|
1395
|
+
+ @Test
|
|
1396
|
+
+ void dockerZipRejectsOutsideEntry() throws Exception {
|
|
1397
|
+
+ Path zip = zip("../outside.txt");
|
|
1398
|
+
+ assertThrows(IOException.class, () -> DockerParsePacketsUtil.unzip(zip.toString(), temp.resolve("output").toString()));
|
|
1399
|
+
+ assertFalse(Files.exists(temp.resolve("outside.txt")));
|
|
1400
|
+
+ }
|
|
1401
|
+
+
|
|
1402
|
+
+ @Test
|
|
1403
|
+
+ void tarGzNestedFileExtracts() throws Exception {
|
|
1404
|
+
+ Path tar = tar("folder/inner.txt");
|
|
1405
|
+
+ Path root = temp.resolve("output");
|
|
1406
|
+
+ DockerParsePacketsUtil.decompressTarGzFile(tar.toString(), root.toString());
|
|
1407
|
+
+ assertEquals("content", Files.readString(root.resolve("folder/inner.txt")));
|
|
1408
|
+
+ }
|
|
1409
|
+
+
|
|
1410
|
+
+ @Test
|
|
1411
|
+
+ void tarGzRejectsOutsideEntry() throws Exception {
|
|
1412
|
+
+ Path tar = tar("../outside.txt");
|
|
1413
|
+
+ assertThrows(IOException.class, () -> DockerParsePacketsUtil.decompressTarGzFile(tar.toString(), temp.resolve("output").toString()));
|
|
1414
|
+
+ assertFalse(Files.exists(temp.resolve("outside.txt")));
|
|
1415
|
+
+ }
|
|
1416
|
+
+
|
|
1417
|
+
+ @Test
|
|
1418
|
+
+ void rarEntryIsCheckedBeforeExtractingContents() throws Exception {
|
|
1419
|
+
+ Path root = ArchiveExtractionPaths.createRoot(temp.resolve("output").toString());
|
|
1420
|
+
+ Archive archive = mock(Archive.class);
|
|
1421
|
+
+ FileHeader header = mock(FileHeader.class);
|
|
1422
|
+
+ when(archive.nextFileHeader()).thenReturn(header, (FileHeader) null);
|
|
1423
|
+
+ when(header.getFileName()).thenReturn("..\\outside.txt");
|
|
1424
|
+
+
|
|
1425
|
+
+ assertThrows(IOException.class, () -> DockerParsePacketsUtil.extractRarEntries(archive, root));
|
|
1426
|
+
+ verify(archive, never()).extractFile(any(FileHeader.class), any(OutputStream.class));
|
|
1427
|
+
+ assertFalse(Files.exists(temp.resolve("outside.txt")));
|
|
1428
|
+
+ }
|
|
1429
|
+
+
|
|
1430
|
+
+ @Test
|
|
1431
|
+
+ void rarNormalEntryWritesExpectedContents() throws Exception {
|
|
1432
|
+
+ Path root = ArchiveExtractionPaths.createRoot(temp.resolve("output").toString());
|
|
1433
|
+
+ Archive archive = mock(Archive.class);
|
|
1434
|
+
+ FileHeader header = mock(FileHeader.class);
|
|
1435
|
+
+ when(archive.nextFileHeader()).thenReturn(header, (FileHeader) null);
|
|
1436
|
+
+ when(header.getFileName()).thenReturn("folder\\inner.txt");
|
|
1437
|
+
+ doAnswer(invocation -> {
|
|
1438
|
+
+ OutputStream out = invocation.getArgument(1);
|
|
1439
|
+
+ out.write("content".getBytes(StandardCharsets.UTF_8));
|
|
1440
|
+
+ return null;
|
|
1441
|
+
+ }).when(archive).extractFile(eq(header), any(OutputStream.class));
|
|
1442
|
+
+
|
|
1443
|
+
+ DockerParsePacketsUtil.extractRarEntries(archive, root);
|
|
1444
|
+
+ assertEquals("content", Files.readString(root.resolve("folder/inner.txt")));
|
|
1445
|
+
+ }
|
|
1446
|
+
+
|
|
1447
|
+
+ private Path zip(String name) throws IOException {
|
|
1448
|
+
+ Path archive = temp.resolve("test.zip");
|
|
1449
|
+
+ try (ZipOutputStream out = new ZipOutputStream(Files.newOutputStream(archive))) {
|
|
1450
|
+
+ out.putNextEntry(new ZipEntry(name));
|
|
1451
|
+
+ out.write("content".getBytes(StandardCharsets.UTF_8));
|
|
1452
|
+
+ out.closeEntry();
|
|
1453
|
+
+ }
|
|
1454
|
+
+ return archive;
|
|
1455
|
+
+ }
|
|
1456
|
+
+
|
|
1457
|
+
+ private Path tar(String name) throws IOException {
|
|
1458
|
+
+ Path archive = temp.resolve("test.tar.gz");
|
|
1459
|
+
+ byte[] bytes = "content".getBytes(StandardCharsets.UTF_8);
|
|
1460
|
+
+ try (TarArchiveOutputStream out = new TarArchiveOutputStream(
|
|
1461
|
+
+ new GZIPOutputStream(Files.newOutputStream(archive)))) {
|
|
1462
|
+
+ TarArchiveEntry entry = new TarArchiveEntry(name);
|
|
1463
|
+
+ entry.setSize(bytes.length);
|
|
1464
|
+
+ out.putArchiveEntry(entry);
|
|
1465
|
+
+ out.write(bytes);
|
|
1466
|
+
+ out.closeArchiveEntry();
|
|
1467
|
+
+ }
|
|
1468
|
+
+ return archive;
|
|
1469
|
+
+ }
|
|
1470
|
+
+}
|
|
1471
|
+
diff --git a/folib-web-core/src/test/java/com/veadan/folib/utils/DependencyCompatibilityTest.java b/folib-web-core/src/test/java/com/veadan/folib/utils/DependencyCompatibilityTest.java
|
|
1472
|
+
new file mode 100644
|
|
1473
|
+
index 0000000000..95d94e6f52
|
|
1474
|
+
--- /dev/null
|
|
1475
|
+
+++ b/folib-web-core/src/test/java/com/veadan/folib/utils/DependencyCompatibilityTest.java
|
|
1476
|
+
@@ -0,0 +1,62 @@
|
|
1477
|
+
+package com.veadan.folib.utils;
|
|
1478
|
+
+
|
|
1479
|
+
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
1480
|
+
+import com.github.junrar.Archive;
|
|
1481
|
+
+import com.veadan.folib.indexer.PypiIndexReader;
|
|
1482
|
+
+import groovy.lang.GroovyClassLoader;
|
|
1483
|
+
+import groovy.lang.GroovyCodeSource;
|
|
1484
|
+
+import groovy.lang.GroovySystem;
|
|
1485
|
+
+import org.apache.tika.Tika;
|
|
1486
|
+
+import org.jfrog.artifactory.client.ArtifactoryClientBuilder;
|
|
1487
|
+
+import org.junit.jupiter.api.Test;
|
|
1488
|
+
+
|
|
1489
|
+
+import java.io.ByteArrayInputStream;
|
|
1490
|
+
+import java.nio.charset.StandardCharsets;
|
|
1491
|
+
+import java.util.Collections;
|
|
1492
|
+
+import java.util.Map;
|
|
1493
|
+
+
|
|
1494
|
+
+import static org.junit.jupiter.api.Assertions.*;
|
|
1495
|
+
+
|
|
1496
|
+
+class DependencyCompatibilityTest {
|
|
1497
|
+
+
|
|
1498
|
+
+ @Test
|
|
1499
|
+
+ void groovyCronScriptCompilesAndExecutesWithOneRuntime() throws Exception {
|
|
1500
|
+
+ assertEquals(1, Collections.list(GroovySystem.class.getClassLoader()
|
|
1501
|
+
+ .getResources("groovy/lang/GroovySystem.class")).size());
|
|
1502
|
+
+ assertTrue(GroovySystem.getVersion().startsWith("4."));
|
|
1503
|
+
+ try (GroovyClassLoader loader = new GroovyClassLoader()) {
|
|
1504
|
+
+ Class<?> script = loader.parseClass(new GroovyCodeSource(
|
|
1505
|
+
+ "class CompatibilityJob { def execute() { 6 * 7 } }",
|
|
1506
|
+
+ "CompatibilityJob.groovy", "/groovy/compatibility"));
|
|
1507
|
+
+ assertEquals(42, script.getDeclaredMethod("execute")
|
|
1508
|
+
+ .invoke(script.getConstructor().newInstance()));
|
|
1509
|
+
+ }
|
|
1510
|
+
+ }
|
|
1511
|
+
+
|
|
1512
|
+
+ @Test
|
|
1513
|
+
+ void jfrogClientCanBeConstructedWithoutLegacyGroovy() {
|
|
1514
|
+
+ assertNotNull(ArtifactoryClientBuilder.create()
|
|
1515
|
+
+ .setUrl("http://127.0.0.1:1/artifactory")
|
|
1516
|
+
+ .setUsername("test").setPassword("test").build());
|
|
1517
|
+
+ }
|
|
1518
|
+
+
|
|
1519
|
+
+ @Test
|
|
1520
|
+
+ void jsoupParsesRealPypiIndex() throws Exception {
|
|
1521
|
+
+ String index = "<html><body><a href='demo-1.0.whl'>demo-1.0.whl</a></body></html>";
|
|
1522
|
+
+ assertEquals(1, PypiIndexReader.read(new ByteArrayInputStream(
|
|
1523
|
+
+ index.getBytes(StandardCharsets.UTF_8))).getEntries().size());
|
|
1524
|
+
+ }
|
|
1525
|
+
+
|
|
1526
|
+
+ @Test
|
|
1527
|
+
+ void tikaDetectsMimeType() {
|
|
1528
|
+
+ assertEquals("application/pdf", new Tika().detect(
|
|
1529
|
+
+ "%PDF-1.7\n".getBytes(StandardCharsets.US_ASCII)));
|
|
1530
|
+
+ }
|
|
1531
|
+
+
|
|
1532
|
+
+ @Test
|
|
1533
|
+
+ void jacksonReadsJsonAndJunrarLoads() throws Exception {
|
|
1534
|
+
+ ObjectMapper mapper = new ObjectMapper();
|
|
1535
|
+
+ assertEquals(Map.of("name", "demo"), mapper.readValue("{\"name\":\"demo\"}", Map.class));
|
|
1536
|
+
+ assertNotNull(Archive.class.getConstructor(java.io.InputStream.class));
|
|
1537
|
+
+ }
|
|
1538
|
+
+}
|