Skip to content

feat: implement text sanitization for proxy and token configurations, enhancing security and data integrity across API endpoints#284

Merged
chenyme merged 1 commit intomainfrom
sanitization
Mar 6, 2026
Merged

feat: implement text sanitization for proxy and token configurations, enhancing security and data integrity across API endpoints#284
chenyme merged 1 commit intomainfrom
sanitization

Conversation

@chenyme
Copy link
Owner

@chenyme chenyme commented Mar 6, 2026

Summary

已加自动替换与校验(避免再触发 latin-1 报错)

  • 请求头构建时统一做字符清洗(把 –/— 等替换成 -,去掉零宽字符,保证 latin-1 可编码):
    /Users/project/mine/grok2api/app/services/reverse/utils/headers.py

  • Token 模型层增加规范化校验(自动替换异常连字符、去空白、去 sso= 前缀、过滤非 ASCII):
    /Users/project/mine/grok2api/app/services/token/models.py

  • 管理端更新 token 时也做自动清洗,空 token 直接跳过:
    /Users/project/mine/grok2api/app/api/v1/admin/token.py

  • 管理端更新 config 时对 proxy.user_agent / proxy.cf_cookies / proxy.cf_clearance 自动清洗后再保存:
    /Users/project/mine/grok2api/app/api/v1/admin/config.py

Changes

  • 功能新增
  • Bug 修复
  • 重构/清理
  • 文档更新
  • 其他(字符清洗)

Related Issues

Closes #278

Verification

  • 本地运行验证
  • 单元/集成测试
  • Docker 构建通过
  • 未验证(请说明原因)

Breaking Changes

  • 有(请说明迁移方式)

… enhancing security and data integrity across API endpoints
@chenyme chenyme changed the title feat: implement text sanitization for proxy and token configurations,… feat: implement text sanitization for proxy and token configurations, enhancing security and data integrity across API endpoints Mar 6, 2026
@chenyme chenyme merged commit 7ab06be into main Mar 6, 2026
8 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

question: 能调用grok模型聊天和生图,但是无法生成视频,必报“编码错误”

1 participant