Security: Implement strict Cache-Control directives (Fix CWE-525)#805
Conversation
Summary of ChangesHello @lnovitz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request implements strict Cache-Control directives across both the frontend and backend to address the CWE-525 vulnerability (Insufficient Caching of Sensitive Information). The changes prevent sensitive user data from being stored in browser or intermediate proxy caches by enforcing no-store policies by default, while carefully whitelisting public, non-sensitive pages for limited caching. Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the CWE-525 vulnerability by implementing strict Cache-Control headers to prevent sensitive information from being cached. The changes in both the backend and frontend adopt a secure-by-default approach, setting no-store for all API responses and dynamic pages, while correctly whitelisting public static pages for caching. My feedback includes a minor suggestion to simplify the Cache-Control value by removing a redundant directive, which will improve clarity and maintainability.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…ob-app/jobseeker-analytics into casa-tier-2-remediation
Pull Request
Description
This PR addresses vulnerability CWE-525 (Insufficient Caching of Sensitive Information) by implementing strict Cache-Control headers across both the frontend and backend. The previous configuration lacked the no-store directive, which could allow sensitive user data (such as job application details on the dashboard) to be stored in browser or intermediate proxy caches.
Type of Change
Changes Made
frontend/next.config.jsto set the default Cache-Control tono-store, no-cache, must-revalidate, proxy-revalidatefor all routes. This ensures that any page not explicitly whitelisted for caching will never be stored on disk.next.config.jsto explicitly allow 1-hour public caching for non-sensitive pages like/login, /faq, and /pricing, while keeping them isolated from sensitive dashboard routes.SecurityHeadersMiddlewareinbackend/main.pyto inject strict no-store headers into all API responses. This prevents user-specific data from being cached by CDNs or corporate proxies.Pragma: no-cacheandExpires: 0headers to both frontend and backend for maximum compatibility with older browsers.Testing
API Changes
Added strict Cache-Control, Pragma, and Expires headers to all outgoing responses via SecurityHeadersMiddleware in main.py.
By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.