status: done
当前安全评估指出 5 类敏感信息与上传面风险:
/system/config/page 返回系统参数时暴露 sys.user.initPassword 明文默认密码。/system/user/page 返回用户分页时包含 password、salt 等认证字段,并直接暴露手机号、身份证号等 PII。/system/cache/page 与 /system/cache/getInfo 可枚举 Redis 敏感键和值,包括加密会话密钥、Sa-Token token/session 等。/system/storage/config/default 可能返回 OSS AccessKey/SecretKey 等云存储凭据。/api/file/upload 允许认证用户上传 HTML、JSP、PHP 等高风险文件,文件类型校验依赖存储配置且默认配置可能为空。password、secret、token、key、credential、ak、sk 等关键字的配置键。SysConfigController 对 page/list/detail 返回对象做脱敏拷贝,敏感 configValue 返回 ******。/system/config/configKey/{configKey} 对敏感配置键拒绝返回明文。SysConfigServiceImpl.updateConfig 对敏感配置支持“脱敏占位值不更新原值”,避免前端保存 ****** 覆盖真实值。sys.user.initPassword 作为高危默认密码配置,通过迁移脚本清空并停用。SysUser.password、SysUser.salt 使用 @JsonIgnore,从所有 JSON 响应中排除。forcePasswordChange 字段,用于登录态强制改密。/system/user/page 返回前对 phone、idCard、email 做脱敏;详情接口只清空认证字段,不脱敏需要编辑的字段。/auth/userInfo、/system/user/profile 返回前清空认证字段,并保留 forcePasswordChange 供前端判断。sys_user 新增 force_password_change,默认 0。1。/auth/changePassword 修改成功后设置为 0。LoginUser 时带出 forcePasswordChange。ApiPermissionInterceptor 在 API 权限判断前检查登录用户强制改密状态;若为 true,只允许访问 /auth/userInfo、/auth/changePassword、/auth/logout 和必要密钥交换接口。forcePasswordChange=true,跳转 /profile 并提示必须改密;路由守卫阻止访问其他页面。SysCacheController 定义敏感缓存键前缀/模式:
crypto:session:*Authorization:login:token:*Authorization:login:token-session:*Authorization:login:last-active:*satoken:*auth:sso:*/system/storage/config/default 继续返回上传组件所需安全字段,不含 endpoint/accessKey/secretKey/bucket/domain/basePath。accessKey、secretKey 脱敏显示。/system/storage/config/options 保持只返回 id、configName、storageType、isDefault、enabled。FileManager 对所有 MultipartFile 和流式上传统一执行:
jsp,jspx,php,asp,aspx,html,htm,js,mjs,ts,vue,sh,bat,cmd,exe,dll,jar,war,ear,sql 等。allowedTypes,使用默认安全白名单:jpg,jpeg,png,gif,webp,pdf,doc,docx,xls,xlsx,txt,csv,zip,rar,mp4,mp3。新增 V1.0.67__harden_sensitive_data_and_upload_controls.sql:
sys_user 增加 force_password_change tinyint(1) NOT NULL DEFAULT 0。force_password_change=1,用于强制所有已存在账号下次登录先改密。sys_config 中 sys.user.initPassword 清空 config_value 并设置为停用或非系统内置。sys_file_storage_config.allowed_types 为空时回填默认安全白名单,并移除 svg、md 等容易承载主动内容的默认公共上传类型。/system/config/page 和 /system/config/getById 不返回 sys.user.initPassword 明文。/system/user/page 响应不含 password、salt,手机号/身份证号已脱敏。/system/cache/page 不出现 crypto:session、Authorization:login、satoken 等敏感缓存键;getInfo/remove/clear 不能操作这些键。/system/storage/config/default 不含 AK/SK;管理页只显示脱敏值。/api/file/upload 上传 .jsp、.php、.html、.js 等文件失败。forcePasswordChange=true 的用户登录后只能访问改密相关接口,改密成功后恢复正常访问。