fix: replace hardcoded JWT and AES encryption keys with env placeholders#543
Open
saaa99999999 wants to merge 289 commits into
Open
fix: replace hardcoded JWT and AES encryption keys with env placeholders#543saaa99999999 wants to merge 289 commits into
saaa99999999 wants to merge 289 commits into
Conversation
* feat: nps评分功能 * feat: nps样式添加 * feat: 添加nps评分icon * feat: 基于修改建议修改nps评分组件 * feat: 将自定义类移入至设置器
* fix: 修复评分和nps题型非必填提示没有填写的问题 * fix: 使用添加key的方法修复必填提示
* feat: 增加拖拽添加题目效果 * feat: 手动实现题型的预览效果 * feat: 优化预览体验
* feat: 补充file模块的单测 * fix: 安装types依赖
* fix: 下线数据上报 * fix: 下线数据上报
* 修改配置环境 * 添加AI生成问卷入口 * 创建AI智能生成问卷页面 * AI生成问卷前端代码优化 * AI生成问卷页面分文件编写 * 修复列表页TextImport问题 * AI api 初始调试完成 * 前端页面显示AI生成结果 * Text to Schema 应用预览 * 把ai-generate页面中的东西转接到列表页AIGenerate组件下 * 实现创建问卷的功能啦!!! * AI生成问卷页面功能丰富 * AI生成标签 * 删除多余的ai-generate页面文件 * 实现AI打字输出 * 停止生成功能完成 * 标题处AI标签样式、重新生成、万能公式内容微调 * AI loading 和生成的时候禁止用户输入,AI生成东西的时候用户视角也会跟随移动 * 隐藏AI模型KEY MongoDB数据库URL
Co-authored-by: luch <32321690+luch1994@users.noreply.github.com>
Collaborator
|
@saaa99999999 hello,请阅读贡献指南,用develop分支作为pr的基准分支 |
Collaborator
|
@saaa99999999 你好,切到develop后有冲突哦,麻烦解决一下冲突再合入吧 |
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.
1. 硬编码 JWT 签名密钥 (CWE-798)
仓库中提交了3个 .env 文件,其中 JWT 签名密钥都是同一个可预测的值。
server/.env / server/.env.development / server/.env.production:
修复前:
修复后:
这个密钥在 auth.service.ts 中同时用于签名和验证 JWT token:
拿到仓库代码的人可以直接使用 xiaojuSurveyJwtSecret 伪造任意用户的 token,绕过 authentication guard。
2. 硬编码 AES 加密密钥 (CWE-798)
同样在 3 个 .env 文件中,AES 加密密钥也是硬编码的。
server/.env / server/.env.development / server/.env.production:
修复前:
修复后:
密钥用途:
拿到这个密钥的攻击者可以解密所有问卷回答数据,包含用户手机号、身份证号、地址等 PII。
3. 错误日志泄露 JWT 密钥 (CWE-532)
server/src/modules/auth/controllers/auth.controller.ts:138-143:
修复前:
修复后:
登录失败时的错误消息会把 JWT 密钥和过期时间拼接进去,泄露在日志或响应中。
共计修复 3 个问题,涉及 4 个文件。