Skip to content

fix(engine): keep connection key redaction consistent - #2195

Closed
giswqs wants to merge 1 commit into
mainfrom
sweep/engine-connection-keys-2026-11-15
Closed

giswqs wants to merge 1 commit into
mainfrom
sweep/engine-connection-keys-2026-11-15

Conversation

@giswqs

@giswqs giswqs commented Nov 15, 2026

Copy link
Copy Markdown
Member

Summary

A custom keyName given 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, including none, 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

  • Passed direct rustfmt and git diff --check.
  • Targeted command regression and full workspace tests are pending. Submitted without waiting for long-running tests as requested; CI must pass before merge.
  • Validation environment: GDAL 3.13.3.

UI evidence

No UI layout or control changes. This fixes saved definition and diagnostic metadata handling.

@coderabbitai

coderabbitai Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: bb7f2271-1532-4b15-a8cf-47c72fead44d
Commits

Reviewing files that changed from the base of the PR and between ce40749 and ae5f4c7.

Files selected for processing: 2

  • crates/engine/src/connections.rs
  • crates/engine/src/tests/service_logins.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@giswqs

giswqs commented Nov 15, 2026

Copy link
Copy Markdown
Member Author

Superseded by the combined engine correctness PR #2201.

@giswqs giswqs closed this Nov 15, 2026
// 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());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
.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));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Bugs

  • Database kinds (postgres, mysql, sqlserver) now hit the new empty-auth branch. A keyName with no auth on a MySQL address like ?charset=utf8mb4 removes charset and reports it as a password or token. Before this PR, the same input only cleared keyName. Fix: limit the empty-method case to SERVICE_KINDS. Inline comment posted at connections.rs:405. Confidence: medium-high (from reading the code; I could not run tests).

Security

  • No new issues. The change keeps values out of notices and out of strippedParameters, and the new classifier call is bounded by valid_query_name.

Performance

  • No concerns.

Quality

  • Never silent (plausible): connection.test without an id discards the stripped flag (cmd/connections.rs:1043), so the probe runs without the parameter and nothing is reported. This gap predates the PR for generic names like ?token=, but the PR widens it. Inline comment posted at connections.rs:406. Confidence: medium.
  • Minor, for the release quality pass: the new no-method case in service_logins.rs does not assert the notice. The code produces it, so this is a test gap rather than a bug.
  • Minor: a custom keyName without a method is not registered, so it is never offered in strippedParameters. The notice then says "a password or token" without naming the removed parameter. Confidence: low.

AGENTS.md

  • docs/user-guide/data.md:1118–1121 still describes the old strippedParameters behaviour. It does not mention that a keyName without a method now removes its parameter, or that an explicit "none" keeps it. The docs are outside this diff, so I could not comment inline. Confidence: high that the docs are stale.
  • No other rule violations found: no unwrap or unsafe added, and no schema or fixture change is needed.

Already raised: 0 (no prior review threads).

Checked: the diff, the clean and clean_login flow, stripped_parameters, address.rs name classification, without_query_parameter, the load path, the UI and CLI callers, and the new tests. I did not run the test suite.

Change size

Compared with main (merge base ce40749 to PR head ae5f4c7), covering the whole PR.

Measure Value
Files changed 2 (added 0, modified 2, removed 0, renamed 0)
Size before 256.8 KB
Size after 258.7 KB
Total size change +1.9 KB
Path Before After Change
crates/engine/src/tests/service_logins.rs 166.6 KB 168.0 KB +1.4 KB
crates/engine/src/connections.rs 90.2 KB 90.7 KB +510 B

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.

1 participant