-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
executor, sessionctx: add checks for system variable validate_password_xxxx #8227
Conversation
Hi contributor, thanks for your PR. This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically. |
@alapha23 Thanks for your contribution! |
@alapha23 A friendly ping. Any update? |
/run-all-tests |
16ae0a1
to
71e3df1
Compare
@alapha23 please fix CI caused by new testcase, thanks
|
c9b47e7
to
6d70839
Compare
abd2502
to
54302f2
Compare
/run-all-tests |
@@ -269,7 +270,6 @@ var defaultSysVars = []*SysVar{ | |||
{ScopeNone, "performance_schema_max_file_classes", "50"}, | |||
{ScopeGlobal, "expire_logs_days", "0"}, | |||
{ScopeGlobal | ScopeSession, "binlog_rows_query_log_events", "OFF"}, | |||
{ScopeGlobal, "validate_password_policy", "1"}, |
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.
why do we remove this?
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.
According to mysql reference, This validate_password plugin system variable is deprecated and will be removed in a future version of MySQL.
So I presume we will not need it in the future. What do you think?
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.
@alapha23 I think we can discuss whether to remove these unused variables in another PR. For this PR, let's focused on the validation of validate_password_number_count
and validate_password_length
.
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
@alapha23 pingcap/parser#25 has been merged, could you update |
tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning|1292|Truncated incorrect validate_password_number_count value: '-1'")) | ||
|
||
tk.MustExec("set @@global.validate_password_length=-1") | ||
tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning|1292|Truncated incorrect validate_password_length value: '-1'")) |
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.
It's better to add some positive test cases. For example: set @@global.validate_password_number_count=8
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.
Thank you. I'll do that
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 am quite confused since reference doesn't set an upper bound on validate_password_number_count
, are you suggesting that it is an error when validate_password_number_count=8
?
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.
No, I mean you can add some following tests:
tk.MustExec("set @@global.validate_password_length=8")
tk.MustQuery("show warnings").Check(testutil.Rows())
tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning|1292|Truncated incorrect validate_password_number_count value: '-1'")) | ||
|
||
tk.MustExec("set @@global.validate_password_length=-1") | ||
tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning|1292|Truncated incorrect validate_password_length value: '-1'")) |
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.
No, I mean you can add some following tests:
tk.MustExec("set @@global.validate_password_length=8")
tk.MustQuery("show warnings").Check(testutil.Rows())
4bb4150
to
2d47a00
Compare
go.mod
Outdated
@@ -52,3 +52,5 @@ require ( | |||
sourcegraph.com/sourcegraph/appdash v0.0.0-20180531100431-4c381bd170b4 | |||
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 | |||
) | |||
|
|||
replace github.com/pingcap/parser => github.com/alapha23/parser v0.0.0-20181126070418-f5119577d517 |
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.
pingcap/parser#25 is merged, this line should be removed. We should use the latest github.com/pingcap/parser
.
d0f85b3
to
b21ba66
Compare
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
What problem does this PR solve?
Corresponding to Issue #7195, I added correctness check for system variables:
validate_password_number_count
,validate_password_special_char_count
,validate_password_length
,validate_password_mixed_case_count
,validate_password_policy
.What is changed and how it works?
Executor and sessionctx are modified according to the framework mentioned in #7117
Tests
This change is