Skip to content

fix(pkg/cache/memorycache): evict expired entries on TTLCache.Get - #7398

Open
Norway-02 wants to merge 1 commit into
pipe-cd:masterfrom
Norway-02:fix/ttl-cache-lazy-eviction
Open

Norway-02 wants to merge 1 commit into
pipe-cd:masterfrom
Norway-02:fix/ttl-cache-lazy-eviction

Conversation

@Norway-02

Copy link
Copy Markdown

What this PR does:
Checks item expiration in TTLCache.Get() and evicts expired entries as cache misses (cache.ErrNotFound), instead of solely relying on the background evicter ticker.

Why we need it:
Previously, TTLCache.Get() did not verify whether an entry's expiration time had passed. If an entry expired between background eviction ticks (or if the cache was instantiated with evictionInterval <= 0), Get() would return the expired item as a valid cache hit. In security-sensitive components like encryptionKeyCache, apiKeyCache, and rbacCache, serving expired cache hits can result in stale encryption keys or outdated authorization state.

Which issue(s) this PR fixes:
Fixes # NONE

Does this PR introduce a user-facing change?:

  • How are users affected by this change: None
  • Is this breaking change: No
  • How to migrate (if breaking change): N/A

Screenshots/Videos (for documentation or website changes):
N/A

Signed-off-by: Norway-02 <anshulkhetade02@gmail.com>
Copilot AI lite review requested due to automatic review settings September 20, 2026 04:29
@Norway-02
Norway-02 requested a review from a team as a code owner September 20, 2026 04:29
@Norway-02

Copy link
Copy Markdown
Author

cc @mohammedfirdouss @Warashi @armistcxy - Please review when you get a chance. Thanks!

@netlify

netlify Bot commented Sep 20, 2026

Copy link
Copy Markdown

Deploy Preview for pipecd-site ready!

Name Link
🔨 Latest commit 0772f6e
🔍 Latest deploy log https://app.netlify.com/projects/pipecd-site/deploys/6aaf610f76ea620008b957d4
😎 Deploy Preview https://deploy-preview-7398--pipecd-site.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants