Support fetching tokens from an external command - #469
Conversation
Note on integration test count updates (
|
|
@ammachado, thanks for looking into the test issues. Yes, it really seems that some of the expected issues are not included in the search results anymore. Interestingly, for pull requests your changes seem not needed anymore. Something weird is happening on the GitHub side. Here's a slightly modified version of your adjustments: |
psss
left a comment
There was a problem hiding this comment.
Thanks much for implementing this! Looks good, just two minor comments. Also the following statement from the pull request description is not valid, right?
- Breaking change: setting more than one of
token,token_file,token_commandin a section is now a hardConfigError. Previously the lower-precedence keys were silently ignored.
…re widely - Remove CLAUDE.md from this branch per review request; the repo guidance content is fine but belongs in its own PR. - Document token_command (alongside token/token_file) in the github and gitlab plugin docstrings, matching the jira/confluence notes.
…re widely - Remove CLAUDE.md from this branch per review request; the repo guidance content is fine but belongs in its own PR. - Document token_command (alongside token/token_file) in the github and gitlab plugin docstrings, matching the jira/confluence notes.
Add `token_command` as a third token source alongside `token` and `token_file`, so secrets can be pulled from password managers such as BitWarden (`bw get password ...`) or 1Password (`op read op://...`). The command is parsed with shlex (no shell) and its stdout is used as the token; failures raise `ConfigError`. Results are memoized per process so multiple sections sharing a command only invoke the tool once. Setting more than one of `token`, `token_file`, `token_command` is now a hard `ConfigError` (previously the lower-precedence keys were silently ignored). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Fix terminal color reset sequence (\033[1;m -> \033[0m) so background color does not bleed into subsequent output - Extract the human-readable 'message' field from GitHub API JSON error responses instead of printing the raw JSON blob - Drop the Future object reference from ReportError log lines so only the error text is shown Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Mirror the dependency list from the mypy hook so pylint can resolve all project imports, substituting requests/python-dateutil for their type-stub equivalents. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Adriano Machado <60320+ammachado@users.noreply.github.com>
Update expected ANSI escape sequences from \033[1;m to \033[0m following the fix in cbef398. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED
…re widely - Remove CLAUDE.md from this branch per review request; the repo guidance content is fine but belongs in its own PR. - Document token_command (alongside token/token_file) in the github and gitlab plugin docstrings, matching the jira/confluence notes.
Summary
token_commandas a third token source alongsidetoken/token_file, so plugins can pull secrets from password managers such as BitWarden (bw get password did-jira) or 1Password (op read op://Personal/Jira/token). The command is parsed withshlex(no shell) and its stripped stdout is used as the token; failures raiseConfigError. Results are memoized per process viafunctools.lru_cacheso multiple config sections sharing a command only invoke the external tool once.token,token_file,token_commandis set in a section:token>token_file>token_command, matching the existingtokenvs.token_fileprecedence — lower-precedence keys are silently ignored, same as before.jira,confluence,github, andgitlabplugin docstrings to documenttoken_commandand the precedence rule. Other plugins automatically gain the feature through the shareddid.base.get_tokenhelper.Test plan
pytest tests/unit/test_base.py::TestGetToken— 13/13 passing (5 new tests for the command source, precedence, failure modes, and memoization)pytest tests/unit -n autoclean except for pre-existing failures unrelated to token handling (nitrate/psycopg2build needspg_configlocally; oneredminelive-data test).[all]installedtoken_command = printf %s ...and confirm the report runs🤖 Generated with Claude Code