Skip to content

fix(project): invalidate api key cache on deletion#328

Open
VarshithReddy2006 wants to merge 1 commit into
geturbackend:mainfrom
VarshithReddy2006:fix/project-cache-invalidation-322
Open

fix(project): invalidate api key cache on deletion#328
VarshithReddy2006 wants to merge 1 commit into
geturbackend:mainfrom
VarshithReddy2006:fix/project-cache-invalidation-322

Conversation

@VarshithReddy2006

Copy link
Copy Markdown
Contributor

Fixes #322

Summary

Invalidate Redis project caches when a project is deleted.

Changes

  • Added publishableKey and secretKey to the project lookup used by deleteProject().

  • Invalidated API-key cache entries after project deletion:

    • project:apikey:<publishableKey>
    • project:apikey:<secretKey>
  • Invalidated project cache:

    • project:id:<projectId>

Problem

The public API authorization flow checks Redis before MongoDB. When a project was deleted, Redis cache entries remained available until TTL expiry, allowing previously cached API keys to continue authorizing requests.

Result

Project deletion now immediately removes the associated Redis cache entries, ensuring deleted projects cannot continue authenticating through stale cached authorization data.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@VarshithReddy2006, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 41 minutes and 10 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 29b18d78-8f38-4541-8e13-a3b2a7608983

📥 Commits

Reviewing files that changed from the base of the PR and between fafceb5 and ebee2d5.

📒 Files selected for processing (1)
  • apps/dashboard-api/src/controllers/project.controller.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Deleted projects remain authorized via stale API-key cache entries until Redis TTL expiry

1 participant