Skip to content

Releases: taicode-labs/auth-sdk

1.0.9

Choose a tag to compare

@yinxulai yinxulai released this 15 Oct 08:07

安全修复

本次发布修正两个会导致鉴权失效/被绕过的缺陷,建议所有消费方尽快升级。

1. isApiKey 前缀不匹配

原实现使用 'API-KEY-'(大写 + 连字符),而 account 实际签发的 API Key 格式为 apikey-{32位随机字符}(小写、无连字符)。

后果:isApiKey 对真实 API Key 恒返回 false,导致 verifyToken / parseToken 中针对 API Key 的提前返回退化为死代码。

现已提取为 API_KEY_PREFIX 常量并修正为 'apikey-'。

2. verifyToken 签名比较取反

recreatedSignString !== signString 应为 ===。

后果:签名校验完全失效——任意 token 只要格式合法(三段、未过期、secretKey 已知)即可通过校验,而签名一致的正常 token 反而会被拒绝。

回归测试

原有用例全部使用「已过期」token,断言结果恒为 false,无法区分「签名错误」与「已过期」,因此该缺陷长期未被发现。本次新增未过期正向用例,以及签名篡改 / 载荷篡改 / secretValue 不匹配 / secretKey 不匹配 / 已过期等反向用例。

CI

发布工作流改用 NPM Trusted Publishing(OIDC),不再依赖 NPM_TOKEN,并为发布产物附带 sigstore provenance。

破坏性变更

⚠️ 修正后签名校验会真正生效。若消费方依赖了旧的失效行为(例如未正确传递 secretValue),升级后将开始拒绝请求。请确保 secretValue 正确传递。

消费方注意

  • account 的 helpers/gateway/gateway.ts 中调用 verifyToken 时缺少 await,而该函数是 Promise<boolean>,因此 isValid 恒为真值 Promise,校验结果不会被使用。仅升级 SDK 不足以让该校验生效,account 侧需一并修复。
  • 其他消费方(expense / release / observai)仅使用 signToken,不受影响。

1.0.8

Choose a tag to compare

@yinxulai yinxulai released this 13 Feb 16:03

Full Changelog: 1.0.7...1.0.8

1.0.7

Choose a tag to compare

@yinxulai yinxulai released this 13 Feb 15:55

Full Changelog: 1.0.6...1.0.7

1.0.6

Choose a tag to compare

@yinxulai yinxulai released this 28 Nov 03:54

Full Changelog: 1.0.5...1.0.6

1.0.5

Choose a tag to compare

@yinxulai yinxulai released this 27 Nov 05:58

Full Changelog: 1.0.4...1.0.5

1.0.4

Choose a tag to compare

@yinxulai yinxulai released this 27 Nov 05:37

Full Changelog: 1.0.3...1.0.4

1.0.3

Choose a tag to compare

@yinxulai yinxulai released this 27 Nov 05:25

Full Changelog: 1.0.1...1.0.3

1.0.2

Choose a tag to compare

@yinxulai yinxulai released this 27 Nov 04:55

Full Changelog: 1.0.1...1.0.2

1.0.1

Choose a tag to compare

@yinxulai yinxulai released this 27 Nov 03:03

Full Changelog: 1.0.0...1.0.1

1.0.0

Choose a tag to compare

@yinxulai yinxulai released this 26 Nov 15:59