-
Notifications
You must be signed in to change notification settings - Fork 188
feat(encrypt): Support both encrypted and unencrypted passwords for the upstream and downstream database #633
feat(encrypt): Support both encrypted and unencrypted passwords for the upstream and downstream database #633
Conversation
Thanks for your contribution. If your PR get merged, you will be rewarded 600 points. |
f670199
to
b2a7f56
Compare
b2a7f56
to
bc8bac5
Compare
@csuzhangxc PTAL, thx , I have no idea about this issue 😂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can update some integration test cases (under ./tests
directory) to use plaintext password (123456
) now.
dm/ctl/common/config.go
Outdated
ciphertext, err1 := utils.Encrypt(c.encrypt) | ||
if err1 != nil { | ||
return true, err1 | ||
ciphertext, err := utils.Encrypt(c.encrypt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename err1
to err
will report some warning by make check
.
dm/ctl/common/config.go:94:15: declaration of "err" shadows declaration at line 82
dm/ctl/common/config.go:103:14: declaration of "err" shadows declaration at line 82
pkg/utils/encrypt.go
Outdated
return ciphertextB64, nil | ||
} | ||
return plaintext, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another new line is needed here (with go fmt
).
This PR is what I want. 👍 |
@csuzhangxc OK, i'm done, but i don't found the reason of test case failed, can you help me see this problem, THX ; ) |
it said the failed point in https://github.com/pingcap/dm/blob/master/dm/master/server_test.go#L994 , But I did not find the connection between it and cryption modules |
our CI is not stable now, you may simply re- |
/run-all-tests |
yes.....In fact... i have tried but the error still exists, let me see this error later of today 😹 |
e0611fe
to
eb8f7e1
Compare
I will finish this issue in this weekend 😂 |
@Kuri-su now, we are moving our internal work to #sig-tools and #sig-tools-zh now, if you have interests, you can join one or two. |
Finally 😂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest LGTM
func() *SourceConfig { | ||
cfg := newConfig() | ||
cfg.From.Password = "123456" // plaintext password | ||
return cfg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about adding test case config with encrypt password?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, i have added a testCase about encrypt password
if err1 != nil { | ||
return true, err1 | ||
} | ||
fmt.Println(plaintext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line should be deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we are shouldn't delete these lines, because the Decrypt
method is called instead of DecryptOrPlaintext
in L103 , the function may return a error
pkg/utils/encrypt.go
Outdated
@@ -43,3 +43,12 @@ func Decrypt(ciphertextB64 string) (string, error) { | |||
} | |||
return string(plaintext), nil | |||
} | |||
|
|||
// DecryptOrPlaintext tries to decrypt base64 encoded ciphertext to plaintext or return plaintext | |||
func DecryptOrPlaintext(ciphertextB64 string) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems that dosen't need to return error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, i have cleaned the extra error
variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@Kuri-su please update this branch with the base branch. |
@Kuri-su thank you, ❤️ |
cherry pick to release-1.0 failed |
What problem does this PR solve?
UCP #506
fix #506
What is changed and how it works?
add and use 'decryptOrPlaintext' function