-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
feature: isCommonlyUsed password check not hardcoded #4018 #4207
Conversation
dc6c986
to
fcd0674
Compare
Codecov Report
@@ Coverage Diff @@
## master #4207 +/- ##
============================================
- Coverage 52.59% 52.54% -0.05%
+ Complexity 2620 2619 -1
============================================
Files 484 484
Lines 15192 15201 +9
Branches 1571 1573 +2
============================================
- Hits 7990 7988 -2
- Misses 6645 6654 +9
- Partials 557 559 +2
Continue to review full report at Codecov.
|
...lo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/config/PortalConfig.java
Outdated
Show resolved
Hide resolved
...al/src/main/java/com/ctrip/framework/apollo/portal/util/checker/AuthUserPasswordChecker.java
Outdated
Show resolved
Hide resolved
...portal/src/test/java/com/ctrip/framework/apollo/portal/util/AuthUserPasswordCheckerTest.java
Outdated
Show resolved
Hide resolved
6f31393
to
538199f
Compare
...portal/src/test/java/com/ctrip/framework/apollo/portal/util/AuthUserPasswordCheckerTest.java
Outdated
Show resolved
Hide resolved
@@ -273,4 +275,12 @@ public String getAdminServiceAccessTokens() { | |||
public boolean supportSearchByItem() { | |||
return getBooleanProperty("searchByItem.switch", true); | |||
} | |||
|
|||
public List<String> listOfCodeFragment() { | |||
String[] value = getArrayProperty("auth.user-password-checker.list-of-code-fragment", null); |
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.
Add the prefix to the key?
String[] value = getArrayProperty("auth.user-password-checker.list-of-code-fragment", null); | |
String[] value = getArrayProperty("apollo.portal.auth.user-password-checker.list-of-code-fragment", null); |
Or change it?
String[] value = getArrayProperty("auth.user-password-checker.list-of-code-fragment", null); | |
String[] value = getArrayProperty("apollo.portal.auth.user-password-not-allow-list", null); |
Alternative
- auth.user-password-checker.list-of-code-fragment
- apollo.portal.auth.user-password-checker.list-of-code-fragment
- apollo.portal.auth.user-password-fragment
- apollo.portal.auth.user-password-checker-fragment
- apollo.portal.auth.user-password-checker-code-fragment
- apollo.portal.auth.user-password-not-allow-list
- ...
An better key let user more understandable this feature.
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.
Done.
538199f
to
8b3d6eb
Compare
@@ -28,7 +29,7 @@ | |||
private static final Pattern PWD_PATTERN = Pattern | |||
.compile("^(?=.*[0-9].*)(?=.*[a-zA-Z].*).{8,20}$"); | |||
|
|||
private static final List<String> LIST_OF_CODE_FRAGMENT = Arrays.asList( | |||
private static final List<String> DEFAULT_USER_PASSWORD_NOT_ALLOW_LIST = Arrays.asList( |
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.
Move the default value to PortalConfig
's method?
private static final List<String> DEFAULT_USER_PASSWORD_NOT_ALLOW_LIST = Arrays.asList(xxx);
public List<String> getUserPasswordNotAllowList() {
String[] value = getArrayProperty("apollo.portal.auth.user-password-not-allow-list", null);
if (value == null || value.length == 0) {
return DEFAULT_USER_PASSWORD_NOT_ALLOW_LIST;
}
return Arrays.asList(value);
}
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.
Done.
@@ -81,4 +80,24 @@ public void testIsWeakPassword() { | |||
Assert.assertTrue(res.isSuccess()); | |||
} | |||
|
|||
@Test | |||
public void testIsWeakPassword2() { |
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.
Maybe we can add more test case like return empty list, single element list?
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.
Done.
8b3d6eb
to
5043ae3
Compare
...lo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/config/PortalConfig.java
Outdated
Show resolved
Hide resolved
5043ae3
to
8d529f3
Compare
Signed-off-by: WillardHu <wei.hu@daocloud.io>
8d529f3
to
27eac92
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.
Looks good to me now. @Anilople would you please help to take a look from your perspective?
Signed-off-by: WillardHu wei.hu@daocloud.io
What's the purpose of this PR
isCommonlyUsed
password check not hardcodedWhich issue(s) this PR fixes:
Fixes #4018
Brief changelog
XXXXX
Follow this checklist to help us incorporate your contribution quickly and easily:
mvn clean test
to make sure this pull request doesn't break anything.CHANGES
log.