Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix ComponentVerifyTicket Redis cache expiration from infinite to 12 hours #3719

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
Copilot wants to merge 2 commits into develop
base: develop
Choose a base branch
Loading
from copilot/fix-a6cbd907-f63d-4174-8724-033ff05eed1d

Conversation

Copy link
Contributor

@Copilot Copilot AI commented Sep 24, 2025
edited
Loading

Issue

The ComponentVerifyTicket in Redis-based configuration storage classes was being cached with Integer.MAX_VALUE expiration time (essentially infinite), which contradicts WeChat's official documentation stating that component_verify_ticket has a validity period of 12 hours.

This could lead to:

  • Stale tickets being used beyond their valid lifetime
  • Potential authentication failures when WeChat invalidates tickets server-side
  • Poor cache management and memory usage

Solution

Updated the expiration time in setComponentVerifyTicket() method from Integer.MAX_VALUE to 43200 seconds (12 hours) across all Redis-based configuration storage implementations:

Before:

redisOps.setValue(this.componentVerifyTicketKey, componentVerifyTicket, Integer.MAX_VALUE, TimeUnit.SECONDS);

After:

redisOps.setValue(this.componentVerifyTicketKey, componentVerifyTicket, 43200, TimeUnit.SECONDS);

Files Changed

  • WxOpenInRedissonConfigStorage.java
  • WxOpenInRedisConfigStorage.java
  • WxOpenInRedisTemplateConfigStorage.java
  • Added verification tests in corresponding test files

References

Testing

  • ✅ All existing tests pass
  • ✅ Added new tests to verify ComponentVerifyTicket functionality
  • ✅ Full build and checkstyle validation successful
  • ✅ Changes are backward compatible

This change aligns the cache behavior with WeChat's official specifications and ensures proper token lifecycle management.

Fixes #3683


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

...hours
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
@Copilot Copilot AI changed the title (削除) [WIP] 4.7.0 版本 WxOpenInRedissonConfigStorage,ComponentVerifyTicket 缓存失效时间是 Integer.MAX_VALUE (削除ここまで) (追記) Fix ComponentVerifyTicket Redis cache expiration from infinite to 12 hours (追記ここまで) Sep 24, 2025
Copilot finished work on behalf of binarywang September 24, 2025 14:01
@binarywang binarywang added this to the 4.7.9 milestone Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@binarywang binarywang Awaiting requested review from binarywang

Labels
None yet
Projects
None yet
Milestone
4.7.9
Development

Successfully merging this pull request may close these issues.

4.7.0 版本 WxOpenInRedissonConfigStorage,ComponentVerifyTicket 缓存失效时间是 Integer.MAX_VALUE

AltStyle によって変換されたページ (->オリジナル) /