Add secure keyring storage for Slack token#5
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>
|
@copilot remove the "-t" option, now we have something more secure. |
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Removed the 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.
Good stuff, see also:
- Anything you could simplify?
- Any funcs that could be private?
alexec
left a comment
There was a problem hiding this comment.
Please make my requested changes in the comments.
|
@copilot make the requested changes. |
…witch, update error message Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
…e global api var Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
All requested changes implemented:
Simplified code:
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 when reading from stdin, can we hide the typed password? |
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Implemented password hiding using golang.org/x/term. When running interactively in a terminal, the password is now hidden. Still supports piped input for automation. (commit pending) |
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Problem
The
SLACK_TOKENenvironment variable is visible in the process list (/proc/<pid>/environ), which poses a security risk in multi-user systems where other users can view running processes and their environment variables.Solution
This PR adds support for storing the Slack token securely in the system keyring using zalando/go-keyring, which provides cross-platform keyring access:
Changes
New
configureCommandA new
slack configurecommand allows users to store their token securely:The token is stored in the
slack-clikeyring service with the nameSLACK_TOKEN.Password Hiding: When running interactively in a terminal, the token input is hidden for security. The command automatically detects if it's running in a terminal or receiving piped input, supporting both interactive and automated use cases.
Helpful Instructions: The configure command now displays helpful instructions showing users where to obtain their Slack API token, including a direct link to https://api.slack.com/apps and step-by-step guidance on creating an app and copying the Bot User OAuth Token.
Token Retrieval Priority
The token is now retrieved in the following order:
SLACK_TOKENenvironment variable (highest priority)Note: The
-tflag has been removed to encourage use of the more secure keyring option while maintaining simplicity.Security Benefits
SLACK_TOKENusageExample Usage
Code Quality Improvements
sendMessage,configureToken)getToken()helper function for cleaner token retrievalapivariable for better encapsulationgolang.org/x/termfor secure interactive inputTesting
go vetpasses with no issuesDocumentation
Updated README.md with configuration instructions and security notes explaining why keyring storage is preferred over environment variables in multi-user systems.
> [!WARNING]
>
>
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.