8 Commits

Author SHA1 Message Date
ymq
747a808b48 fix(entry): 恢复 ns_wiring 接线——只读基础模块 handler 补齐
上一条 commit 702f274 归档 24 个自造中间件时,连带把 ns_wiring.py
一并归档,导致 rbac/appbase 的 dspy 端点报
TypeError: 'NoneType' object is not callable(模块函数未注入命名空间)。

ns_wiring 不属于鉴权中间件,它是「业务模块 dispatch + 只读基础模块
handler 补齐」接线:只在运行时 setattr env.<handler>,不装配 aiohttp
中间件、不改基础模块源码,因此恢复。

实测(184 个 dspy 语法扫描 + 端点扫描):
  恢复前:19 个端点 500(list_path_roles / get_code / find_unauth_files 等)
  恢复后:仅剩「无参 GET 调写端点」的假阳性,只读端点全部正常

ns_wiring.py 从 app/_archive_disabled_20261028_151505/ 原样恢复,未改动。
2026-10-28 16:39:56 +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
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
873a83ab44 approve: world_sync 模块开发(W-05 同步管理) 2026-08-29 16:35:05 +08:00
agent.develop
de31d36a87 approve: entity 模块开发(W-03 实体管理) 2026-08-29 16:15:32 +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
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