From 29a11a20a3be3a02e44efc1662ec8fa105676e3b Mon Sep 17 00:00:00 2001 From: Jio Castillo Date: Mon, 20 Oct 2025 12:20:11 -0700 Subject: [PATCH] Fix Credentials inventory revoked filter Changelog: fixed EE: true --- app/finders/personal_access_tokens_finder.rb | 2 +- ...ntials_inventory_personal_access_tokens_finder_spec.rb | 6 ++++-- spec/finders/personal_access_tokens_finder_spec.rb | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/finders/personal_access_tokens_finder.rb b/app/finders/personal_access_tokens_finder.rb index 57d5cd03f730fe..d11514aa64ead2 100644 --- a/app/finders/personal_access_tokens_finder.rb +++ b/app/finders/personal_access_tokens_finder.rb @@ -105,7 +105,7 @@ def by_state(tokens) def by_revoked_state(tokens) return tokens unless params.has_key?(:revoked) - params[:revoked] ? tokens.revoked : tokens.not_revoked + Gitlab::Utils.to_boolean(params[:revoked]) ? tokens.revoked : tokens.not_revoked end def by_created_before(tokens) diff --git a/ee/spec/finders/authn/credentials_inventory_personal_access_tokens_finder_spec.rb b/ee/spec/finders/authn/credentials_inventory_personal_access_tokens_finder_spec.rb index a3e807984ac05f..e54bb1b605daf5 100644 --- a/ee/spec/finders/authn/credentials_inventory_personal_access_tokens_finder_spec.rb +++ b/ee/spec/finders/authn/credentials_inventory_personal_access_tokens_finder_spec.rb @@ -35,8 +35,10 @@ describe 'by revoked state' do where(:by_revoked_state, :expected_tokens) do - true | [:revoked] - false | [:active, :expired] + true | [:revoked] + 'true' | [:revoked] + false | [:active, :expired] + 'false' | [:active, :expired] end with_them do diff --git a/spec/finders/personal_access_tokens_finder_spec.rb b/spec/finders/personal_access_tokens_finder_spec.rb index 2da1ed2d7df7b8..610171c27bdca3 100644 --- a/spec/finders/personal_access_tokens_finder_spec.rb +++ b/spec/finders/personal_access_tokens_finder_spec.rb @@ -227,9 +227,11 @@ describe 'by revoked state' do where(:by_revoked_state, :expected_tokens) do - nil | [:active, :active_other, :expired, :active_impersonation, :expired_impersonation, :bot, :with_group, :with_another_group] - true | [:revoked, :revoked_impersonation] - false | [:active, :active_other, :expired, :active_impersonation, :expired_impersonation, :bot, :with_group, :with_another_group] + nil | [:active, :active_other, :expired, :active_impersonation, :expired_impersonation, :bot, :with_group, :with_another_group] + true | [:revoked, :revoked_impersonation] + 'true' | [:revoked, :revoked_impersonation] + false | [:active, :active_other, :expired, :active_impersonation, :expired_impersonation, :bot, :with_group, :with_another_group] + 'false' | [:active, :active_other, :expired, :active_impersonation, :expired_impersonation, :bot, :with_group, :with_another_group] end with_them do -- GitLab