Commit Graph

8 Commits

Author SHA1 Message Date
b9ad18f147 P2-LIKE: 保真层 GeneralPO 值位置单引号转义堵 LIKE 搜索注入
承 P4-4 §坑8.8 + 架构 §四安全第 2 层 LIKE 路径项。GeneralPO 对 String
搜索值裸拼 col like '%值%'(GeneralPO.java:1940)及同形态 5 处(Object 等值
1982/IN 1978/全表模糊 ilike 2075/like 2145/2173)无参数绑定 → 单引号闭合
字面量注入。

修复(保真层最小改动,严格口径):
- StringUtil 新增 escapeSqlLiteral:只把 ' 双写为 ''(SQL 标准转义堵注入)、
  绝不转义通配符 % _(旧系统通配语义保真)、不补外层引号(拼接形态零变化)
- GeneralPO 6 处用户可控值位置各包一层 escapeSqlLiteral,SQL 结构一字未改
- m_IDs(主键)/get_TableName()(标识符,白名单守)非值位置,不在本次范围
- 真参数化(PreparedStatement ?)列 P2 后续热点项,本次只堵值转义注入面

验证:单测 7/7;mvn install 10 模块 + ArchUnit 绿;ParityCli --all 21 实体
全一致 + --privilege 9 正/3 负全过;REST 8091 实测注入负例 200 空结果
不注入不报错(表未被 DROP),a%b/纯 % 仍通配。详见 P2-LIKE注入修复报告.md
+ 迁移手册 §8.10。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 17:26:05 +08:00
6cc7b3fb61 P2-3: 横切服务桩换 framework 真实现(文件/日志/消息)
保真层原样移植三块横切服务,删除对应桩,bean 名/包名/签名不动:

- 文件 com.dsasp.server.file.*:FileServiceImpl(bean fileService)真实现,
  存储后端经替换类 FTPClientTemplate(保包名/类名/签名,FTP→本地盘,
  根目录 eip4.file.root 配置化默认 ./data/files,resolveSafe 防 ../ 逃逸);
  BASE64Decoder→java.util.Base64、ant zip→java.util.zip、commons-codec→MessageDigest。
- 日志 com.dsasp.server.log.*:SystemLogManagerImpl/DataOperatorLogger/
  DataLogRecorderImpl + 异步调度(DataLogManager/ProcessLogThread/ProcessSysLogThread)
  原样移植,落 SYS_LOG/SYS_DATA_LOG/SYS_DATA_LOGITEM(后者 insert-only 无审计列,§5.1)。
- 消息 com.dsasp.server.mail.*:SystemEmailServiceImpl + SystemEmail/SystemEmailService
  移植;SMTP 配置缺省时降级 no-op + WARN,不阻塞启动(§5.38)。

装配/配置/自举/验证:
- LegacyXmlWiring 等价补齐三处 jdbcTemplate setter + MainApp.destPath 注入(§4.1);
- application.yml 加 eip4.file.root;bootstrap-xservice.sql 自举四张横切表 + LOGLEVEL;
- 删除 StubFileService/StubSystemLogManager/StubDataOperatorLog(StubProjectSwitchService
  属 viewframework 域非本任务范畴,保留);
- 单测 12 + 本地 DB 集成 4,全模块 mvn clean test 绿(含 ArchUnit);8087 启动验证毕已 kill。

报告:platform-auth/P2横切服务实测报告.md;坑入 docs/迁移手册.md §3.1/§3.2/§5.36-5.38。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 14:06:31 +08:00
0ebe6d692b P2-1: 移植 EIP3 组织/用户/角色/OTP 模块进保真层(原样,包名签名不动)
framework/com.dsasp.server.organize/src 的 5 个 impl 原样移入 platform-legacy-core:
OrganizationServiceImpl / UserFindServiceImpl / RoleServiceImpl /
UserOtpServiceImpl / AssignmentHandlerImpl(Activator 不移植,见手册 §5.17)。

补齐依赖闭包(legacy-core 原无):
- common 接口 5 个:OrganizationService / UserFindService / RoleService /
  UserOtpService / AssignmentHandler
- AssignmentHandlerImpl 的 workflow 依赖:ProcessDefinitionService + WFMould

OTP 库 jotpverify.jar(ft.otp.verify.OTPVerify,无公网坐标)经
platform-legacy-core/local-libs 模块内私有仓库解析(file://),
父 pom 不动,构建可复现(手册 §5.OTP)。

LegacyXmlWiring 补 4 个 impl 的 setter 注入(等价原 organize service.xml
<property>,旧类零修改,手册 §4.1)。

privilege 模块 diff 核查:除 OSGi Activator 外已全部在仓库,无需再搬。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 13:38:37 +08:00
4c9af8edd4 feat(metadata): P1-4 CCache 换 Caffeine + POInfo 缓存失效钩子(修 C1 坑3)
CCache 内部由极简 HashMap 换 Caffeine(版本走 Spring Boot BOM),公共签名一行不动:
仍 extends HashMap + 双构造器 + getName/reset,get/put/remove/size/clear 覆写代理到
内部 Caffeine Cache,4 处 call site 零改动全部受益。
PoInfoCacheInvalidator 现代层显式 evict(不改 com.dsasp):先 getPOInfo 装载映射再调
引擎公共钩子 setChangePOInfo,保证冷态命中——修复 C1 坑3「元数据变更不失效须重启」。
单测 10 个(CCache 行为 6 + 失效钩子 4)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 12:10:52 +08:00
f0500647be feat(metadata): 服务流执行 REST 门面 FlowController + 本地自举 + 单测
P1-2 第二步:报表方案 D 类——79 个 selectservice 服务流的统一 REST 化入口。

FlowController(com.eip4.platform.metadata.web):
  GET  /api/flow/{id}?k=v   query 参数 → 服务流入参 map(查询/报表类)
  POST /api/flow/{id} body  JSON body  → 服务流入参 map(参数多/带结构)
  统一封装 {status,msg,data};响应递归归一化(GeneralPOJO→平面行、
  listSelect 结果 {listresult,pagecount}→amis {items,total})。OpenAPI 注解。
  REST 入口读写时机:引擎不区分读写,P1 不在门面做引擎级读写闸,由调用方按
  「流定义 XML 审阅」确认查询/报表类后放行;风险与 P2 三层防护待办写入注释与报告。

适配(P1 服务流脚本编译):SecureGroovyScriptEngineFactory 的 DEFAULTIMPORTSLIST
移除两条 Vaadin 客户端 UI 默认导入(client.groovy.TestService、
com.dsasp.client.viewframework.component.MainComponent)——它们逐脚本注入,
classpath 缺失会使每个服务流脚本编译失败;与服务端取数无关,原值登记于注释供 diff。

LegacyXmlWiring:补 FlowServiceImpl.setJdbcTemplate(等价原 XML <property> 注入)。

本地自举:platform-parity bootstrap-flow.sql(幂等)——在 eip4m0 上建 SYS_SERVICEFLOW
+ 自描述元数据 + 最小查询流 EIP4M0_USERGROUP_SEARCH,参照 parity bootstrap 思路,
无客户库副本时引擎可独立跑通。

单测 18 例:FlowModelParseTest(9,XML 解析/参数绑定/默认流生成/往返序列化)+
FlowControllerTest(8,mock 引擎,GET/POST 参数透传 + 响应归一化)+
FlowExecuteLocalIT(1,@SpringBootTest local profile,自举 SQL + 真实引擎执行 +
二次一致;eip4m0 不可达则 assumeTrue 跳过)。全绿。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 12:01:15 +08:00
de72116502 feat(legacy-core): 移植 EIP3 服务流引擎到保真层(com.dsasp.* 原样)
P1-2 第一步:framework com.dsasp.server.core 17 文件移植 + 缺失 common 依赖回填。

引擎(core):FlowExcuteServiceImpl(534 行,服务流执行入口)+ FlowServiceImpl
(流定义加载/默认流生成)+ flow/model 8 个(Flow/Node/Field/Procedure/Script/
ServiceBean/Start/End/Transition + BaseFlowConvert/DefaultFlowHelper)+
service/script(ScriptingEnginesManager/FlowScriptBindings)+ origin(OriginServiceManagerImpl)。
OSGi Activator.java 不移植(纯 BundleActivator/sun.awt,JDK17 不可用;
等价能力已由 SpringBeanOsgiServices @Component + 组件扫描接管,见迁移手册 §3.1)。

缺失 common 依赖回填(framework 原样):core.ControlBean/FlowDefinition、
core.service.{FlowExcuteService,FlowService,OriginServiceManager}、
util.{AopTargetUtils,ExceptionUtil}、privilege.service.FlowPrivilegeService。

函数库回迁:GetValueFunction/GetDefaultValueFunction 以 framework 原版 Groovy
回迁(替换 PoC 空桩,依赖均已就位,gmavenplus 联合编译);GetServicesFunction
保包名/类名/签名,回迁引擎执行路径实际调用的 findCount/loadPOJO/listSelect
三方法(其余 @Function 依赖 P2/P3 横切服务,届时补全)。

FlowPrivilegeService:framework 原样移植(FlowPrivilegeServiceImpl + ServicePrivilege)
入保真层 com.dsasp.server.privilege.service。

API 断点修复(迁移手册 §2 同款):FlowServiceImpl 移除 JDK 内部 import
com.sun.xml.internal.*(原版未用)、queryForInt→queryForObject;Flow.java
dom4j 2.x selectNodes 返回 List<Node> 加 unchecked 转型(14 处)。
ScriptingEnginesManager 的 activiti JuelScriptEngineFactory 适配为 JSR-223 惰性
注册(架构纪律:activiti/Flowable 不进保真层;线性查询/报表流不走 juel)。

mvn compile/test 通过,ArchUnit(保真层禁依赖现代层)仍绿。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 11:49:01 +08:00
fc867dc110 feat(auth): C2 数据权限最小真实现替换桩(保真层原样移植)
把 framework 的数据行级权限实现原样移植进保真层 platform-legacy-core
(包名 com.dsasp 不动),删除 platform-auth 的不过滤桩,由真实现接管
@Service("dataPrivilegeService"):

- DataPrivilegeServiceImpl(226 行):getWhereClause 按 ctx.ROLES 匹配
  SYS_FILTERRULE 规则拼 " AND (...)" 行级过滤;无角色命中抛 PrivilegeException。
- DataFilterHelper(110 行):FILTERRULE(Conditional[])JSON 互转,用 Jackson 1.x
  (org.codehaus.jackson),保真纪律不改写为 Jackson 2;父 pom + legacy-core pom
  引入 jackson-mapper-asl:1.9.13。
- MethodSecurityInterceptor 注解(被 Impl 引用,原样拷入)。
- 删除 StubDataPrivilegeService(与新 Bean 重名冲突);platform-auth/README.md
  说明 dataPrivilegeService 已由保真层接管、P2 在此做组织/权限整体真实现。
- 单测 9 用例(DataFilterHelper JSON 互转 + getWhereClause 拼接,假 POJOInfo)。

全模块 mvn clean install 通过,ArchUnit 仍绿。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 00:10:49 +08:00
a9219c5c77 chore: 落地 eip4-platform 多模块骨架基线(PoC→工程化)
从 eip4-poc 迁入双层制模块化单体:保真层 platform-legacy-core
(com.dsasp 引擎原样)+ 现代层 platform-metadata/auth/flow-gateway/
converter/ai + platform-app 启动器。ArchUnit 纪律固化(保真层禁依赖现代层)。
此为 C1 对拍工作的编译通过基线。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 23:40:51 +08:00