B-64: 安全修复——随机初始密码与跨公司重复上传隔离

- 公司账号创建改为随机一次性初始密码,只在创建响应中显示一次,
  密码保证不等于用户名;删除「用户名即初始密码」兼容分支,继续
  强制首次登录改密。
- 跨公司相同字节文件上传只返回通用重复状态:不再返回其他公司的
  原批次 ID、银行、模板、期间、交易数或诊断;同公司重复上传的
  幂等摘要保持可用。
- 补充服务端回归测试,覆盖同公司与跨公司两个分支及随机密码;
  完整测试 85 项全绿,node --check 通过。
This commit is contained in:
腾讯WorkBuddy
2026-08-16 01:50:42 +08:00
parent 545837446c
commit 7f1a93f6a6
11 changed files with 155 additions and 58 deletions
+8 -2
View File
@@ -53,8 +53,13 @@ def verify_password(password: str, stored: str) -> bool:
return hmac.compare_digest(digest, expected)
def generate_initial_password() -> str:
"""Generate a 12-char initial password with upper, lower and digit chars."""
def generate_initial_password(exclude: str | None = None) -> str:
"""Generate a 12-char initial password with upper, lower and digit chars.
When ``exclude`` is given, the result is guaranteed to differ from it
(case-insensitive) so a fresh account never starts with a password equal
to its own username.
"""
alphabet = string.ascii_letters + string.digits
while True:
password = "".join(
@@ -64,6 +69,7 @@ def generate_initial_password() -> str:
any(char.isupper() for char in password)
and any(char.islower() for char in password)
and any(char.isdigit() for char in password)
and (exclude is None or password.lower() != exclude.lower())
):
return password