globalreachtech/tinyradius-netty

View on GitHub

Showing 31 of 31 total issues

Method create has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

static RadiusResponse create(Dictionary dictionary, byte type, byte id, byte[] authenticator, List<RadiusAttribute> attributes) throws RadiusPacketException {
Severity: Minor
Found in src/main/java/org/tinyradius/core/packet/response/RadiusResponse.java - About 35 mins to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    if (tok.length < 3 || tok.length > 4)
    throw new IOException("VENDOR parse error on line " + lineNum + ": " + Arrays.toString(tok));
    src/main/java/org/tinyradius/core/dictionary/parser/ResourceParser.java on lines 136..137

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    if (tok.length < 2 || tok.length > 3)
    throw new IOException("BEGIN-VENDOR parse error on line " + lineNum + ", " + Arrays.toString(tok));
    src/main/java/org/tinyradius/core/dictionary/parser/ResourceParser.java on lines 209..210

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    for (int i = 0; i < strLen; i += 16) {
    plaintext.writeBytes(xor16(encodedStr, i, md5(secret, c)));
    c = Arrays.copyOfRange(encodedStr, i, i + 16);
    }
    src/main/java/org/tinyradius/core/attribute/codec/UserPasswordCodec.java on lines 43..46

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    for (int i = 0; i < encodedData.length; i += 16) {
    buf.writeBytes(xor16(encodedData, i, md5(secret, c)));
    c = Arrays.copyOfRange(encodedData, i, i + 16);
    }
    src/main/java/org/tinyradius/core/attribute/codec/TunnelPasswordCodec.java on lines 64..67

    Method detectAttributeCodec has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    private static AttributeCodecType detectAttributeCodec(int vendorId, int type, byte encryptFlag) {
    if (vendorId == -1 && type == USER_PASSWORD)
    return RFC2865_USER_PASSWORD;
     
    if (vendorId == -1 && type == TUNNEL_PASSWORD)
    Severity: Minor
    Found in src/main/java/org/tinyradius/core/attribute/AttributeTemplate.java - About 25 mins to fix

    Method addAttributeTemplate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    @Override
    public MemoryDictionary addAttributeTemplate(AttributeTemplate attributeTemplate) {
    if (attributeTemplate == null)
    throw new IllegalArgumentException("Attribute definition must not be null");
     
     
    Severity: Minor
    Found in src/main/java/org/tinyradius/core/dictionary/MemoryDictionary.java - About 25 mins to fix

    Method decodeData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    @Override
    protected byte[] decodeData(byte[] encodedData, byte[] auth, byte[] secret) throws RadiusPacketException {
    if (encodedData.length < 16)
    throw new RadiusPacketException("Malformed attribute while decoding with RFC2865 User-Password method - " +
    "data must be at least 16 octets, actual: " + encodedData.length);
    Severity: Minor
    Found in src/main/java/org/tinyradius/core/attribute/codec/UserPasswordCodec.java - About 25 mins to fix

    Method parseVendor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    private void parseVendor(String[] tok, int lineNum) throws IOException {
    if (tok.length < 3 || tok.length > 4)
    throw new IOException("VENDOR parse error on line " + lineNum + ": " + Arrays.toString(tok));
     
    final int[] format = tok.length == 4 ?
    Severity: Minor
    Found in src/main/java/org/tinyradius/core/dictionary/parser/ResourceParser.java - About 25 mins to fix

    Method formatFlag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    private int[] formatFlag(String flag) {
    if (flag.startsWith("format=")) {
    final String[] values = flag.substring(7).split(",");
    if (values.length == 2)
    try {
    Severity: Minor
    Found in src/main/java/org/tinyradius/core/dictionary/parser/ResourceParser.java - About 25 mins to fix

    Method verifyMessageAuth has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    default void verifyMessageAuth(String sharedSecret, byte[] requestAuth) throws RadiusPacketException {
    final List<RadiusAttribute> msgAuthAttr = getAttributes(MESSAGE_AUTHENTICATOR);
     
    if (msgAuthAttr.isEmpty())
    return;
    Severity: Minor
    Found in src/main/java/org/tinyradius/core/packet/util/MessageAuthSupport.java - About 25 mins to fix
    Severity
    Category
    Status
    Source
    Language