You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
master(dm): require the password when the source endpoint changes - #13010
updateSource (dm/master/openapi_controller.go) treats an absent password in the request as "keep the stored one" no matter what else changes. A caller can change host/port/user and omit password; dm-master then runs CheckAndAdjustSourceConfigFunc, which connects to the new endpoint — sending the stored upstream password to whoever controls it.
What is changed and how it works?
Reject the update when the source connection parameters change and no password is supplied, with a clear error (the password must be provided explicitly when changing the source host, port or user). The controller test covers host, port and user changes and asserts the stored source is untouched.
Check List
Tests
Unit test
go test ./dm/master/ -run TestOpenAPIControllerSuite/TestSourceController
Questions
Will it cause performance regression or break compatibility?
No. Callers that change the endpoint have to resubmit the password, which is what the request already does when it rotates it.
Release note
DM: updating a source's host, port or user now requires the password to be provided explicitly instead of reusing the stored one.
Summary by CodeRabbit
Bug Fixes
Updating a source’s host, port, or user now requires the password to be provided explicitly. If it is omitted, the update is rejected and the existing host remains unchanged.
Password reuse continues when those connection details are unchanged.
Review was skipped as selected files did not have any reviewable changes.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 0ee59a13-9902-475d-8b80-1523e2c1cd5a
Commits
Reviewing files that changed from the base of the PR and between 2bd7c43 and 7222f0e.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
updateSource now rejects requests that omit a password when the source host, port, or user changes. Controller tests verify the error and confirm that the stored host remains unchanged.
Changes: Source password reuse guard
Layer / File(s)
Summary
Password reuse guard and validation dm/master/openapi_controller.go, dm/master/openapi_controller_test.go
updateSource rejects updates without a password when the host, port, or user changes. Tests check the error and confirm that the stored host remains unchanged.
Updating a source's host, port, or user without resubmitting the password is now rejected, so the stored upstream password cannot be used against a caller-chosen endpoint. Callers that change the endpoint must now send the password explicitly. No merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: dm-master now requires an explicit password when the source host, port, or user changes. It matches the raw summary, the PR objectives, and the linked issue #13009. Th…
Description check
The description follows the repository template. It has an 'Issue Number: close #13009' line and a 'What problem does this PR solve?' section that explains the security risk. It also has a 'What is ch…
Linked Issues check
Issue #13009 requires that PUT /api/v1/sources/{source-name} reject an update that changes host, port, or user without a password. The diff to dm/master/openapi_controller.go (`updateSourc…
Out of Scope Changes check
The whole-PR change set has two files: dm/master/openapi_controller.go (+9 lines) and dm/master/openapi_controller_test.go (+19 lines, per the summary). The production change is limited to the pas…
Full details: Title check
Explanation
The title names the main change: dm-master now requires an explicit password when the source host, port, or user changes. It matches the raw summary, the PR objectives, and the linked issue #13009. The title uses the repository's usual 'master(dm):' prefix. At 65 characters it is within a typical length limit, and it is specific enough for a teammate scanning history.
Full details: Description check
Explanation
The description follows the repository template. It has an 'Issue Number: close #13009' line and a 'What problem does this PR solve?' section that explains the security risk. It also has a 'What is changed and how it works?' section, a checklist with a unit test entry and the exact test command, answers to the compatibility question, and a release note. The template's 'Will it cause performance regression...' answer is present. The 'Do you need to update user documentation...' question is not answered. This is a minor gap and does not block the check.
Full details: Linked Issues check
Explanation
Issue #13009 requires that PUT /api/v1/sources/{source-name} reject an update that changes host, port, or user without a password. The diff to dm/master/openapi_controller.go (updateSource) adds a check inside the req.Source.Password == nil branch. It compares newCfg.From.Host, Port, and User with oldCfg.From. On any difference, it returns terror.ErrOpenAPICommonError with the message the password must be provided explicitly when changing the source host, port or user. The stored password is reused only when these fields are unchanged. This blocks the credential reuse path that #13009 describes, before CheckAndAdjustSourceConfigFunc runs. The PR summary also reports a controller test for host, port, and user changes. I did not inspect the test file, so the test coverage claim rests on the summary.
Full details: Out of Scope Changes check
Explanation
The whole-PR change set has two files: dm/master/openapi_controller.go (+9 lines) and dm/master/openapi_controller_test.go (+19 lines, per the summary). The production change is limited to the password-reuse decision in updateSource, which is the scope named by #13009. The test change supports that behavior. No unrelated change appears in the reviewed diff.
Finishing Touches
Generate unit tests (beta)
Create a new PR
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.
A rabbit guards the password tight No changed host gets it by surprise A port or user changed must show The password first, before we go The stored source stays as it was
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 05fe2dfb-5d53-433b-a2d9-86dc9ed8da03
Commits
Reviewing files that changed from the base of the PR and between ba08022 and 2bd7c43.
Files selected for processing: 2
dm/master/openapi_controller.go
dm/master/openapi_controller_test.go
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.
updateSource reuses the stored upstream password whenever the request omits
it. A caller could change host/port/user and let dm-master check the new
endpoint (CheckAndAdjustSourceConfigFunc connects to it) with the stored
password, which hands that credential to whoever controls the endpoint.
Reject the update when the connection parameters change and no password is
supplied, and cover host/port/user changes in the controller test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue Number: close #13009
What problem does this PR solve?
updateSource(dm/master/openapi_controller.go) treats an absentpasswordin the request as "keep the stored one" no matter what else changes. A caller can changehost/port/userand omitpassword; dm-master then runsCheckAndAdjustSourceConfigFunc, which connects to the new endpoint — sending the stored upstream password to whoever controls it.What is changed and how it works?
Reject the update when the source connection parameters change and no password is supplied, with a clear error (
the password must be provided explicitly when changing the source host, port or user). The controller test covers host, port and user changes and asserts the stored source is untouched.Check List
Tests
go test ./dm/master/ -run TestOpenAPIControllerSuite/TestSourceControllerQuestions
Will it cause performance regression or break compatibility?
No. Callers that change the endpoint have to resubmit the password, which is what the request already does when it rotates it.
Release note
Summary by CodeRabbit