9 Commits

Author SHA1 Message Date
ymq
7b7322dbfe fix(config): 恢复 i18n 链路 + session 时长 + 清 app/__init__.py
独立审查实测发现三个回归(均由 702f274 入口回归引起):

1【阻断】/i18n_getmsgs 500
   702f274 把 startswiths 的 i18n 条目换成了 /healthz,而 bricks 前端
   默认请求 /i18n_getmsgs(i18n.js:19)→ 500,界面文案/语言切换全受影响。
   实测 further:ahserver.globalEnv.i18n() 取 params_kw.lang,而前端传
   language → startswiths 映射本身就不可能工作。
   修复:wwwroot 放标准资源 i18n_getmsgs.dspy(按 language 读
   wwwroot/i18n/<lang>/i18n.json),startswiths 只保留 /healthz。

2【重要】会话时长回落到框架默认 120 秒
   702f274 把 config 写成 ahserver 不认识的 website.session{timeout,...},
   而 ahserver/auth_api.py 读的是 website.session_max_time(默认 120)。
   实测:登录后空闲 135s 再请求 → 401。原配置 28800s。
   修复:补回 session_max_time=28800、session_reissue_time=7200。

3【重要】app/__init__.py 仍 import 5 个已归档中间件
   每次启动 5 条 warning,且 __all__ 宣称导出的符号实测 ImportError。
   修复:清空为纯包标记;顺带移除死配置 http_semantics(新入口无
   ahapp_built 钩子,该块不会被读,且本身是已删中间件的开关)。

实测(重启后):
  /i18n_getmsgs?language=zh 200 | /healthz 200 | /index.ui 200 | login.ui 200
  空口令登录被拒(业务错误信封)| admin123 登录 200 + cookie
  带 cookie 访问受保护端点 200 | 匿名 401
2026-10-28 17:06:25 +08:00
ymq
702f27407b refactor(auth): 移除全部自造鉴权/会话/语义中间件,回归标准 ahserver+rbac
根因:元景迭代中为通过 QC 门禁反复叠加了 24 个自定义中间件
(auth_gate_strict / session_gate / login_param_source / route_guard /
 entry_semantics / http_semantics / notfound / get_only_405 / ...),
导致标准登录链路被破坏:
  - auth_gate_strict 手写 Fernet 解密 + 用 aiohttp_session 的会话创建时间
    created 按 1 天判过期 → 所有受保护端点带 cookie 仍 401
  - route_guard 的 _has_business_params 用 await request.read() 消费 POST body
    → up_login 收到 params_kw={} → password_encode(None) 崩 500

改动:
  - app/scense.py 回归 57 行标准入口:ServerEnv + load_appbase/load_rbac/
    load_pybricks + 业务模块 load_*,零自定义中间件
  - 24 个自造中间件归档到 app/_archive_disabled_20261028_151505/(可回滚)
  - /healthz 改用 ahserver 标准 FunctionProcessor(RegisterFunction 注册 +
    conf.website.startswiths 映射),不再用中间件拦截

实测闭环(127.0.0.1:9380 + https://gbak.opencomputing.cn):
  healthz 200 | 匿名 401 | admin 登录 200+cookie | 带cookie 200 |
  伪造cookie 401 | 注册 200+自动登录 | 新用户登录 200+cookie |
  新用户访问 403(已认证无权限,RBAC 正确行为)| 登出 200 |
  错误密码 200 业务信封(不崩 500)

register/login/logout/session 全部由 rbac 模块 up_login.dspy /
register.dspy / logout.dspy + ahserver session 中间件提供。
2026-10-28 15:19:43 +08:00
pipeline-agent
08a1b7ba6a fix: config kwargs 键 database→db(aiomysql.connect 只认 db) 2026-08-30 08:35:50 +08:00
pipeline-agent
449f1e607e security: config.json 凭据改占位符(真实凭据只在部署机 .env) 2026-08-29 23:15:38 +08:00
pipeline-agent
455f86d440 feat: 集成4新模块——build.sh 模块清单、config modules、app入口挂载4个load_*、恢复一键部署build.sh、index.ui真实widget 2026-08-29 23:13:49 +08:00
agent.develop
e46bc16173 fix(scense): 修复元景初始迭代 4 个部署/访问 Bug - ahserver 规范入口、config processors/indexes、build.sh 端口门禁、fix_scense_access 重启兜底、init_admin_user RBAC 幂等初始化 2026-08-29 09:49:11 +08:00
agent.develop
4b183aa7fc fix: bricks dist mkdir+产物校验;种子脚本(机构/角色/权限/超管);rbac/appbase软链;config database→db 2026-08-28 17:01:01 +08:00
agent.develop
8057ba2888 feat: build.sh 按 webapp-deploy 技能重写一键部署(venv+clone全模块+四步安装+/healthz门禁);加 start/stop;/healthz钩子;密码加密 2026-08-28 16:15:37 +08:00
agent.develop
93dadab835 feat(scense): scense 初始化提交(元景项目-初始迭代,开发产线产出) 2026-08-28 13:34:54 +08:00