Skip to content

Conversation

syndbg
Copy link

@syndbg syndbg commented Aug 12, 2025

Overview

This PR adds a new shell plugin for CockroachDB that enables secure credential management for the cockroach sql command. The plugin supports both local development (insecure mode) and production environments (secure TLS connections) through environment variable configuration.

Type of change

  • Created a new plugin
  • Improved an existing plugin
  • Fixed a bug in an existing plugin
  • Improved contributor utilities or experience

Related Issue(s)

  • Resolves: #
  • Relates: #

How To Test

tl;dr There's a demo. https://streamable.com/btqzp5. It goes from a clean DB credential creation, renaming fields to match the expected format, etc.

Apologies for the streamable link, but GitHub has a 10mb file size limit and the mp4 demo video was already 58 or so mb.

  1. Set up database credentials in 1Password with the following fields:

    • Host: localhost
    • Port: 26257
    • User: root
    • Database: defaultdb
    • insecure: 1 (for local development)
  2. Test with local CockroachDB instance:

    # Start CockroachDB in insecure mode
    cockroach start-single-node --insecure --listen-addr=localhost:26257
    
    # Test the plugin
    op run -- cockroach sql
  3. Test environment variable import:

    export COCKROACH_HOST=localhost
    export COCKROACH_PORT=26257
    export COCKROACH_USER=root
    export COCKROACH_INSECURE=1
    op plugin init cockroachdb
  4. Run plugin validation:

    go run cmd/contrib/main.go cockroachdb/validate

Changelog

The CockroachDB plugin enables authentication for the cockroach sql command using Touch ID and other unlock options with 1Password Shell Plugins.

Copy link
Contributor

⚠️ This PR contains unsigned commits. To get your PR merged, please sign those commits (git rebase --exec 'git commit -S --amend --no-edit -n' @{upstream}) and force push them to this branch (git push --force-with-lease).

If you're new to commit signing, there are different ways to set it up:

Sign commits with gpg

Follow the steps below to set up commit signing with gpg:

  1. Generate a GPG key
  2. Add the GPG key to your GitHub account
  3. Configure git to use your GPG key for commit signing
Sign commits with ssh-agent

Follow the steps below to set up commit signing with ssh-agent:

  1. Generate an SSH key and add it to ssh-agent
  2. Add the SSH key to your GitHub account
  3. Configure git to use your SSH key for commit signing
Sign commits with 1Password

You can also sign commits using 1Password, which lets you sign commits with biometrics without the signing key leaving the local 1Password process.

Learn how to use 1Password to sign your commits.

Watch the demo

@syndbg syndbg force-pushed the feat-add-cockroach-sql-support branch 2 times, most recently from 7bab77e to 6122e82 Compare August 12, 2025 23:12
Adds the ability to read Database Credentials and
 inject for `cockroach sql`.

Signed-off-by: Anton Antonov <[email protected]>
@syndbg syndbg force-pushed the feat-add-cockroach-sql-support branch from 6122e82 to 24adb36 Compare August 12, 2025 23:23
Copy link
Member

@Marton6 Marton6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you for your contribution

@syndbg
Copy link
Author

syndbg commented Aug 26, 2025

Neat-o. Perhaps 1 more reviewer. 👁️

@mrjones2014 if you have the time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants