Repository navigation
Fix #21131: Reject non-string tokens in yii\web\User::loginByAccessToken() before the identity lookup, hardening against type-juggling - #21131
Conversation
Signed-off-by: Guido Pannenbecker <info@sd-gp.de>
Reviewer's GuideHardens Sequence diagram for token type validation in User::loginByAccessTokensequenceDiagram
participant Caller
participant User
participant Identity
Caller->>User: loginByAccessToken(token, type)
alt token is not a string
User-->>Caller: null
else token is a string
User->>Identity: findIdentityByAccessToken(token, type)
Identity-->>User: identity or null
User-->>Caller: identity or null
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. Summary
Change: Bug fix Merge Risk:
|
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. Non-string token callers now fail authentication before the identity class can interpret their values, which could deny login to integrations that previously relied on that behavior. Reverting restores the prior behavior, and the change does not persist data or grant access.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #21131 +/- ##
============================================
- Coverage 81.88% 81.88% -0.01%
- Complexity 11598 11599 +1
============================================
Files 374 374
Lines 30376 30378 +2
============================================
Hits 24874 24874
- Misses 5502 5504 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@took looks great. Would you please add a line for CHANGELOG? Thanks. |
Signed-off-by: Guido Pannenbecker <info@sd-gp.de>
Signed-off-by: Guido Pannenbecker <info@sd-gp.de>
Sourcery withdrew this approval because the latest commits introduced blocking findings.
Sourcery withdrew this approval because the latest commits introduced blocking findings.
yii\web\User::loginByAccessToken() before the identity lookup, hardening against type-juggling
|
👍 |
* Fix #21072: Use the full 64-bit keyspace for PostgreSQL advisory lock keys in `PgsqlMutex` * Fix #21073: Fix `MultipartFormDataParser` boundary extraction when `Content-Type` has additional parameters * Restore `session.use_strict_mode` after session tests. (#21133) * Fix #21074: Fix Gettext PO file escaping of backslashes and parsing of escaped quotes * Fix PHPStan level 4 errors in tests (#21135) - Fix `@return` annotation for `yii\db\Command::getSql()` - Fix `@property` annotation for `yii\db\Command::$sql` - Fix `@return` annotations for `cssStyleFromArray()` and `getAttributeValue()` in `yii\helpers\BaseHtml` - Fix `@return` annotations for `format()` and `asRaw()` in `yii\i18n\Formatter` - Fix `@return` annotation for `yii\web\HeaderCollection::get()` - Fix `@return` annotations for `getInstance()`, `getInstanceByName()`, `getInstances()` and `getInstancesByName()` in `yii\web\UploadedFile` - Add `@throws` annotation for `InvalidConfigException` in `yii\db\Connection::open()` - Add `@phpstan-impure` annotations for `yii\db\Connection::open()`, `save()` and `link()` in `yii\db\BaseActiveRecord`, `yii\web\AssetBundle::register()`, `yii\test\ArrayFixture::load()`, `yii\filters\RateLimiter::beforeAction()`, `validateAttribute()` and `validateAttributes()` in `yii\validators\Validator` * Verify the rollback that testTransactionShortcutException never checked (#21134) * Fix #21131: Reject non-string tokens in `yii\web\User::loginByAccessToken()` before the identity lookup, hardening against type-juggling Signed-off-by: Guido Pannenbecker <info@sd-gp.de> * Update PHPStan level from 3 to 4 (#21136) - Fix `@var` annotation for `yii\base\ErrorHandler::$_hhvmException` (mspirkov) - Fix `@return` annotation for `yii\base\Theme::getBasePath()` (mspirkov) - Separate the `@property` annotations for `yii\base\Theme::$basePath` (mspirkov) - Fix `@var` annotation for `yii\caching\DbQueryDependency::$db` (mspirkov) - Fix `@var` annotation for `yii\data\ArrayDataProvider::$allModels` (mspirkov) - Fix `@var` annotation for `yii\db\ActiveQueryTrait::$asArray` (mspirkov) - Fix `@var` annotation for `yii\db\ActiveRelationTrait::$primaryModel` (mspirkov) - Fix `@param` annotation for `$models` in `yii\db\ActiveRelationTrait::populateInverseRelation()` (mspirkov) - Fix `@param` and `@return` annotations for `yii\db\QueryTrait::filterCondition()` (mspirkov) - Fix `@param` annotations for `$content` in `isOperator()`, `isIdentifier()`, `isStringLiteral()` and `isKeyword()` of `yii\db\SqlTokenizer` (mspirkov) - Fix `@param` annotation for `$columns` in `yii\db\conditions\InConditionBuilder::buildSubqueryInCondition()` (mspirkov) - Fix `@param` and `@return` annotations for `yii\di\Container::normalizeDefinition()` (mspirkov) - Fix `@var` annotation for `yii\filters\AccessRule::$matchCallback` (mspirkov) - Fix `@var` annotation for `yii\filters\ContentNegotiator::$request` (mspirkov) - Fix `@var` annotation for `yii\filters\auth\CompositeAuth::$authMethods` (mspirkov) - Fix `@var` annotation for `yii\grid\GridView::$filterSelector` (mspirkov) - Fix `@param` annotations for `$models` in `errorSummary()` and `collectErrors()` of `yii\helpers\BaseConsole`, `yii\helpers\BaseHtml` and `yii\helpers\BaseJson`, and in `yii\widgets\ActiveForm::errorSummary()` (mspirkov) - Fix `@var` annotation for `yii\helpers\BaseUrl::$urlManager` (mspirkov) - Fix `@var` annotation for `yii\log\Logger::$dispatcher` (mspirkov) - Fix `@var` annotation for `yii\rest\IndexAction::$prepareSearchQuery` (mspirkov) - Fix `@var` annotation for `yii\web\Cookie::$sameSite` (mspirkov) - Fix inline `@var` annotations in `yii\db\ActiveRelationTrait::findJunctionRows()`, `refresh()` and `refreshTableSchema()` in `yii\db\Schema`, and `yii\log\Target::getMessagePrefix()` (mspirkov) - Add `@throws` annotation for `UrlNormalizerRedirectException` in `yii\web\Request::resolve()` (mspirkov) - Add `@phpstan-impure` annotations for `yii\base\Component::attachBehavior()`, `yii\base\Model::clearErrors()`, `yii\data\DataFilter::setSearchModel()`, `yii\db\Command::addCheck()`, `yii\db\Connection::close()`, `yii\db\Schema::getTableSchema()`, `getTablePrimaryKey()` and `getTableChecks()` in `yii\db\ConstraintFinderInterface` and `yii\db\ConstraintFinderTrait`, `yii\validators\Validator::validate()`, `yii\web\CompositeUrlRule::iterateRules()` and `yii\web\User::setIdentity()` (mspirkov) * Fix PHPStan errors (#21139) * Fix dead php.net intl and OPcache links in the guide (#21140) * Bump `phpstan/phpstan` to `2.3.7` (#21142) * Allow the `__class` key in configuration arrays in `@return` annotations (#21141) * Fix #21147: Add `@template` annotation for `$default` in `yii\web\HeaderCollection::get()` * Update workflow configurations to support PHP `8.6` and adjust dependencies. (#21148) * Update dependencies in `composer.lock` to latest versions. * Add overrides for `glob` and `minimatch` in `package.json`. * Update PHP version to `8.6` and add `ignore-platform-reqs` for CI workflows. --------- Signed-off-by: Guido Pannenbecker <info@sd-gp.de> Co-authored-by: Ilia Alshanetsky <ilia@ilia.ws> Co-authored-by: Maksim Spirkov <63721828+mspirkov@users.noreply.github.com> Co-authored-by: Dylan Pulver <35541198+dylanpulver@users.noreply.github.com> Co-authored-by: took <info@sd-gp.de> Co-authored-by: Faris Basha TM <72191505+farisbasha@users.noreply.github.com>
Summary by Sourcery
Harden access-token authentication by rejecting non-string tokens before identity lookup.
Enhancements:
Tests: