Skip to content

fix(deps): Flask app is run in debug mode vulnerable to possible disclosure of permanent session cookie due to missing Vary: Cookie header #1751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: v2.x
Choose a base branch
from

Conversation

ptrgits
Copy link

@ptrgits ptrgits commented Aug 14, 2025

When all of the following conditions are met, a response containing data intended for one client may be cached and subsequently sent by a proxy to other clients. If the proxy also caches Set-Cookie headers, it may send one client's session cookie to other clients. The severity depends on the application's use of the session, and the proxy's behavior regarding cookies. The risk depends on all these conditions being met.

  • The application must be hosted behind a caching proxy that does not strip cookies or ignore responses with cookies.
  • The application sets session.permanent = True.
  • The application does not access or modify the session at any point during a request.
    SESSION_REFRESH_EACH_REQUEST is enabled (the default).
  • The application does not set a Cache-Control header to indicate that a page is private or should not be cached.
  • This happens because vulnerable versions of Flask only set the Vary: Cookie header when the session is accessed or modified, not when it is refreshed (re-sent to update the expiration) without being accessed or modified.

and fix the problem, we should ensure that the Flask app cannot be run in debug mode, regardless of how the init function is called. The best way to do this is to remove the debug argument from the init function and always run the app with debug=False. This change should be made in the .evergreen/ocsp/mock_ocsp_responder.py file, specifically in the init function definition and the call to app.run. No additional imports or definitions are needed.

References

CVE-2023-30861
Flask Quickstart Documentation: Debug Mode
Werkzeug Documentation: Debugging Applications

…losure of permanent session cookie due to missing Vary: Cookie header
@Copilot Copilot AI review requested due to automatic review settings August 14, 2025 14:02
@ptrgits ptrgits requested a review from a team as a code owner August 14, 2025 14:03
@ptrgits ptrgits requested a review from paulinevos August 14, 2025 14:03
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a security vulnerability (CVE-2023-30861) in the Flask OCSP mock responder by removing the ability to run the application in debug mode and upgrading Flask to a patched version.

  • Removes the debug parameter from the init function to prevent debug mode execution
  • Updates Flask from version 1.1.1 to 2.2.5 to include the security fix for the Vary: Cookie header issue
  • Ensures the Flask app always runs with debug=False regardless of how it's initialized

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.evergreen/ocsp/mock_ocsp_responder.py Removes debug parameter and hardcodes debug=False in app.run()
.evergreen/ocsp/mock-ocsp-responder-requirements.txt Updates Flask version from 1.1.1 to 2.2.5

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.

2 participants