Skip to content
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

Illegal group reference #15458

Open
itl-coder opened this issue Jul 22, 2024 · 3 comments
Open

Illegal group reference #15458

itl-coder opened this issue Jul 22, 2024 · 3 comments
Labels
in: crypto An issue in spring-security-crypto status: feedback-provided Feedback has been provided

Comments

@itl-coder
Copy link

java.lang.IllegalArgumentException: Illegal group reference
at java.base/java.util.regex.Matcher.appendExpandedReplacement(Matcher.java:1067)
at java.base/java.util.regex.Matcher.appendReplacement(Matcher.java:997)
at java.base/java.util.regex.Matcher.replaceFirst(Matcher.java:1407)
at java.base/java.lang.String.replaceFirst(String.java:2900)
at com.linkkou.mybatis.log.LogInterceptor.replaceFirst(LogInterceptor.java:152)
at com.linkkou.mybatis.log.LogInterceptor.getCompleteSql(LogInterceptor.java:123)
Occurs when storing encrypted data Error:
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
// password include:
return passwordEncoder.encode(password);
image
Will consider $ xxx $ to be regular
This method will be called automatically: at java.base/java.util.regex.Matcher.appendExpandedReplacement(Matcher.java:1067)

@itl-coder itl-coder added status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Jul 22, 2024
@jzheaux
Copy link
Contributor

jzheaux commented Jul 22, 2024

Hi, @itl-coder, thanks for reaching out. I'm going to need a bit more information in order to address your issue. Can you provide a sample unit test that causes BCryptPasswordEncoder to fail how you describe?

@jzheaux jzheaux added status: waiting-for-feedback We need additional information before we can continue in: crypto An issue in spring-security-crypto and removed status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Jul 22, 2024
@itl-coder
Copy link
Author

You only need to customize a save(User user) in the SpringSecurity environment and encrypt the password field to trigger;

@DaTa
class User{
private String username;
private String password;
}

public static String encodePassword(String password) {
    BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
    return passwordEncoder.encode(password);
}

User user = new User();
user.setUsername("zs");
// encrypt password
user.setPassword(encodePassword("12345678$"));
//
userMapper.save(user);

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 23, 2024
@itl-coder
Copy link
Author

recording

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: crypto An issue in spring-security-crypto status: feedback-provided Feedback has been provided
Projects
None yet
Development

No branches or pull requests

3 participants