Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/open_cups/session_state.py" line_range="15-16" />
<code_context>
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())
+ st.query_params["session_id"] = st.session_state.session_id
</code_context>
<issue_to_address>
**🚨 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.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| existing = st.query_params.get("session_id") | ||
| st.session_state.session_id = existing or str(uuid.uuid4()) |
There was a problem hiding this comment.
🚨 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.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #163 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 10 10
Lines 527 529 +2
=========================================
+ Hits 527 529 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cbachhuber
left a comment
There was a problem hiding this comment.
Thanks for investigating! Let's see if this fixes it
|
This fixes it for me! ❤️ tested on streamlit.com with iOS and Brave browser
Can you confirm, @BayerC? |
|
yes it works but now copy pasting the url link is buggy :/ |
|
@BayerC what exactly is buggy? Should we have a new issue for that? |
|
The problem is if xou copy paste the link to give it to a collegue or open a new tab, you will not be a news session since the session id is in the url sou two tabs are logged in as same user. Yes please create issue and test it by xouself |
|
Created #165 |

This will (hopefully) solve the issue.
The problem is we need to merge it to see if it works.
Also its maybe suboptimal to expose the session id ...
I would be open to better alternatives