Support fetching tokens from an external command#469
Conversation
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
Note on integration test count updates (
|
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_commandin a section is now a hardConfigError. Previously the lower-precedence keys were silently ignored.jiraandconfluenceplugin docstrings to documenttoken_commandand the mutual-exclusion rule. Other plugins automatically gain the feature through the shareddid.base.get_tokenhelper.CLAUDE.mdwith repo guidance (Makefile commands, three-layer architecture, plugin conventions, unit vs. FMF tests).Test plan
pytest tests/unit/test_base.py::TestGetToken— 13/13 passing (5 new tests for the command source, mutual exclusion, 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