Giter Site home page Giter Site logo

mybatis-encrypt-plugin's Issues

SensitiveAndEncryptWriteInterceptor里没有必要把所有类型字段都invoke

com.chenhaiyang.plugin.mybatis.sensitive.interceptor.SensitiveAndEncryptWriteInterceptor#handleParameters

这个类里在进行Field值获取时,将所有Field的value都尝试用metaObject.getValue(field.getName())获取。
但比如像
private static final long serialVersionUID = -5068601256084847339L;
这种,DTO常见的序列化UID字段其实不需要考虑处理。建议在循环Field时加上:

       if (Modifier.isStatic(field.getModifiers()) || Modifier.isFinal(field.getModifiers())) {
            continue;
        }

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

问题描述

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

dao接口传入多个bean时,查询条件加密失效

com.chenhaiyang.plugin.mybatis.sensitive.interceptor.SensitiveAndEncryptWriteInterceptor
当中,当参数为一个Map时,会跳过加解密阶段。
但当dao接口传入多个bean参数时,在切面获取到的参数类型其实还是个map:
@Transactional(readOnly = true) List<EncryptTest> queryListWithPage(@Param("entity") EncryptTest entity, @Param("params") QueryDBParams params);

这个我在debug的时候,发现是这样的:
image

貌似现在只支持单参数加解密,多参数Bean加解密可以考虑递归map实现,不过可能会有些复杂

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.