Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/open_cups/session_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ class SessionState:

def __init__(self) -> None:
if "session_id" not in st.session_state:
st.session_state.session_id = str(uuid.uuid4())
existing = st.query_params.get("session_id")
st.session_state.session_id = existing or str(uuid.uuid4())
Comment on lines +15 to +16
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 issue (security): Using a raw query param as the session_id risks session fixation or ID spoofing.

Since session_id can be fully controlled via the URL, avoid treating it as an authoritative session identifier unless it’s strongly validated or protected. Either validate and constrain the value (e.g., format/length, signed token) or only use it to look up/attach to an existing server-side session instead of trusting an arbitrary ID from the query string.

st.query_params["session_id"] = st.session_state.session_id

@property
def session_id(self) -> str:
Expand Down
Loading