zjncs opened a new pull request, #7256: URL: https://github.com/apache/rocketmq-dashboard/pull/7256
## Problem `set-context` rejects userinfo URLs today (merged #6689), but configs written by an older rmqctl or by hand with `server: https://user:[email protected]` are a supported, loadable state — `TestConfigSetContextCanRemoveStoredServerCredentials` (`cmd/config_test.go:154`) exists precisely for them. For those configs, `config get-contexts` prints the password verbatim in the SERVER column (`internal/output/output.go:131-133`), and every L2/L3 confirmation prompt echoes it (`cmd/runtime.go:85` → "Arguments will be sent to %s"). This is the same plain-text echo the #6689 rationale cites as the threat. ## Fix Redact at **display time only**: a `RedactServerURL` helper splices `***` over the raw authority's userinfo (note: `url.User("***")` would percent-encode to `%2A%2A%2A`, caught by the tests — the splice avoids that). The stored config value and the structured `--output json/yaml` paths stay verbatim (pinned by tests). ## Verification - Three tests, all RED first: `TestConfigTableControlsTest` extended with a `user:pass@` context (password absent, host present); new `TestConfigGetContextsRedactsStoredServerCredentials` (table + json output); new `TestTargetServerRedactsStoredServerCredentials` (prompt path). - GREEN: `go test ./internal/... ./cmd/...` all ok; `go vet` ok. (`go test ./...` also fails in `rmqctl/scripts` — verified pre-existing on pristine 127c47b0, environmental, unrelated.) ## Risk / conflict disclosure Display-only; nothing persisted changes. Open PRs #5144/#6521 touch the `set-context` command (different functions); #5624 (mine) pads tables elsewhere in `output.go`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
