Repository navigation
Conversation
low_savings_commands sent the first three whitespace words of the stored rtk_cmd. Stored values embed raw command lines (the proxy and fallback record sites keep the full invocation), so the third word can be a path, URL or database connection string rather than a subcommand. docs/TELEMETRY.md states that full command lines, arguments, file paths and secrets are never collected, and the contributor checklist requires telemetry fields to carry "only aggregate counts or anonymized names". This field did not meet that bar. Reduce the label instead of truncating it: keep rtk's own leading marker, then only bare subcommand words, and take a third word only when the second names a tool that actually has subcommands. "rtk git log" and "rtk docker ps" are preserved; "rtk psql postgres://user:pass@host/db -c ..." becomes "rtk psql". Reported by @LionartBR in rtk-ai#1785. Closes rtk-ai#1785
|
Closing this — I should not have opened it. @YOMXXX already has #2578 open since 2026-06-24, fixing the same thing in the same file, and it is mergeable and just waiting on review. Theirs came first and is the smaller change (+61/-4 against my +123/-2). Mine adds nothing that justifies a competing PR, and a second one only makes the queue harder to read. My mistake was in how I checked for prior work: I searched issues, found @LionartBR's #1785 and credited it, then went straight to writing a patch without searching open pull requests. #2578 was linked right under the issue title the whole time. Entirely avoidable, and I'm sorry for the noise. Maintainers: #2578 is the one to review. @LionartBR reported the issue, @YOMXXX wrote the fix. The one thing I'd still offer is the reproduction I left on #1785: with a stored command whose savings land in the field's Disclosure: I used AI assistance on the original PR and on this comment. |
Summary
low_savings_commandssent the first three whitespace words of the storedrtk_cmd. Because the proxy and fallback record sites store the raw command line, the third word can be a path, URL, or database connection string instead of a subcommand — so argument data could reach the telemetry payload.rtk git logandrtk docker psare preserved;rtk psql postgres://user:pass@host/db -c ...becomesrtk psql.Why it matters:
docs/TELEMETRY.md:112-113says full command lines, arguments, and file paths are never collected, and the contributor checklist atdocs/TELEMETRY.md:189requires new telemetry fields to carry "only aggregate counts or anonymized names — no raw paths, arguments, or user data". This field was the one that did not meet that bar; the sibling fields (top_commandsvia.nth(1),top_passthroughvia SQLSUBSTR) already reduce correctly.I confirmed the leak is reachable rather than theoretical. With a stored command whose savings land in the field's
0 < avg < 30window, the credential survived into the value thatsend_pingputs in the JSON body:(synthetic credentials, run in a container). On my own machine's history DB, 129 distinct stored commands have a path or URL in that third word.
Kept deliberately small and in-scope: one file, one behaviour change, no drive-by edits. If you would rather go further — e.g. @LionartBR's alternative of reducing to the tool name only, or a broader per-tool allowlist — I'm happy to change it to whatever you prefer, or to close this if you'd sooner fix it yourselves.
Test plan
cargo fmt --all && cargo clippy --all-targets && cargo test --allsrc/core/tracking.rscovering: the DSN regression from Prevent telemetry low_savings_commands from including arguments #1785, paths/flags/patterns, preserved real subcommands (git log,docker ps,cargo build), thertk:toml/rtk proxymarkers and empty input, plus a property test asserting no label ever contains/,@,=, or.rust:1.91-slimcontainer withgitinstalled — withoutgitpresent, 5 unrelated pre-existing git tests fail for environmental reasons)Disclosure: I used AI assistance to help investigate this and draft the change. I verified every line myself, reproduced the behaviour, and ran the full test suite before opening this.