Aias00 opened a new issue, #7725:
URL: https://github.com/apache/shenyu/issues/7725

   ## Current behavior
   `HeartbeatListener` caches each Admin login token for a hard-coded 24 hours. 
`sendHeartbeat` catches send errors and retries on the next tick, but never 
invalidates the cached token or requests a new login after authentication 
rejection. Admin token validity is configurable. With a shorter lifetime, or 
after token invalidation, every subsequent heartbeat can reuse the rejected 
token until cache expiry or process restart.
   
   Concrete test: obtain a token, configure a shorter Admin token lifetime or 
make the test Admin reject it, then observe multiple heartbeat ticks. Login 
succeeds initially, heartbeat is rejected, and the same cached token is 
repeatedly sent without reauthentication.
   
   ## Source evidence
   - [Token cache lifetime and 
loader](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-register-center/shenyu-register-client-beat/src/main/java/org/apache/shenyu/register/client/beat/HeartbeatListener.java#L87)
   - [Send/retry path without 
invalidation](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-register-center/shenyu-register-client-beat/src/main/java/org/apache/shenyu/register/client/beat/HeartbeatListener.java#L114)
   - [Heartbeat response 
validation](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/utils/RegisterUtils.java#L104)
   - [Configured expiry used when issuing 
tokens](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/JwtUtils.java#L99)
   
   Source-based finding; a controlled authentication-expiry regression has not 
yet been run. This is availability/recovery behavior, not an authentication 
bypass claim.
   
   ## Acceptance criteria
   - [ ] Refresh using actual expiry metadata where available and/or invalidate 
the affected Admin's cache entry after a reliably identified authentication 
rejection.
   - [ ] Preserve enough response/status information to distinguish auth 
rejection from network failures or unrelated server errors; do not relogin on 
every IOException.
   - [ ] Retry reauthentication with bounded work/backoff so invalid 
credentials do not create a login storm.
   - [ ] Test expiry/rejection, successful renewal, unavailable Admin, multiple 
independent Admin tokens and repeated invalid credentials without long sleeps.
   - [ ] The reporter resumes successful heartbeats without waiting 24 hours or 
restarting; failure at one Admin does not suppress the others.
   
   Related: #7696 fixes heartbeat instance type; #6608 covers periodic-task 
exception resilience. Neither handles cached credential rejection.
   


-- 
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]

Reply via email to