Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 11, 2025

AuthenticationFilter allowed stale sessions (valid session ID but deleted user record) to bypass authentication, exposing protected routes without a user principal.

Changes

  • Check user() first instead of check() to ensure user record exists
  • Redirect on null user (handles both missing sessions and stale sessions)
  • Remove redundant null check after redirect gate
// Before: check() returns true for stale sessions
if( !$this->_authManager->check() )
{
    // redirect...
}
$user = $this->_authManager->user(); // May be null after logout
if( $user ) { /* set registry */ }   // Request continues without user!

// After: user() clears stale sessions and returns null
$user = $this->_authManager->user();
if( !$user )
{
    // redirect...
}
// User guaranteed non-null here
Registry::getInstance()->set( 'Auth.User', $user );

AuthManager::user() clears stale sessions via logout() when user record is missing, ensuring protected routes only execute with valid user objects.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 11, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: ljonesfl <1099983+ljonesfl@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP address feedback from review on service architecture feature PR Fix stale session bypass in AuthenticationFilter Nov 11, 2025
Copilot AI requested a review from ljonesfl November 11, 2025 03:13
Copilot finished work on behalf of ljonesfl November 11, 2025 03:13
@ljonesfl ljonesfl marked this pull request as ready for review November 11, 2025 03:17
@ljonesfl ljonesfl merged commit 7d263d7 into feature/service-architecture Nov 11, 2025
2 checks passed
@ljonesfl ljonesfl deleted the copilot/sub-pr-6 branch November 11, 2025 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants