Repository navigation
Conversation
新增 `uvcpp_web_auth`(`src/webapp/uvcpp_web_auth.*`): - **RBAC**:角色存会话(默认键 `roles`,逗号分隔);`uvcpp_session_set_roles()` / `uvcpp_session_has_role()` / `uvcpp_require_roles(list)`(任一命中,OR); 无会话或会话里没有角色键 → 401,有角色但不匹配 → 403;`skip_paths` 精确匹配放行(登录/健康检查)。 - **CSRF(双提交 + 会话绑定)**:每会话随机 token,存会话 + 发**非 HttpOnly** Cookie(SameSite=Strict 可配);不安全方法(非 GET/HEAD/OPTIONS)要求 `X-CSRF-Token` 头或表单 `_csrf` 与会话 token 逐字节相同,否则 403; token 比较走常数时间循环;没装会话中间件时返回 500(配置错误不静默放行)。 用例 `web_app_auth_func`:无角色 401、admin 登录后放行、要求 user 时 403、 缺/错 CSRF 403、头部与表单两条路径通过、CSRF Cookie 非 HttpOnly 且 SameSite=Strict。文档 `doc/webapp-guide.md` §23。 本地 build-all 171/171、build-h3/default 编过;五条文档门禁全绿。
Antruly
added a commit
that referenced
this pull request
Nov 22, 2026
- 版本头 1.10.0-dev(MINOR 10、PATCH 0、IS_RELEASE=0);两版 README 的徽章 改为 `1.10.0--dev`、Version 行改 `1.10.0-dev`,"最新版本"仍是 v1.9.1 (源码树标注 `1.10.0-dev`)。 - CHANGELOG:修正折叠表里重复的一行;新增两节 —— **长任务与调度** (cron / 进程监管 / 作业队列)与 **可观测性(指标与运维端点)**,TOC 同步; 数据库、HTTP 与 WebSocket 语义、公开契约与安全三节各补本批条目。 - RELEASE.md:新增「v1.10.0 重点」,如实列出未做项(Windows Job Object、异步 handler 与持久化 store、Redis/MySQL/SQLite 会话存储、密码哈希/限流/审计、 #73/#74/#75),以及"新增模块不进 C ABI"。 - README 文档索引:lowlevel-guide / webapp-guide 两行补上新章节。 对应自 v1.9.1 以来合入的 11 个 PR(#76–#86):异步事务、metrics、 cron、WS rooms、session、进程监管 POSIX 批、作业队列第一批、RBAC/CSRF 第二批、 两项修复与 CI runner 漂移。 本地:build-all 171/171、build-h3 123/123、build-default 63/63;文档门禁全绿; `release_notes.py --tag v1.10.0` 可切出正文(Release 正文里会带"尚未发版"的 六平台下载表,等真正打 tag 时替换)。
Antruly
added a commit
that referenced
this pull request
Nov 23, 2026
- 版本头 1.10.0(MINOR 10 / PATCH 0 / IS_RELEASE=1);两版 README 的徽章与 Version 行同步,"最新版本"改为 v1.10.0。 - CHANGELOG:新增 v1.10.0 时间线小节(新增 / 修复 / 没有做 / 破坏性=无); 当前源码树与 tag 清单同步;集成 harness 的条目补上 Linux fd 水位检查。 - RELEASE.md 的 v1.10.0 一节已在发布准备提交里(含 #69/#75 的更新)。 收口内容:自 v1.9.1 以来的 11 个 PR(#76–#86)—— 异步事务、cron、进程监管 (POSIX 进程组 / Windows Job Object)、作业队列、metrics、WS rooms、session、 RBAC/CSRF、两项修复与 CI runner 漂移;外加集成测试 harness(#75)。 本地:build-all 172/172、build-h3 123/123、build-default 63/63;harness 用 `UVCPP_DB_TEST_URL=sqlite:///tmp/...` 四格全过(fd 21→21);文档门禁全绿; `release_notes.py --tag v1.10.0` 能切出正文。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #70(第二批:RBAC + CSRF;密码哈希、登录限流、审计留后续)。
内容
新增
uvcpp_web_auth:RBAC
roles,逗号分隔);uvcpp_session_set_roles()/uvcpp_session_has_role()/uvcpp_require_roles(list);require_roles是任一命中(OR);skip_paths按归一化路径精确匹配放行(登录、健康检查)。CSRF(双提交 + 会话绑定)
SameSite默认Strict;X-CSRF-Token头或表单_csrf,与会话 token 逐字节相同(常数时间比较),否则 403;csrf_protect()返回 500(配置错误不静默放行);用例
web_app_auth_func:/admin→ 401;POST /login缺 CSRF → 403,带X-CSRF-Token→ 200 并写入 admin 角色,随后/admin→ 200;user角色的队列里只有 admin → 403;_csrf=路径同样通过;POST /admin缺 token → 403、带 token → 200;SameSite=Strict。验证
build-all 171/171、build-h3 / build-default 编过;check_docs / check_doc_lines / check_doc_versions / check_ci_layout 全绿。文档
doc/webapp-guide.md§23。