informa

Tech News and Analysis

3 MIN READ
DR Technology

How to Use SSH Keys and 1Password to Sign Git Commits

This Tech Tip walks through the steps to set up signed commits with SSH keys stored in 1Password.

1Password is making it easier for GitHub users to set up signed commits using SSH keys. Signed commits verify that the person making the code change is who they say they are.

When code is checked into a git repository, the change is usually saved with the name of the person submitting the code. While the committer's name is typically set by the user's client, it can be easily changed to anything else, which makes it possible for someone to spoof the commit messages and names. This can have security implications if developers don't actually know who submitted a particular piece of code.

The fundamental, unsolved problem underlying all of the cybersecurity problems on the Internet is the lack of good tools to truly authentic a live human being, says John Bambenek, principal threat hunter at Netenrich. Making cryptographic signing, or signed commits, easy allows organizations to have a higher level of assurance about the person's identity.

"Without this, you are trusting the committer is who they say they are, and the person accepting the commit understands and reviews the commit for problems," he adds.

Bambenek notes that because criminals are going after code in open source libraries in earnest, being able to truly authenticate people pushing code means the window to using their repositories to compromise other organizations is much smaller.

Easier, Scalable Key Management

Michael Skelton, senior director of security operations at Bugcrowd, points out that managing SSH and GPG keys for signing commits over multiple developer virtual and host machines can be a cumbersome and confusing process. Previously, developers interested in signed commits managed with key pairs stored them in their GitHub accounts and on their local machines.

"This can make mass adoption of signed commits difficult, impairing the ability for your organization to make the most out of this feature," he says. "By having 1Password manage this on your behalf, you can more easily deploy these keys and update configurations hassle-free."

Because 1Password stores the SSH keys, it becomes easier, and less confusing, to manage keys over multiple devices. This feature also makes it possible to manage GitHub signing keys for developers in a more scalable fashion, Skelton says.

"By solving this problem, organizations can then look to enforce signed commits over their repositories using GitHub's vigilant mode, helping to limit the ability for committer names to be misrepresented and in turn misinterpreted," Skelton says.

With signed commits, it is easier to see when a commit has not been signed. It's also possible to create an application security policy that rejects unsigned commits.

How to Set Up Signed Commits

Here's how to set up GitHub to use SSH keys for verification.

  1. Update to Git 2.34.0 or later, then go to https://github.com/settings/keys and select "new SSH key," followed by selecting "Signing Key."
  2. From there, navigate to the "Key" box and select the 1Password logo, select "Create SSH Key," fill in a title, and then select "Create and Fill."
  3. For the last step, select "Add SSH Key," and the GitHub part of the process is complete.

Once the key is set up in GitHub, proceed to 1Password on your desktop to configure your .gitconfig file to sign with their SSH key.

  1. Select the "Configure" option in the banner displayed on top, where a window will open with a snippet you can add to the .gitconfig file.
  2. Select the "Edit Automatically" option to have 1Password update the .gitconfig file with one click.
  3. Users in need of more advanced configuration can copy the snippet and do things manually.

A green verification badge for easy verification visibility will then be added to the timeline when you push to GitHub.

Editors' Choice
Robert Lemos, Contributing Writer, Dark Reading
Robert Lemos, Contributing Writer, Dark Reading
Dark Reading Staff, Dark Reading
Jai Vijayan, Contributing Writer, Dark Reading