[Security] verifyApiKey: cached project document includes sensitive fields — cache bypass exposes stale allowedDomains
Description
In verifyApiKey.js the entire Project lean document is stored in Redis cache via setProjectByApiKeyCache. If an admin updates allowedDomains (CORS restriction) in the dashboard, the cache is never invalidated, so the old domain list is used for CORS checks until the cache expires. This means a removed domain continues to have API access for the entire cache TTL window — a security gap. The cache also stores jwtSecret in plaintext in Redis, which broadens the attack surface if Redis is compromised.
Steps to Reproduce
Set allowedDomains to ['https://trusted-site.com'] for a project. Make one API call — result is cached. In the dashboard, update allowedDomains to ['https://new-site.com']. Immediately call from https://trusted-site.com — it is still allowed (cache hit with old list).
Expected Behaviour
Updating allowedDomains in the dashboard should invalidate the per-project API key cache so the new CORS policy takes effect immediately, or the cache TTL should be documented and surfaced to users.
Actual Behaviour
Stale allowedDomains are served from cache after the project configuration is updated, allowing formerly-allowed origins to bypass the updated CORS policy.
Hi @yash-pouranik ,
I would like to work on this issue under GSSoC 2026.
Could you please assign this issue to me?
Thank you!
Hello maintainers! I am an active GSSoC'26 contributor and I would love to solve this issue.
I have strong experience with full-stack development and optimization, and I can implement a clean, production-ready fix for this. Please assign this issue to me so I can begin working on it immediately! Thanks.
I think some pr from @Kirtan-pc are pending So this can be taken by @pushtikadia If u are available do mention me.
Hey @yash-pouranik, no PR from my side are pending, I can only create a PR for the issues assigned to me and the issues that were assigned were solved and I created a PR for them. So from my side no PR are pending. Thank you.
1 merge still pending.
Hi! This issue appears to be unassigned. Would it be possible to assign it to me for GSSoC '26? I'm interested in working on this and would be happy to submit a PR once assigned.
Thank you!
@Kirtan-pc Wanna work on this??
Hey @yash-pouranik, I would be grateful to work on this issue under gssoc 2026. Thank you!
Start @Kirtan-pc
done