nagisa-kunhah commented on PR #1600:
URL: https://github.com/apache/dubbo-admin/pull/1600#issuecomment-6381740601

   > ## 需要修(P1)
   > 
   > **未知 `kid` 会为每个请求发起一次出站 HTTP,且没有冷却窗口。** 
`ai/component/server/engine/auth.go:105-125`:
   > 
   > ```go
   > v.mu.RLock()
   > key := v.keys[kid]
   > v.mu.RUnlock()
   > if key != nil { return key, nil }
   > if err := v.refresh(context.Background()); err != nil {   // ← 缓存未命中就远程取
   >     return nil, err
   > }
   > ```
   > 
   > `kid` 来自**未验证**的 JWT header(`token.Header["kid"]`,此时签名尚未校验)。任何人都可以构造 
`{"alg":"RS256","kid":"<随机串>"}` 的 token 打 `POST /api/v1/ai/chat/stream`,服务端就会向 
Admin 的 JWKS 端点发一次 GET。放大比 
1:1,既没有单飞(singleflight)合并、也没有最小重取间隔,`context.Background()` 
还让这次调用脱离了请求的取消与截止时间(只有 `NewJWKSClient` 里的 10s 超时兜底)。
   
   fix,增加了ttl机制,并发请求通过notify机制避免缓存击穿风险。
   与1609的冲突服从社区安排。


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to