Add secure keyring-based token storage with simplified configuration#2
Add secure keyring-based token storage with simplified configuration#2
Conversation
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
…e consistent Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
alexec
left a comment
There was a problem hiding this comment.
Make the requested simplification. Also:
- Anything else that could be private?
- Anything that could be simpler?
|
@copilot make the requested changes. |
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Made all requested simplifications. Additional improvements:
(commit: will-be-added) Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@alexec Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
main.go
Outdated
| return fmt.Errorf("host is required") | ||
| } | ||
|
|
||
| fmt.Fprintf(os.Stderr, "Enter JIRA API token: ") |
There was a problem hiding this comment.
@copilot also print a line on how to get their personal access token. State it will be stored securely in the key-ring.
There was a problem hiding this comment.
Added helpful messages to the configure command. Now displays:
- URL to create personal access token for the specified host
- Message that token will be stored securely in the keyring
Example output:
$ echo "my-token" | jira configure example.atlassian.net
To create a personal access token, visit: https://example.atlassian.net/secure/ViewProfile.jspa?selectedTab=com.atlassian.pats.pats-plugin:jira-user-personal-access-tokens
The token will be stored securely in your system's keyring.
Enter JIRA API token: Configuration saved successfully for host: example.atlassian.net
(commit hash will be added)
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot make sure, if I have two different Jira hosts, the token is stored in a different place. |
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
The implementation already handles multiple Jira hosts correctly. Each host's token is stored separately in the keyring using the hostname as the key. How it works:
Example: # Configure host 1
$ echo "token1" | jira configure company1.atlassian.net
# Keyring: jira-cli["company1.atlassian.net"] = "token1"
# Configure host 2
$ echo "token2" | jira configure company2.atlassian.net
# Keyring: jira-cli["company2.atlassian.net"] = "token2"
# Use host 1
$ JIRA_HOST=company1.atlassian.net jira get-issue PROJ-1
# Loads token from keyring using key "company1.atlassian.net"
# Use host 2
$ JIRA_HOST=company2.atlassian.net jira get-issue PROJ-2
# Loads token from keyring using key "company2.atlassian.net"Each host maintains its own separate token in the keyring, so you can switch between hosts using the JIRA_HOST environment variable or by reconfiguring. |
|
@copilot when reading from stdin, can we hide the typed password? |
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Added password masking using Changes:
Example: Note: For automated/CI usage, environment variables still work: (commit hash will be added) |
Implements secure token storage using system keyring via zalando/go-keyring, replacing the insecure JIRA_TOKEN environment variable pattern. The implementation has been simplified through multiple rounds of feedback to provide a clean, minimal interface.
Changes Made
Core Features
jira configure <host>command: Securely accepts API token from stdin with helpful guidancegolang.org/x/termfor enhanced security~/.config/jira-cli/config.jsonwith 0600 permissionsAuthentication Flow
Host Resolution:
~/.config/jira-cli/config.json)JIRA_HOSTenvironment variable (fallback)Token Resolution:
JIRA_TOKENenvironment variable (quick override)Code Improvements
os.UserConfigDir()for proper config directory resolutionUser Experience
Security Benefits
✅ Token stored in OS-managed keyring (encrypted storage)
✅ Token not visible in process list
✅ Token not visible on screen during input (password masking)
✅ Config file has restrictive permissions (0600)
✅ Token read from stdin (secure input method)
✅ No command-line flags for credentials (prevents accidental exposure)
✅ Multi-host support with separate keyring entries per host
✅ Environment variables supported for backward compatibility
Testing
The implementation provides a clean, secure interface for JIRA authentication while maintaining backward compatibility with environment variables for CI/CD and legacy workflows. Password masking ensures tokens are never visible during interactive configuration, and multi-host support allows managing multiple JIRA instances with separate credentials.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.