Show "Last used: unavailable" for SSH keys when tracking is disabled

What does this MR do and why?

The feature flag :disable_ssh_key_used_tracking disables updating usage data for SSH keys. However the UI still attempts to use the last_used_at value even though it is incorrect, showing "Last used: never". This is misleading, with potential security impacts if relied upon for auditing or investigatory purposes.

This feature flag is enabled - i.e. tracking is disabled and the UI is currently incorrect - on GitLab.com.

There is an issue to begin tracking last_used_at again: Relax the updating of last_used_at of ssh keys ... (#324764 - closed)

This MR uses the feature flag to conditionally show "Last used: Unavailable" with a link to new documentation as an interim solution. When the feature flag is removed, the UI will automatically revert to showing last_used_at again.

Note that due to using the status of the feature flag there could be a small time period where the UX is incorrect again. Between disabling the feature flag and the next-time-of-use, the SSH key will show "Last used: Never" even if it was used 1 minute prior to the feature flag change.

Screenshots or screen recordings

last-used-unavailable

Old

Via SSH key list shows "Last used: Never", even whe... (#350211 - closed)

Screen_Shot_2022-01-12_at_3.50.30_PM

New

Screenshot_2023-01-30_at_6.05.38_PM

How to set up and validate locally

  1. Fire up GDK and sign in
  2. Go to the SSH keys page.
    1. Add an SSH key if you don't have one already.
    2. Optionally use that SSH key (or update last_used_at via the rails console)
  3. See that the "Last used" value is displayed
  4. In the rails console, enable the disable_ssh_key_used_tracking feature flag
  5. Refresh the page and see "Last used: Unavailable"

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Nick Malcolm

Merge request reports

Loading