Securing PHP Sessions in Tsugi – A Small Fix with Cursor AI and CodeRabbit @ChuckSeverance
Securing PHP Sessions in Tsugi – A Small Fix with Cursor AI and CodeRabbit  @ChuckSeverance
Uploaded November 2026 | Updated November 2026, 8 hours ago
In this episode of AI Coding with Dr. Chuck, I take a look at a small security concern in Tsugi: making sure PHP session identifiers are only accepted from cookies when the application is using cookie-based sessions.

Tsugi supports both traditional cookie-based sessions and cookieless sessions for LTI integrations. These two approaches use different session names, and I want to make sure that requests cannot accidentally or deliberately introduce a cookie-based session identifier through GET or POST parameters.

I start with a security discussion using AI, inspect the early session initialization code, and make a small change to enforce the intended behavior.

Then CodeRabbit reviews the pull request and raises an interesting concern about potentially sensitive information appearing in our logs. Rather than introducing complicated redaction logic, we simplify the logging to record only the request path.

Topics include:

- PHP cookie-based and cookieless sessions
- Session fixation and session identifier handling
- PHP session.use_only_cookies configuration
- Filtering session identifiers from GET, POST, and REQUEST
- Early request initialization and security invariants
- Nonfatal logging of unexpected session parameters
- Reviewing security changes with Cursor AI
- Using CodeRabbit for independent code review
- Avoiding sensitive information in application logs
- Simplifying code instead of adding unnecessary complexity
- Using pull requests to review small but important security changes

This is a relatively small code change, but it touches the session initialization path used throughout the application. I want the code to be simple, predictable, and easy to review before putting it into production.

An interesting part of the process is that I don't necessarily agree with every recommendation from CodeRabbit. But the review encourages me to rethink the problem, and we end up with a simpler approach that provides the diagnostic information I actually need.

The goal of AI-assisted development isn't to accept every suggestion. It's to use these tools as collaborators while making deliberate engineering decisions.

Tsugi: tsugi.org
Python for Everybody: py4e.com

I'll be teaching Python for Everybody with AI beginning in January 2027. Visit py4e.com for more information.

#Tsugi #PHP #Security #CursorAI #CodeRabbit #AICoding
Securing PHP Sessions in Tsugi – A Small Fix with Cursor AI and CodeRabbitvideo lti 1 3 (Classic)Mid Ohio - John  Day 1 - 2026-04-11 - RacingShelby playing ball in Lake Michigan near Leeland.  #dogcation #aussie #spoliedpup #beachlifeShelby lunch at Cove in Fish Town Leeland MI #dogcation #aussie #spoiledpupCoding with AI: Small Fixes, Big Architecture — Tsugi Cleanup DayAI Master Programmer with Dr. Chuck: Sakai LTI Auto Release SAK-49972AI Coding (No Audio): LTI Allow Tools to use LTI Bearer Tokens to Access WebAPI - SAK-52581Title: Week 6 – Django Forms, Generic Views, and Database InteractionTsugi Plus Security: Fixing Session Leakage Between LMS LoginsDJ 04.01 Linux Shell Commands for Django Developers (18:27)When AI Moves Your Cheese 😤 | Cursor AI Meltdown & Recovery (Live Coding with Dr. Chuck)
Chuck Severance |

Securing PHP Sessions in Tsugi – A Small Fix with Cursor AI and CodeRabbit

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER