fix: 修复安全漏洞与功能缺陷,测试迁移至 JUnit 5

- compress: 修复 Zip-Slip 路径穿越(UnZip/UnTarGz 校验条目路径并拒绝链接条目)
- encrypt: AES 升级为 AES-256/GCM,RSA 改为真实混合加密,流式处理大文件,
  临时文件+原子替换避免损坏原文,密钥文件限制为属主可读写,DES 标记废弃
- random: 修复上界 Integer.MAX_VALUE 溢出,randomString 参数校验
- echo: ColorPrintlnPlus 格式码叠加(颜色+加粗等),颜色码输入校验防终端注入
- hwid: ProcessBuilder+超时+并发排空输出流,Windows 改用 PowerShell CIM(wmic 回退),
  修正 Linux 磁盘序列号命令,MAC 优先物理网卡,哈希失败不再回退 hashCode
- runtime: getJarPath 经 URI 解析(处理空格/编码),临时目录改用 Files.createTempDirectory
- file: CreateFile 移除死代码与假异步;CompressPNG 临时文件+原子替换,阈值空校验
- build: pom 补元数据/插件版本/manifest 版本注入,version 与 pom 对齐并读取 Implementation-Version
- test: 全部测试迁移为 JUnit 5(53 个用例),删除 System.exit 式手写测试与 10 亿次循环测试
- chore: 删除 cp.txt 并加入 .gitignore
This commit is contained in:
database-mysql committed 2026-10-18 16:30:47 +08:00
1 parent bf3b92d206
commit cfea5ed26b
30 files changed
+1552 -1863

No files matched your search

+43 -4
View File
@@ -7,11 +7,25 @@
<groupId>top.gtb520.java.gnu</groupId>
<artifactId>gnu_java_utils_library</artifactId>
<version>1.6-SNAPSHOT</version>
<packaging>jar</packaging>
<name>GNU Java Utils Library</name>
<description>轻量级 Java 工具库:压缩/解压、终端彩色输出、文件创建与管理、文件加密/解密、随机数生成、硬件标识与运行时信息。</description>
<url>https://github.com/databasemysql233-debug/gnu_java_utils_library</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<maven.compiler.source>25</maven.compiler.source>
<maven.compiler.target>25</maven.compiler.target>
<maven.compiler.release>25</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.13.0</junit.version>
<surefire.version>3.6.0</surefire.version>
</properties>
<dependencies>
@@ -23,9 +37,34 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.13.0</version>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Automatic-Module-Name>top.gtb520.java.gnu.utils.library</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>