Skip to content

fix(describegpt): redact --api-key and --ckan-token from the attribution - #4766

Merged
jqnatividad merged 2 commits into
masterfrom
describegpt-redact-api-key
Oct 8, 2026
Merged

jqnatividad merged 2 commits into
masterfrom
describegpt-redact-api-key

Conversation

@jqnatividad

Copy link
Copy Markdown
Collaborator

describegpt's attribution includes a Command line: entry copied from argv, and that attribution goes into every data dictionary, description and tag set it generates. Those files are meant to be shared, so a key passed on --api-key leaked into them. Verikan had to add its own redaction for this (dathere/Verikan#18 moves its key to QSV_LLM_APIKEY).

normalize_command_line now replaces the values of -k/--api-key and --ckan-token with [REDACTED]. It covers every spelling qsv's docopt accepts:

  • --api-key KEY and --api-key=KEY
  • stuck and clustered short options: -kKEY, -Ak KEY, -qAkKEY. I checked that qsv's docopt accepts these, e.g. slice -nl1.
  • Abbreviated long options (--api) don't need handling, because qsv's docopt rejects them ("Unknown flag").

Values of other options are left verbatim, even if they contain a k (-mkimi-k2 is model kimi-k2), and so is everything after --.

Tests: a new unit test, normalize_command_line_redacts_secret_option_values, covers each spelling and the non-secret cases. I mutation-checked it: with the secret option lists emptied, it fails. cargo t describegpt passes (258 unit and 107 integration tests), and clippy is clean.

--process-response (the MCP path) leaves {GENERATED_BY_SIGNATURE} unsubstituted, so these tests can't run the attribution end to end without an LLM. provenance_command_line is just normalize_command_line(env::args()), which the unit test covers.

The CHANGELOG entry tells users to redact or regenerate files generated by earlier versions, and to consider rotating the key.

🤖 Generated with Claude Code

jqnatividad and others added 2 commits October 8, 2026 15:12
describegpt's attribution records the command line that ran, and it is
copied into every generated dictionary, description and tag set -- files
meant to be shared. The values of -k/--api-key and --ckan-token are now
replaced with [REDACTED] in every spelling docopt accepts: `--opt value`,
`--opt=value`, and stuck or clustered short options (`-kKEY`, `-Ak KEY`).
qsv's docopt rejects abbreviated long options, so exact names suffice.
Arguments after `--` are left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Comment thread src/cmd/describegpt.rs Dismissed
@jqnatividad
jqnatividad merged commit 6e7f770 into master Oct 8, 2026
17 of 18 checks passed
@jqnatividad
jqnatividad deleted the describegpt-redact-api-key branch October 8, 2026 19:26
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