Files
eip4-platform/platform-report/pom.xml
zhengwr ffb2f042d0 报表保真层安全/OOM收口(platform-report):SQLi门/IDOR授权/XXE/并发字节超时
审计揪出真问题(jatools引擎预编译不可改,全在包装层收口):
- SQL注入(Critical):${PARAM}经evalTemplate字符串拼接进SQL后prepareStatement执行(无占位符绑定)
- IDOR:render/frame对templateId无对象级授权,任意已认证用户可渲染任意报表
- XXE:报表XML经裸DocumentBuilderFactory解析(外部实体/SSRF/OOB)
- ?tpl任意本地文件读+路径穿越;RBAC旁路(固定DB账号);OOM链(结果集全量物化+无并发闸+无超时+产物多副本)

实现:
- ReportParamGuard:模板${name}引用白名单 + isSafeValue字符白名单(拒空格挡无引号注入/拒--/::) +
  身份数据域保留集{CURRENTUSER,CURRENTDEPART,CURRENTORG,USERID,DEPARTID,ORGID}剥客户端+服务端注入可信值
- ReportXmlGuard.hasDoctypeInBytes:字节级拒DOCTYPE(防BOM/UTF-16编码绕过)
- ReportTplGuard + profile守卫:?tpl限定templates-dir内、仅.xml、仅旁路profile
- ReportController.enforceReportAccess:菜单授权对象级鉴权(超管bypass/匿名跳过/认证态无身份fail-closed)
- RenderConcurrencyLimiter(429)/LimitedByteArrayOutputStream(413)/JatoolsConfig注入statement_timeout+socketTimeout
- 错误响应改通用文案(细节仅落日志)

验证:69单测全绿(TDD);真库live e2e全绿(数值注入=400/IDOR=403/合法render+PDF=200/forged USERID剥离);
对象授权SQL逐对实证;独立security-reviewer对抗复审揪修2真漏(无引号数值注入绕黑名单、身份注入护错变量名)。

残留(非本层可修):凭据外泄(模板${property("DBPassword")}同解析路径,需模板创作授权+DB只读账号);
结果集全量物化OOM根因在引擎;预编译jar高危CVE(log4j1.2.8/commons-collections3.0/bsh)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 07:51:54 +08:00

110 lines
6.2 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.eip4</groupId>
<artifactId>eip4-platform</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>platform-report</artifactId>
<name>platform-report</name>
<description>EIP3 JOR (jatools) 报表引擎重宿主:用预编译成品 jar headless 渲染 JOR 套打模板为 HTML/PDF/XLS</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>21</maven.compiler.release>
</properties>
<!-- 预编译报表引擎 jar 装入项目内本地仓(local-repo/,随码提交)。
坐标 com.dsasp.thirdparty:*:eip3,由 install-libs.sh 用 mvn install:install-file 生成。
不用 system scope —— system scope 不会被 spring-boot-maven-plugin 打进 fat jar。 -->
<repositories>
<repository>
<id>eip3-local</id>
<url>file://${project.basedir}/local-repo</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<!-- ===== JOR(jatools) 报表引擎预编译成品 ===== -->
<!-- 引擎本体 -->
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>jatools</artifactId><version>eip3</version></dependency>
<!-- jatools 改造版 BeanShell(公式求值核心,含 8 个自定义类):必须用这份 fork,非 stock bsh -->
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>bsh</artifactId><version>eip3</version></dependency>
<!-- PDF 导出 -->
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>itext</artifactId><version>eip3</version></dependency>
<!-- XLS 导出 -->
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>jxl</artifactId><version>eip3</version></dependency>
<!-- 报表 SQL 解析 -->
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>jsqlparser</artifactId><version>eip3</version></dependency>
<!-- 图表(B 类报表,jfreechart + jcommon + jatools chart 封装) -->
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>jfreechart</artifactId><version>eip3</version></dependency>
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>jcommon</artifactId><version>eip3</version></dependency>
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>jchart</artifactId><version>eip3</version></dependency>
<!-- 条码 / 二维码 -->
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>barcode4j</artifactId><version>eip3</version></dependency>
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>zxing</artifactId><version>eip3</version></dependency>
<!-- 引擎运行期依赖的旧版 commons / log4j1 / jaxen / xerces。给独立坐标避免与平台托管版本误判去重。 -->
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>commons-beanutils</artifactId><version>eip3</version></dependency>
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>commons-collections</artifactId><version>eip3</version></dependency>
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>commons-httpclient</artifactId><version>eip3</version></dependency>
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>commons-lang</artifactId><version>eip3</version></dependency>
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>commons-logging</artifactId><version>eip3</version></dependency>
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>log4j</artifactId><version>eip3</version></dependency>
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>jaxen</artifactId><version>eip3</version></dependency>
<dependency><groupId>com.dsasp.thirdparty</groupId><artifactId>xerces</artifactId><version>eip3</version></dependency>
<!-- ===== Spring(控制器 / 注入 DataSource 配置) ===== -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- JdbcTemplate:按 templateId 从 view_template(type=200) 取 JOR 模板。
DataSource 由运行宿主 platform-app 提供(spring.datasource.*)。 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- 数据库驱动:模板 <Connection> 按驱动类名加载 org.postgresql.Driver,需在 classpath -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<!-- 安全收口:可信当前用户身份(UserSession/LoggedInUser)、profile 守卫(SecurityProfiles)、
报表对象级授权所需。platform-auth 传递依赖 platform-legacy-core,显式声明对齐其它模块惯例。 -->
<dependency><groupId>com.eip4</groupId><artifactId>platform-legacy-core</artifactId></dependency>
<dependency><groupId>com.eip4</groupId><artifactId>platform-auth</artifactId></dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>21</release>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>