shaw
539bfc8bad
feat(security): 敏感操作 step-up 2FA 开关化,安全开关默认关闭
...
新增系统设置 step_up_enabled(默认关闭),把敏感操作 2FA 门控做成可开关;
同时将会话 IP/UA 绑定默认值从开启改为关闭,避免用户因 IP 变动登录后掉线。
## 新增功能
- 敏感操作 step-up 2FA 总开关 step_up_enabled(默认关闭):关闭时账号/代理导出、
备份创建/下载、S3 配置修改、提升管理员等操作恢复门控引入前的直接放行行为;
开启后要求当前会话在 15 分钟内完成过 TOTP step-up 验证。
## 优化改进
- 会话 IP/UA 绑定默认改为关闭(功能保留,可在设置页按需开启)。
- 开启 step-up 开关需操作者本人已启用 TOTP(防自锁);关闭开关本身作为敏感操作,
需通过 step-up 验证(防止攻击者拿到会话后先关闸再导出/备份)。
- 两个安全开关请求字段改为可空指针(省略=保持现值),避免旧客户端全量保存时
静默重置安全开关。
- 备份恢复(整库覆盖可回滚安全设置)纳入 step-up 门控。
- 审计摘要 diffSettings 补记 step_up_enabled / session_binding_enabled 变更。
## Bug 修复
- 修复 BackupView 恢复操作 409(恢复进行中)判断未适配 apiClient 扁平化错误对象。
2026-07-18 10:46:42 +08:00
github-actions[bot]
57914967cb
chore: sync VERSION to 0.1.160 [skip ci]
2026-07-17 08:48:10 +00:00
Wesley Liddick and GitHub
8bfbc5ca99
Merge pull request #4485 from Sub2API-Devs/dev
...
feat(security-audit): 新增 OpenAI 兼容提示词审计能力与安全审计控制台
2026-07-17 16:15:26 +08:00
github-actions[bot]
c2c19a7cbe
chore: sync VERSION to 0.1.159 [skip ci]
2026-07-17 02:00:12 +00:00
mt21625457 and Cursor
df9d9e2e40
fix(security-audit): harden role scan, startup, probe, and localhost dial
...
Scan client-injected assistant/tool/model turns, fail closed when config cannot
be trusted after startup or stale invalidation, reuse probe tokens only for the
same base URL, and restrict localhost dials to loopback addresses.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-07-17 09:00:14 +08:00
mt21625457
d11bdb13f5
feat(security-audit): add OpenAI-compatible prompt auditing
2026-07-17 00:39:39 +08:00
github-actions[bot]
bc2244c83f
chore: sync VERSION to 0.1.158 [skip ci]
2026-07-16 12:37:21 +00:00
yan9651688
9fc006546c
Make repeated group setup safer
...
Admins often recreate groups with the same pricing, routing, and account membership. A server-side duplicate creates an inactive copy for review, preserves eligible account priorities, and recovers ambiguous retries without creating extra groups.
Constraint: Group has no neutral JSON metadata field for durable operation recovery
Constraint: Model routing references account IDs, so copied configuration requires matching bindings
Rejected: Rebuild from the list response | it omits configuration and account priority details
Rejected: Store operation identity in business configuration | it would pollute real group settings
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep duplicated groups inactive until an administrator reviews the copied configuration
Tested: Go unit and full tests, go vet, integration-tag compile, frontend Vitest, lint, typecheck, production build, and Playwright duplicate flow
Not-tested: PostgreSQL container integration locally because Docker is unavailable; CI will execute the database-backed suite
2026-07-16 18:18:28 +08:00
github-actions[bot]
60732a2e8c
chore: sync VERSION to 0.1.157 [skip ci]
2026-07-16 09:12:44 +00:00
shaw
35748d8c51
feat(security): gate admin role promotion behind step-up 2FA and harden admin TOTP verification
...
- 提升用户为管理员 / 创建管理员账号纳入敏感操作:handler 级 EnforceStepUp 门控
(admin API key 拒绝、未启用 TOTP 拒绝、无 grant 返回 STEP_UP_REQUIRED),
目标已是管理员的日常编辑不触发
- 管理员启用/停用 2FA 一律使用密码验证(默认通知邮箱常收不到验证码),
verification-method 按用户角色返回;普通用户行为不变
- 用户编辑/创建弹窗接入 useStepUp:命中 STEP_UP_REQUIRED 弹 TOTP 验证并自动重试
- 审计日志清理入口与其他敏感操作对齐:未启用 2FA 时直接提示先启用 TOTP,
不再弹出无法完成的验证码输入框(后端强制现场 TOTP 语义不变)
- 审计日志页重构:DataTable 布局、详情弹窗分区展示、时间范围改为 ops 同款
下拉(预设窗口 + 自定义起止支持时分)
2026-07-16 16:49:08 +08:00
shaw
590efe29a5
Merge remote-tracking branch 'origin/main' into agent/fix-4326-async-image-object-storage
...
# Conflicts:
# backend/cmd/server/wire_gen.go
2026-07-16 15:32:38 +08:00
shaw
0ddd58aaf9
feat(security): 操作审计日志 + 会话IP/UA绑定 + 敏感操作 step-up 2FA
...
应对管理员访问凭证失守导致的数据外泄风险,新增三层防护:
审计日志(admin-only 可见,用户不可见)
- 新增 append-only audit_logs 表(migration 180)+ 异步批量写入 + 保留期清理
- 审计中间件挂在 admin/user/auth/admin-payment 组认证之后:记录所有变更类
请求 + 白名单敏感读取(账号/代理导出、备份下载、admin/user API key 读取)
- 请求头凭证首尾掩码;请求体 JSON 递归脱敏(api_key/password 等擦除,base_url
保留以便追责);非 JSON body 不入库
- 无单条删除;全量清空需现场 TOTP 校验、拒绝 admin API key、未启用 2FA 不允许,
清空后同步写入留痕记录
会话 IP/UA 绑定(默认开启,可在系统设置关闭)
- JWT 携带 session id + IP/UA 指纹哈希;IP 或 UA 任一变化即撤销会话家族并要求
重新登录;旧 token 无指纹时放行以平滑升级
敏感操作 step-up 2FA(sudo 窗口 15 分钟)
- 账号/代理导出、DB 备份创建/下载、S3 目标修改要求近期 TOTP 二次验证;admin API
key 一律拒绝;前端 useStepUp 组合式 + TotpStepUpDialog 弹码后自动重试
- API key 查看按需求暂不加强管控
前端:新增 /admin/audit-logs 操作日志页面(筛选/详情/2FA 清空)、侧边栏入口、
step-up 弹窗接入导出与备份流程、安全设置项(绑定开关 + 日志保留天数)、zh/en i18n
2026-07-16 13:47:50 +08:00
haruka and Claude Opus 4.8
0eb6e21aaa
feat: 异步图片任务结果落对象存储
...
为异步生图任务增加 S3 兼容对象存储支持,任务结果不再把大图内联存进 Redis:
- 新增可插拔接口 service.ImageStorage(Save -> url),适配别的厂商只需实现它
- S3 实现 S3ImageStorage(AWS S3 / R2 / 阿里云 OSS / MinIO),与备份共用 S3 客户端构造
- 新增 image_storage 配置(config.yaml + IMAGE_STORAGE_* 环境变量),默认关闭
- enabled 同时作为总开关:关闭或未配置对象存储时,异步生图接口返回 404 且不写
Redis,从根上避免几 MB 的 b64_json 结果撑爆 Redis
- 完成时把图片上传对象存储并把结果改写为短链接(公开直链或 presigned),
上传失败则任务标记为失败
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01SM1tf3CFVRzC7guuhBXvMd
2026-07-15 19:57:37 -07:00
haruka
1fb942dd77
feat: add async image generation tasks
2026-07-15 19:57:37 -07:00
Wesley Liddick and GitHub
ab978e615e
Merge pull request #4385 from yardbirds0/feat/upstream-billing-probe
...
feat: 增加上游 Sub2API 计费倍率探测与账号展示
2026-07-16 10:27:45 +08:00
Wesley Liddick and GitHub
8d36ce3d20
Merge pull request #4108 from yardbirds0/feat/key-billing-info
...
feat: 增加 API Key 计费倍率自省接口
2026-07-16 10:27:35 +08:00
Wesley Liddick and GitHub
502097026f
Revert "feat: 支持异步生图任务与结果轮询"
2026-07-16 09:47:27 +08:00
Tian Lee
0765d10c1d
feat: 增加上游 Sub2API 计费倍率探测与账号展示
2026-07-15 23:58:46 +08:00
Tian Lee
f59a6ed74c
feat: 增加 API Key 计费倍率自省接口
2026-07-15 22:42:53 +08:00
haruka
134179085c
feat: add async image generation tasks
2026-07-15 22:13:37 +08:00
Wesley Liddick and GitHub
be6cd1250c
Merge pull request #4367 from Wei-Shaw/feat/grok-custom-base-url-and-headers
...
feat(grok): 支持账号级自定义上游地址与请求头覆写
2026-07-15 20:55:16 +08:00
shaw
221581400b
feat(grok): 支持账号级自定义上游地址与请求头覆写
...
将账号级请求头覆写从 anthropic/openai 的 api_key 账号扩展到 Grok 的
api_key 与 oauth 账号,并放开 Grok OAuth 账号的自定义上游地址(仅作用于
转发端点,授权与 token 刷新链路不变)。
后端:
- IsHeaderOverrideEligible 扩展到 Grok(api_key+oauth),禁止名单新增
x-grok-conv-id(逐请求会话路由头)。
- 所有 Grok 上游请求路径接线 ApplyHeaderOverrides(Responses/Chat 桥/
媒体/配额探测/billing 探测/连通性测试),统一置于内置默认头之后。
- GetGrokBaseURL/GetGrokMediaBaseURL 放开 OAuth 自定义地址:官方地址
视同未定制回落官方网关,仅显式第三方 host 改发转发流量。
- 非官方 host 允许任意 path 前缀,官方 host 仍强制 /v1。
- OAuth base_url 校验按 host 判定官方/自定义,自定义 host 恒受运营方
URL 策略约束,不受 XAI_ALLOW_UNSAFE_URL_OVERRIDES 调试开关放宽。
- 给 GrokQuotaService 注入 config,使配额/billing 探测与转发共用同一
URL 策略。
前端:
- Edit 模态为 Grok OAuth 账号新增「自定义上游地址」开关。
- 请求头表单新增 JSON 快速导入与按 JSON 一键复制(复用 useClipboard,
兼容非安全上下文 HTTP 页面)。
- 门控改为平台×类型判定,Bulk 批量 base_url 增加格式校验,zh/en 文案同步。
2026-07-15 20:30:23 +08:00
Yuhao Jiang
736824dd7a
feat(affiliate): add admin recharge rebate option
2026-07-15 04:28:55 -05:00
github-actions[bot]
d515c3045c
chore: sync VERSION to 0.1.156 [skip ci]
2026-07-15 08:51:27 +00:00
shaw
bdb5be1c42
Merge remote-tracking branch 'origin/main' into pr4241-fix
2026-07-15 16:11:28 +08:00
Wesley Liddick and GitHub
0de768e8be
Merge pull request #4221 from heathermhuang/codex/fix-grok-oauth-pool-health
...
fix(grok): refresh OAuth pools proactively
2026-07-15 16:07:09 +08:00
yan9651688
60ff61132d
feat(accounts): make repeated static account setup safer
...
Admins often need another account with the same provider and routing configuration. Duplicate on the server so credentials never return to the browser, preserve exact group priorities atomically, start the copy paused, and recover the same copy after ambiguous idempotency-store failures.
Constraint: Admin account responses redact credentials, so duplication must remain server-side
Constraint: OAuth and setup-token credentials rotate and must not be shared across account rows
Rejected: Copy raw account JSON to the clipboard | exposes credentials outside the server
Rejected: Duplicate rotating credentials | account-scoped refresh locks can race token rotation
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep copies paused, avoid automatic upstream probes, and exclude rotating credential types unless token ownership is redesigned
Tested: Targeted Go tests, Go vet, server build; frontend lint, typecheck, Vitest suite, production build; integration test compiled
Not-tested: Docker-backed PostgreSQL execution because Docker is unavailable
Related: Wei-Shaw/sub2api#1379
Related: Wei-Shaw/sub2api#2928
2026-07-15 10:51:13 +08:00
Heatherm Huang
6b25900403
fix(grok): refresh OAuth pools proactively
2026-07-15 09:40:08 +08:00
cat
d68a2aac1a
chore(openai): 同步上游并解决认证冲突
2026-07-14 19:04:04 +08:00
cat
f479a5d10c
fix(openai): 收紧 Agent Identity task 生命周期
2026-07-14 18:09:59 +08:00
github-actions[bot]
7c717365ef
chore: sync VERSION to 0.1.155 [skip ci]
2026-07-14 07:08:08 +00:00
Heatherm Huang
a13a6113dd
fix(grok): route generic account refresh correctly
2026-07-14 15:00:52 +08:00
superman2003
a1b5c75ca3
feat(grok): probe newly imported OAuth accounts
2026-07-14 12:24:42 +08:00
superman2003
c896cacf6d
feat(grok): improve free quota probing and usage
2026-07-13 19:49:56 +08:00
github-actions[bot]
55ed0ab0da
chore: sync VERSION to 0.1.153 [skip ci]
2026-07-13 08:32:35 +00:00
li
03ccb2a08e
fix(payment): 删除泄露内部 AI 渠道配置的废弃接口
...
Fixes #4160
2026-07-13 15:22:39 +08:00
github-actions[bot]
a1930ea6f2
chore: sync VERSION to 0.1.152 [skip ci]
2026-07-13 02:53:05 +00:00
github-actions[bot]
6c588bb950
chore: sync VERSION to 0.1.151 [skip ci]
2026-07-10 13:24:13 +00:00
github-actions[bot]
9a2f11b4e2
chore: sync VERSION to 0.1.150 [skip ci]
2026-07-10 06:27:11 +00:00
github-actions[bot]
12d811bd76
chore: sync VERSION to 0.1.149 [skip ci]
2026-07-09 14:57:53 +00:00
github-actions[bot]
0ee51b45f8
chore: sync VERSION to 0.1.147 [skip ci]
2026-07-09 10:10:28 +00:00
Turtle_Li
a6023840f7
Merge remote-tracking branch 'origin/main' into feature/batch-image-foundation
...
# Conflicts:
# deploy/Dockerfile
2026-07-07 15:14:37 +08:00
github-actions[bot]
9d5f1b73ad
chore: sync VERSION to 0.1.146 [skip ci]
2026-07-07 03:16:52 +00:00
Turtle_Li
1b07fe821a
merge: sync batch image branch with origin main
2026-07-07 03:27:11 +08:00
Wesley Liddick and GitHub
d1d3400b69
Merge pull request #3645 from bestony/worktree/lucky-harbor-dbe4
...
feat(keys): add api key concurrency stats
2026-07-06 16:45:15 +08:00
github-actions[bot]
76bb7b0338
chore: sync VERSION to 0.1.145 [skip ci]
2026-07-06 08:30:51 +00:00
Turtle_Li
9703ca9d33
merge: sync batch image foundation with upstream main
2026-07-06 13:40:09 +08:00
Turtle_Li
8fab636998
feat: complete batch image workflow
2026-07-06 12:22:04 +08:00
github-actions[bot]
b650bdd68d
chore: sync VERSION to 0.1.144 [skip ci]
2026-07-04 03:49:44 +00:00
Turtle_Li
a994fbd77a
feat: add batch image MVP
2026-07-04 05:30:50 +08:00