Skip to content
GitLab Next
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Menu
    Projects Groups Snippets
  • Get a free trial
  • Sign up
  • Login
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 43,166
    • Issues 43,166
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 1,397
    • Merge requests 1,397
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLabGitLab
  • Issues
  • #320970
Closed
Open
Created Feb 09, 2021 by Dan Jensen@djensenContributor

[SSH keys] Enforce SSH key expiration by default

Facts

  • Personal Access Tokens (PATs) have an optional expiration date. This expiration is enforced by default.
  • SSH keys have an optional expiration date. This expiration is NOT enforced by default.

Problem to solve

There are 2 problems with opposite expiration enforcement for PATs and SSK keys:

  1. UX: We don't want similar features behaving differently, and currently the only difference between PATs and SSH keys is whether expiration is enforced by default (see differences below).
  2. Security: More complexity in code and documentation tends to create more security problems.

Proposal

  • SSH key expiration should be enforced by default, the same as PAT expiration, starting in 14.0 (because breaking changes should be included in major releases).
  • Users with soon-expiring SSH keys should:
    • See a warning in the UI, the same as PAT expiration warnings.
    • Receive a notification email, the same as PAT notification emails.
  • The documentation should be updated:
    • "The expiration date is informational only, and does not prevent you from using the key."

Technical implementation

  • Add db migration to change default value for enforce_ssh_key_expiration from false to true
  • Updating default value will not change the value for existing instances. For existing database instances, add a data migration to update the column enforce_ssh_key_expiration to true

Differences between PATs and SSS keys

Differences ^ courtesy of @asubramanian1 in #299598 (comment 513436846)

Related feature history

Feature PAT SSH
Expiration date (Core) e5cf527f without enforcement (enforcement by default added later) #36243 (closed) without enforcement
Lifetime (Ultimate) #3649 (closed) #1007 (closed)
Enforcement (Ultimate) #214723 (closed) allows enforcement to be disabled #320970 (closed) will allow enforcement to be enabled

Related links

  • Discussion about this topic
  • Discussion about this topic
Edited Jun 03, 2021 by Dan Jensen
Assignee
Assign to
Time tracking