urBackend icon indicating copy to clipboard operation
urBackend copied to clipboard

[Security] verifyApiKey: cached project document includes sensitive fields — cache bypass exposes stale allowedDomains

Open Kirtan-pc opened this issue 5 months ago • 10 comments

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.

Kirtan-pc avatar Jun 07 '26 09:06 Kirtan-pc

Hi @yash-pouranik ,

I would like to work on this issue under GSSoC 2026.

Could you please assign this issue to me?

Thank you!

Kirtan-pc avatar Jun 07 '26 09:06 Kirtan-pc

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.

pushtikadia avatar Jun 09 '26 09:06 pushtikadia

I think some pr from @Kirtan-pc are pending So this can be taken by @pushtikadia If u are available do mention me.

yash-pouranik avatar Jun 11 '26 06:06 yash-pouranik

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.

Kirtan-pc avatar Jun 11 '26 13:06 Kirtan-pc

1 merge still pending.

yash-pouranik avatar Jun 11 '26 14:06 yash-pouranik

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!

anshul23102 avatar Jun 28 '26 17:06 anshul23102

@Kirtan-pc Wanna work on this??

yash-pouranik avatar Jun 28 '26 18:06 yash-pouranik

Hey @yash-pouranik, I would be grateful to work on this issue under gssoc 2026. Thank you!

Kirtan-pc avatar Jun 29 '26 05:06 Kirtan-pc

Start @Kirtan-pc

yash-pouranik avatar Jun 29 '26 07:06 yash-pouranik

done

Kirtan-pc avatar Jun 29 '26 09:06 Kirtan-pc