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
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










