Add Revoke buttons to the PAT tab of the Group credentials inventory
What does this MR do?
This MR adds the ability to revoke personal access tokens (PATs) from within the managed group credentials inventory. The PATs shown are only those created from within a managed group. PATs created outside the group are only revokable by an admin on the instance-level.
This change is behind a feature flag for now.
Screenshots
Confirming that the admin revoke still works as expected
Group revoke in action
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
-
Separation of EE specific content
Availability and Testing
Testing this requires setting up SAML first and enabling the feature flags noted in the documentation. Thereafter, you should see the Security & Compliance > Credentials
menu option on your managed group.
To add new PAT tokens to your group, I would suggest the following:
- Connect to rails console in your terminal:
rails console
- Run the following commands:
FactoryBot.definition_file_paths = [Rails.root.join('ee', 'spec', 'factories')]
FactoryBot.find_definitions
group = Group.find(ADD_YOUR_MANAGED_GROUPS_ID)
user = FactoryBot.create(:user, :group_managed, managing_group: group)
FactoryBot.create(:personal_access_token, user: user)
- You should now see the PAT(s) in the credentials inventory but cannot revoke
- Back in the console run
Feature.enable(:revoke_managed_users_token, group)
- Refresh the credentials inventory and you should see the revoke button
- You can now try revoking the PAT(s)
😄
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers - [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team
Relates #214811 (closed)