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

com.chenhaiyang.plugin.mybatis.sensitive.type.handler.BandCardSensitiveHandler类中handle方法有bug #17

Open
sunny0130 opened this issue Jul 17, 2023 · 0 comments

Comments

@sunny0130
Copy link

问题描述

com.chenhaiyang.plugin.mybatis.sensitive.type.handler.BandCardSensitiveHandler中的handle针对银行卡号脱敏的方法与注释不符,存在bug。

  1. 注释描述银行卡号脱敏,只留前四位和后四位。例如:6227 0383 3938 3938 393 脱敏结果: 6227 **** **** 8 393
    源码中,StringUtils.removeStart("", "
    "), 移除填充的卡号时少了一位,导致结果多出一个*
// 关键源码
StringUtils.left(bankCard, 4).concat(StringUtils.removeStart(StringUtils.leftPad(StringUtils.right(bankCard, 4), StringUtils.length(bankCard), "*"), "***")) 

image

  1. 没有对少于8位的字符串进行判断(要么直接返回不处理),导致输入少于8位的字符串时,结果错误,如图直接运行项目自带的测试用例,出来的结果都不能发现不对

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant