Repository navigation
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Superseded by the combined engine correctness PR #2201. |
| // without a method still declares a possible key, as it does in the replay log. An explicit | ||
| // other method (`none` included) does not select a query parameter. | ||
| let query_name = Some(c.key_name.trim()) | ||
| .filter(|name| (c.auth.trim().is_empty() || c.auth.trim().eq_ignore_ascii_case("query")) && !name.is_empty()); |
There was a problem hiding this comment.
Bug (confidence: medium-high): the new empty-auth branch runs for every kind, including database kinds (postgres, mysql, sqlserver). clean_login returns early for an empty auth and never checks the kind, so a keyName on a database connection now removes a matching query parameter from its address. Before this change the same input only cleared keyName.
Failure scenario: connection.new {"kind":"mysql","name":"Shop","address":"mysql://reader@db.example/shop?charset=utf8mb4","keyName":"charset"} saves mysql://reader@db.example/shop, returns stripped: true, and emits "A password or token in the address was left out". The removed value is a non-secret setting, and the notice is wrong about it.
Suggested fix: limit the empty-method case to web-service kinds.
| .filter(|name| (c.auth.trim().is_empty() || c.auth.trim().eq_ignore_ascii_case("query")) && !name.is_empty()); | |
| let query_name = Some(c.key_name.trim()).filter(|name| { | |
| let auth = c.auth.trim(); | |
| let no_method = auth.is_empty() && SERVICE_KINDS.contains(&c.kind.as_str()); | |
| (no_method || auth.eq_ignore_ascii_case("query")) && !name.is_empty() | |
| }); |
A regression test for a MySQL or Postgres address with a query parameter named like the keyName would cover this.
| // other method (`none` included) does not select a query parameter. | ||
| let query_name = Some(c.key_name.trim()) | ||
| .filter(|name| (c.auth.trim().is_empty() || c.auth.trim().eq_ignore_ascii_case("query")) && !name.is_empty()); | ||
| let given = query_name.map_or_else(|| t.to_string(), |name| crate::render::rustgis_tiles::logins::without_query_parameter(t, name)); |
There was a problem hiding this comment.
Never silent (confidence: medium, plausible): connection.test without an id calls clean(c)?.0 in crates/engine/src/cmd/connections.rs:1043 and discards the stripped flag. With this change, {"kind":"wmts","address":"…?zqkey=…","keyName":"zqkey"} (no auth) is tested with the parameter removed, and no notice is produced on that path. The same gap already exists for generic credential names such as ?token=, but this PR widens the set of names it covers.
Suggested direction: have tested surface the flag, for example by emitting the same stripped notice shown_stripped produces, or by returning an error that says the address holds a key and should be saved with a login method.
Code reviewBugs
Security
Performance
Quality
AGENTS.md
Already raised: 0 (no prior review threads). Checked: the diff, the Change sizeCompared with main (merge base ce40749 to PR head ae5f4c7), covering the whole PR.
|
Summary
A custom
keyNamegiven without a login method now removes that parameter from a saved connection address, matching the replay log's redaction hint. An explicitly chosen other method, includingnone, retains ordinary query data.The stripped-parameter suggestions now recognize legacy semicolon-separated query pairs and offer only credential names identified by the address redactor. An innocent parameter removed alongside a key is no longer suggested as a login parameter.
The existing command regression now checks legacy separators, saved output for a custom name without a method, and the explicit no-login control.
Sweep findings: legacy separator, custom name without a method.
Testing
git diff --check.UI evidence
No UI layout or control changes. This fixes saved definition and diagnostic metadata handling.