open-telemetry / open-telemetry/opentelemetry-python-contrib

Flask vulnerable to possible disclosure of permanent session cookie due to missing Vary: Cookie header

Open
#2,401 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Flask session-refresh behavior described in the issue and identify the repository's Flask instrumentation entry point, if applicable. Check whether the affected scenario is covered by existing tests; done means the missing Vary: Cookie behavior is addressed for permanent-session refreshes without session access, with a regression test demonstrating it.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
backend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.