The following issues were found

collectors/python.d.plugin/monit/monit.chart.py
50 issues
Unable to import 'bases.FrameworkServices.UrlService'
Error

Line: 9 Column: 1

              import xml.etree.ElementTree as ET
from collections import namedtuple

from bases.FrameworkServices.UrlService import UrlService

MonitType = namedtuple('MonitType', ('index', 'name'))

# see enum Service_Type from monit.h (https://bitbucket.org/tildeslash/monit/src/master/src/monit.h)
# typedef enum {

            

Reported by Pylint.

Useless super delegation in method '__eq__'
Error

Line: 160 Column: 5

                      self.threads = None
        self.children = None

    def __eq__(self, other):
        return super(ProcessMonitService, self).__eq__(other)

    def __ne__(self, other):
        return super(ProcessMonitService, self).__ne__(other)


            

Reported by Pylint.

Useless super delegation in method '__ne__'
Error

Line: 163 Column: 5

                  def __eq__(self, other):
        return super(ProcessMonitService, self).__eq__(other)

    def __ne__(self, other):
        return super(ProcessMonitService, self).__ne__(other)

    def __hash__(self):
        return super(ProcessMonitService, self).__hash__()


            

Reported by Pylint.

Useless super delegation in method '__hash__'
Error

Line: 166 Column: 5

                  def __ne__(self, other):
        return super(ProcessMonitService, self).__ne__(other)

    def __hash__(self):
        return super(ProcessMonitService, self).__hash__()

    def uptime_key(self):
        return 'process_uptime_{0}'.format(self.name)


            

Reported by Pylint.

Useless super delegation in method '__eq__'
Error

Line: 197 Column: 5

                      super(HostMonitService, self).__init__(typ, name, status, monitor)
        self.latency = None

    def __eq__(self, other):
        return super(HostMonitService, self).__eq__(other)

    def __ne__(self, other):
        return super(HostMonitService, self).__ne__(other)


            

Reported by Pylint.

Useless super delegation in method '__ne__'
Error

Line: 200 Column: 5

                  def __eq__(self, other):
        return super(HostMonitService, self).__eq__(other)

    def __ne__(self, other):
        return super(HostMonitService, self).__ne__(other)

    def __hash__(self):
        return super(HostMonitService, self).__hash__()


            

Reported by Pylint.

Useless super delegation in method '__hash__'
Error

Line: 203 Column: 5

                  def __ne__(self, other):
        return super(HostMonitService, self).__ne__(other)

    def __hash__(self):
        return super(HostMonitService, self).__hash__()

    def latency_key(self):
        return 'host_latency_{0}'.format(self.name)


            

Reported by Pylint.

Using xml.etree.ElementTree.fromstring to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree.fromstring with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
Security blacklist

Line: 229
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b313-b320-xml-bad-elementtree

              
    def parse(self, raw):
        try:
            root = ET.fromstring(raw)
        except ET.ParseError:
            self.error("URL {0} didn't return a valid XML page. Please check your settings.".format(self.url))
            return None
        return root


            

Reported by Bandit.

Missing module docstring
Error

Line: 1 Column: 1

              # -*- coding: utf-8 -*-
# Description: monit netdata python.d module
# Author: Evgeniy K. (n0guest)
# SPDX-License-Identifier: GPL-3.0-or-later

import xml.etree.ElementTree as ET
from collections import namedtuple

from bases.FrameworkServices.UrlService import UrlService

            

Reported by Pylint.

Using xml.etree.ElementTree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Security blacklist

Line: 6
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b405-import-xml-etree

              # Author: Evgeniy K. (n0guest)
# SPDX-License-Identifier: GPL-3.0-or-later

import xml.etree.ElementTree as ET
from collections import namedtuple

from bases.FrameworkServices.UrlService import UrlService

MonitType = namedtuple('MonitType', ('index', 'name'))

            

Reported by Bandit.

collectors/python.d.plugin/rabbitmq/rabbitmq.chart.py
49 issues
Unable to import 'bases.FrameworkServices.UrlService'
Error

Line: 8 Column: 1

              
from json import loads

from bases.FrameworkServices.UrlService import UrlService

API_NODE = 'api/nodes'
API_OVERVIEW = 'api/overview'
API_QUEUES = 'api/queues'
API_VHOSTS = 'api/vhosts'

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # -*- coding: utf-8 -*-
# Description: rabbitmq netdata python.d module
# Author: ilyam8
# SPDX-License-Identifier: GPL-3.0-or-later

from json import loads

from bases.FrameworkServices.UrlService import UrlService


            

Reported by Pylint.

Line too long (110/100)
Error

Line: 89 Column: 1

              
CHARTS = {
    'file_descriptors': {
        'options': [None, 'File Descriptors', 'descriptors', 'overview', 'rabbitmq.file_descriptors', 'line'],
        'lines': [
            ['fd_used', 'used', 'absolute']
        ]
    },
    'memory': {

            

Reported by Pylint.

Line too long (103/100)
Error

Line: 107 Column: 1

                      ]
    },
    'socket_descriptors': {
        'options': [None, 'Socket Descriptors', 'descriptors', 'overview', 'rabbitmq.sockets', 'line'],
        'lines': [
            ['sockets_used', 'used', 'absolute']
        ]
    },
    'erlang_processes': {

            

Reported by Pylint.

Line too long (101/100)
Error

Line: 113 Column: 1

                      ]
    },
    'erlang_processes': {
        'options': [None, 'Erlang Processes', 'processes', 'overview', 'rabbitmq.processes', 'line'],
        'lines': [
            ['proc_used', 'used', 'absolute']
        ]
    },
    'erlang_run_queue': {

            

Reported by Pylint.

Line too long (108/100)
Error

Line: 119 Column: 1

                      ]
    },
    'erlang_run_queue': {
        'options': [None, 'Erlang Run Queue', 'processes', 'overview', 'rabbitmq.erlang_run_queue', 'line'],
        'lines': [
            ['run_queue', 'length', 'absolute']
        ]
    },
    'global_counts': {

            

Reported by Pylint.

Line too long (123/100)
Error

Line: 135 Column: 1

                      ]
    },
    'connection_churn_rates': {
        'options': [None, 'Connection Churn Rates', 'operations/s', 'overview', 'rabbitmq.connection_churn_rates', 'line'],
        'lines': [
            ['churn_rates_connection_created_details_rate', 'created', 'absolute'],
            ['churn_rates_connection_closed_details_rate', 'closed', 'absolute']
        ]
    },

            

Reported by Pylint.

Line too long (117/100)
Error

Line: 142 Column: 1

                      ]
    },
    'channel_churn_rates': {
        'options': [None, 'Channel Churn Rates', 'operations/s', 'overview', 'rabbitmq.channel_churn_rates', 'line'],
        'lines': [
            ['churn_rates_channel_created_details_rate', 'created', 'absolute'],
            ['churn_rates_channel_closed_details_rate', 'closed', 'absolute']
        ]
    },

            

Reported by Pylint.

Line too long (113/100)
Error

Line: 149 Column: 1

                      ]
    },
    'queue_churn_rates': {
        'options': [None, 'Queue Churn Rates', 'operations/s', 'overview', 'rabbitmq.queue_churn_rates', 'line'],
        'lines': [
            ['churn_rates_queue_created_details_rate', 'created', 'absolute'],
            ['churn_rates_queue_declared_details_rate', 'declared', 'absolute'],
            ['churn_rates_queue_deleted_details_rate', 'deleted', 'absolute']
        ]

            

Reported by Pylint.

Line too long (108/100)
Error

Line: 157 Column: 1

                      ]
    },
    'queued_messages': {
        'options': [None, 'Queued Messages', 'messages', 'overview', 'rabbitmq.queued_messages', 'stacked'],
        'lines': [
            ['queue_totals_messages_ready', 'ready', 'absolute'],
            ['queue_totals_messages_unacknowledged', 'unacknowledged', 'absolute']
        ]
    },

            

Reported by Pylint.

collectors/python.d.plugin/python_modules/urllib3/connectionpool.py
48 issues
Attempted relative import beyond top-level package
Error

Line: 12 Column: 1

              import socket


from .exceptions import (
    ClosedPoolError,
    ProtocolError,
    EmptyPoolError,
    HeaderParsingError,
    HostChangedError,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 27 Column: 1

                  InsecureRequestWarning,
    NewConnectionError,
)
from .packages.ssl_match_hostname import CertificateError
from .packages import six
from .packages.six.moves import queue
from .connection import (
    port_by_scheme,
    DummyConnection,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 28 Column: 1

                  NewConnectionError,
)
from .packages.ssl_match_hostname import CertificateError
from .packages import six
from .packages.six.moves import queue
from .connection import (
    port_by_scheme,
    DummyConnection,
    HTTPConnection, HTTPSConnection, VerifiedHTTPSConnection,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 29 Column: 1

              )
from .packages.ssl_match_hostname import CertificateError
from .packages import six
from .packages.six.moves import queue
from .connection import (
    port_by_scheme,
    DummyConnection,
    HTTPConnection, HTTPSConnection, VerifiedHTTPSConnection,
    HTTPException, BaseSSLError,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 30 Column: 1

              from .packages.ssl_match_hostname import CertificateError
from .packages import six
from .packages.six.moves import queue
from .connection import (
    port_by_scheme,
    DummyConnection,
    HTTPConnection, HTTPSConnection, VerifiedHTTPSConnection,
    HTTPException, BaseSSLError,
)

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 36 Column: 1

                  HTTPConnection, HTTPSConnection, VerifiedHTTPSConnection,
    HTTPException, BaseSSLError,
)
from .request import RequestMethods
from .response import HTTPResponse

from .util.connection import is_connection_dropped
from .util.request import set_file_position
from .util.response import assert_header_parsing

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 37 Column: 1

                  HTTPException, BaseSSLError,
)
from .request import RequestMethods
from .response import HTTPResponse

from .util.connection import is_connection_dropped
from .util.request import set_file_position
from .util.response import assert_header_parsing
from .util.retry import Retry

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 39 Column: 1

              from .request import RequestMethods
from .response import HTTPResponse

from .util.connection import is_connection_dropped
from .util.request import set_file_position
from .util.response import assert_header_parsing
from .util.retry import Retry
from .util.timeout import Timeout
from .util.url import get_host, Url

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 40 Column: 1

              from .response import HTTPResponse

from .util.connection import is_connection_dropped
from .util.request import set_file_position
from .util.response import assert_header_parsing
from .util.retry import Retry
from .util.timeout import Timeout
from .util.url import get_host, Url


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 41 Column: 1

              
from .util.connection import is_connection_dropped
from .util.request import set_file_position
from .util.response import assert_header_parsing
from .util.retry import Retry
from .util.timeout import Timeout
from .util.url import get_host, Url



            

Reported by Pylint.

collectors/python.d.plugin/python_modules/pyyaml3/resolver.py
46 issues
Attempted relative import beyond top-level package
Error

Line: 5 Column: 1

              
__all__ = ['BaseResolver', 'Resolver']

from .error import *
from .nodes import *

import re

class ResolverError(YAMLError):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              __all__ = ['BaseResolver', 'Resolver']

from .error import *
from .nodes import *

import re

class ResolverError(YAMLError):
    pass

            

Reported by Pylint.

Undefined variable 'YAMLError'
Error

Line: 10 Column: 21

              
import re

class ResolverError(YAMLError):
    pass

class BaseResolver:

    DEFAULT_SCALAR_TAG = 'tag:yaml.org,2002:str'

            

Reported by Pylint.

Undefined variable 'ScalarNode'
Error

Line: 65 Column: 30

                              node_check = None
                index_check = element
            if node_check is str:
                node_check = ScalarNode
            elif node_check is list:
                node_check = SequenceNode
            elif node_check is dict:
                node_check = MappingNode
            elif node_check not in [ScalarNode, SequenceNode, MappingNode]  \

            

Reported by Pylint.

Undefined variable 'SequenceNode'
Error

Line: 67 Column: 30

                          if node_check is str:
                node_check = ScalarNode
            elif node_check is list:
                node_check = SequenceNode
            elif node_check is dict:
                node_check = MappingNode
            elif node_check not in [ScalarNode, SequenceNode, MappingNode]  \
                    and not isinstance(node_check, str) \
                    and node_check is not None:

            

Reported by Pylint.

Undefined variable 'MappingNode'
Error

Line: 69 Column: 30

                          elif node_check is list:
                node_check = SequenceNode
            elif node_check is dict:
                node_check = MappingNode
            elif node_check not in [ScalarNode, SequenceNode, MappingNode]  \
                    and not isinstance(node_check, str) \
                    and node_check is not None:
                raise ResolverError("Invalid node checker: %s" % node_check)
            if not isinstance(index_check, (str, int))  \

            

Reported by Pylint.

Undefined variable 'MappingNode'
Error

Line: 70 Column: 63

                              node_check = SequenceNode
            elif node_check is dict:
                node_check = MappingNode
            elif node_check not in [ScalarNode, SequenceNode, MappingNode]  \
                    and not isinstance(node_check, str) \
                    and node_check is not None:
                raise ResolverError("Invalid node checker: %s" % node_check)
            if not isinstance(index_check, (str, int))  \
                    and index_check is not None:

            

Reported by Pylint.

Undefined variable 'ScalarNode'
Error

Line: 70 Column: 37

                              node_check = SequenceNode
            elif node_check is dict:
                node_check = MappingNode
            elif node_check not in [ScalarNode, SequenceNode, MappingNode]  \
                    and not isinstance(node_check, str) \
                    and node_check is not None:
                raise ResolverError("Invalid node checker: %s" % node_check)
            if not isinstance(index_check, (str, int))  \
                    and index_check is not None:

            

Reported by Pylint.

Undefined variable 'SequenceNode'
Error

Line: 70 Column: 49

                              node_check = SequenceNode
            elif node_check is dict:
                node_check = MappingNode
            elif node_check not in [ScalarNode, SequenceNode, MappingNode]  \
                    and not isinstance(node_check, str) \
                    and node_check is not None:
                raise ResolverError("Invalid node checker: %s" % node_check)
            if not isinstance(index_check, (str, int))  \
                    and index_check is not None:

            

Reported by Pylint.

Undefined variable 'ScalarNode'
Error

Line: 79 Column: 20

                              raise ResolverError("Invalid index checker: %s" % index_check)
            new_path.append((node_check, index_check))
        if kind is str:
            kind = ScalarNode
        elif kind is list:
            kind = SequenceNode
        elif kind is dict:
            kind = MappingNode
        elif kind not in [ScalarNode, SequenceNode, MappingNode]    \

            

Reported by Pylint.

collectors/python.d.plugin/haproxy/haproxy.chart.py
45 issues
Unable to import 'bases.FrameworkServices.SocketService'
Error

Line: 14 Column: 1

              except ImportError:
    from urllib.parse import urlparse

from bases.FrameworkServices.SocketService import SocketService
from bases.FrameworkServices.UrlService import UrlService

# charts order (can be overridden if you want less charts, or different order)
ORDER = [
    'fbin',

            

Reported by Pylint.

Unable to import 'bases.FrameworkServices.UrlService'
Error

Line: 15 Column: 1

                  from urllib.parse import urlparse

from bases.FrameworkServices.SocketService import SocketService
from bases.FrameworkServices.UrlService import UrlService

# charts order (can be overridden if you want less charts, or different order)
ORDER = [
    'fbin',
    'fbout',

            

Reported by Pylint.

TODO: the code is unreadable
Error

Line: 206 Column: 3

                           socket=re_compile(r'Idle_pct: (?P<idle>[0-9]+)'))


# TODO: the code is unreadable
class Service(UrlService, SocketService):
    def __init__(self, configuration=None, name=None):
        if 'socket' in configuration:
            SocketService.__init__(self, configuration=configuration, name=name)
            self.poll = SocketService

            

Reported by Pylint.

Attribute 'url' defined outside __init__
Error

Line: 233 Column: 23

              
    def _get_data(self):
        to_netdata = dict()
        self.request, self.url = self.options_['stat'], self.options_['stat']
        stat_data = self._get_stat_data()
        self.request, self.url = self.options_['info'], self.options_['info']
        info_data = self._get_info_data(regex=self.options_['regex'])

        to_netdata.update(stat_data)

            

Reported by Pylint.

Attribute 'request' defined outside __init__
Error

Line: 233 Column: 9

              
    def _get_data(self):
        to_netdata = dict()
        self.request, self.url = self.options_['stat'], self.options_['stat']
        stat_data = self._get_stat_data()
        self.request, self.url = self.options_['info'], self.options_['info']
        info_data = self._get_info_data(regex=self.options_['regex'])

        to_netdata.update(stat_data)

            

Reported by Pylint.

Attribute 'request' defined outside __init__
Error

Line: 235 Column: 9

                      to_netdata = dict()
        self.request, self.url = self.options_['stat'], self.options_['stat']
        stat_data = self._get_stat_data()
        self.request, self.url = self.options_['info'], self.options_['info']
        info_data = self._get_info_data(regex=self.options_['regex'])

        to_netdata.update(stat_data)
        to_netdata.update(info_data)
        return to_netdata or None

            

Reported by Pylint.

Attribute 'url' defined outside __init__
Error

Line: 235 Column: 23

                      to_netdata = dict()
        self.request, self.url = self.options_['stat'], self.options_['stat']
        stat_data = self._get_stat_data()
        self.request, self.url = self.options_['info'], self.options_['info']
        info_data = self._get_info_data(regex=self.options_['regex'])

        to_netdata.update(stat_data)
        to_netdata.update(info_data)
        return to_netdata or None

            

Reported by Pylint.

Access to a protected member _get_raw_data of a client class
Error

Line: 246 Column: 20

                      """
        :return: dict
        """
        raw_data = self.poll._get_raw_data(self)

        if not raw_data:
            return dict()

        raw_data = raw_data.splitlines()

            

Reported by Pylint.

Attribute 'data' defined outside __init__
Error

Line: 252 Column: 9

                          return dict()

        raw_data = raw_data.splitlines()
        self.data = parse_data_([dict(zip(raw_data[0].split(','), raw_data[_].split(',')))
                                 for _ in range(1, len(raw_data))])
        if not self.data:
            return dict()

        stat_data = dict()

            

Reported by Pylint.

Access to a protected member _get_raw_data of a client class
Error

Line: 285 Column: 20

                      """
        :return: dict
        """
        raw_data = self.poll._get_raw_data(self)
        if not raw_data:
            return dict()

        match = regex.search(raw_data)
        return match.groupdict() if match else dict()

            

Reported by Pylint.

web/api/tests/valid_urls.c
44 issues
printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 146 Column: 5 CWE codes: 134
Suggestion: Use a constant for the format specification

                  va_list args;
    va_start(args, fmt);
    printf("  DEBUG: ");
    printf(fmt, args);
    printf("\n");
    va_end(args);
}

void __wrap_info_int(const char *file, const char *function, const unsigned long line, const char *fmt, ...)

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 159 Column: 5 CWE codes: 134
Suggestion: Use a constant for the format specification

                  va_list args;
    va_start(args, fmt);
    printf("  INFO: ");
    printf(fmt, args);
    printf("\n");
    va_end(args);
}

void __wrap_error_int(

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 174 Column: 5 CWE codes: 134
Suggestion: Use a constant for the format specification

                  va_list args;
    va_start(args, fmt);
    printf("  ERROR: ");
    printf(fmt, args);
    printf("\n");
    va_end(args);
}

void __wrap_fatal_int(const char *file, const char *function, const unsigned long line, const char *fmt, ...)

            

Reported by FlawFinder.

printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 187 Column: 5 CWE codes: 134
Suggestion: Use a constant for the format specification

                  va_list args;
    va_start(args, fmt);
    printf("FATAL: ");
    printf(fmt, args);
    printf("\n");
    va_end(args);
    fail();
}


            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 87 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

              
int __wrap_web_client_api_request_v1(RRDHOST *host, struct web_client *w, char *url)
{
    char url_repr[160];
    repr(url_repr, sizeof(url_repr), url, strlen(url));
    printf("web_client_api_request_v1(url=\"%s\")\n", url_repr);
    check_expected_ptr(host);
    check_expected_ptr(w);
    check_expected_ptr(url_repr);

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 240 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

                  struct web_client *w = setup_fresh_web_client();
    buffer_strcat(w->response.data, "GET / HTTP/1.1\r\n\r\n");

    char debug[4096];
    repr(debug, sizeof(debug), w->response.data->buffer, w->response.data->len);
    printf("-> \"%s\"\n", debug);

    //char expected_url_repr[4096];
    //repr(expected_url_repr, sizeof(expected_url_repr), def->url_out_repr, strlen(def->url_out_repr));

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 268 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

                  struct web_client *w = setup_fresh_web_client();
    buffer_strcat(w->response.data, "GET // HTTP/1.1\r\n\r\n");

    char debug[4096];
    repr(debug, sizeof(debug), w->response.data->buffer, w->response.data->len);
    printf("-> \"%s\"\n", debug);

    //char expected_url_repr[4096];
    //repr(expected_url_repr, sizeof(expected_url_repr), def->url_out_repr, strlen(def->url_out_repr));

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 296 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

                  struct web_client *w = setup_fresh_web_client();
    buffer_strcat(w->response.data, "GET http://localhost:19999/api/v1/info HTTP/1.1\r\n\r\n");

    char debug[4096];
    repr(debug, sizeof(debug), w->response.data->buffer, w->response.data->len);
    printf("-> \"%s\"\n", debug);

    //char expected_url_repr[4096];
    //repr(expected_url_repr, sizeof(expected_url_repr), def->url_out_repr, strlen(def->url_out_repr));

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 326 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

                  struct web_client *w = setup_fresh_web_client();
    buffer_strcat(w->response.data, "GET /api/v1/info?blah HTTP/1.1\r\n\r\n");

    char debug[4096];
    repr(debug, sizeof(debug), w->response.data->buffer, w->response.data->len);
    printf("-> \"%s\"\n", debug);

    //char expected_url_repr[4096];
    //repr(expected_url_repr, sizeof(expected_url_repr), def->url_out_repr, strlen(def->url_out_repr));

            

Reported by FlawFinder.

char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 363 Column: 5 CWE codes: 119 120
Suggestion: Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length

                  struct web_client *w = setup_fresh_web_client();
    buffer_strcat(w->response.data, "\r\n\r\nGET /api/v1/info?blah HTTP/1.1\r\n\r\n");

    char debug[4096];
    repr(debug, sizeof(debug), w->response.data->buffer, w->response.data->len);
    printf("-> \"%s\"\n", debug);

    //char expected_url_repr[4096];
    //repr(expected_url_repr, sizeof(expected_url_repr), def->url_out_repr, strlen(def->url_out_repr));

            

Reported by FlawFinder.

collectors/python.d.plugin/adaptec_raid/adaptec_raid.chart.py
43 issues
Unable to import 'bases.FrameworkServices.ExecutableService'
Error

Line: 10 Column: 1

              import re
from copy import deepcopy

from bases.FrameworkServices.ExecutableService import ExecutableService
from bases.collection import find_binary

disabled_by_default = True

update_every = 5

            

Reported by Pylint.

Unable to import 'bases.collection'
Error

Line: 11 Column: 1

              from copy import deepcopy

from bases.FrameworkServices.ExecutableService import ExecutableService
from bases.collection import find_binary

disabled_by_default = True

update_every = 5


            

Reported by Pylint.

TODO: hardcoded sudo...
Error

Line: 138 Column: 3

                      return [self.arcconf, 'GETCONFIG', '1', 'PD']


# TODO: hardcoded sudo...
class SudoArcconf:
    def __init__(self, arcconf, sudo):
        self.arcconf = Arcconf(arcconf)
        self.sudo = sudo


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # -*- coding: utf-8 -*-
# Description: adaptec_raid netdata python.d module
# Author: Ilya Mashchenko (ilyam8)
# SPDX-License-Identifier: GPL-3.0-or-later


import re
from copy import deepcopy


            

Reported by Pylint.

Constant name "disabled_by_default" doesn't conform to UPPER_CASE naming style
Error

Line: 13 Column: 1

              from bases.FrameworkServices.ExecutableService import ExecutableService
from bases.collection import find_binary

disabled_by_default = True

update_every = 5

ORDER = [
    'ld_status',

            

Reported by Pylint.

Constant name "update_every" doesn't conform to UPPER_CASE naming style
Error

Line: 15 Column: 1

              
disabled_by_default = True

update_every = 5

ORDER = [
    'ld_status',
    'pd_state',
    'pd_smart_warnings',

            

Reported by Pylint.

Line too long (105/100)
Error

Line: 26 Column: 1

              
CHARTS = {
    'ld_status': {
        'options': [None, 'Status of logical devices (1: Failed or Degraded)', 'bool', 'logical devices',
                    'adaptec_raid.ld_status', 'line'],
        'lines': []
    },
    'pd_state': {
        'options': [None, 'State of physical devices (1: not Online)', 'bool', 'physical devices',

            

Reported by Pylint.

Line too long (108/100)
Error

Line: 41 Column: 1

                      'lines': []
    },
    'pd_temperature': {
        'options': [None, 'Temperature', 'celsius', 'physical devices', 'adaptec_raid.temperature', 'line'],
        'lines': []
    },
}

SUDO = 'sudo'

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 64 Column: 1

              )


def find_lds(d):
    d = ' '.join(v.strip() for v in d)
    return [LD(*v) for v in RE_LD.findall(d)]


def find_pds(d):

            

Reported by Pylint.

Argument name "d" doesn't conform to snake_case naming style
Error

Line: 64 Column: 1

              )


def find_lds(d):
    d = ' '.join(v.strip() for v in d)
    return [LD(*v) for v in RE_LD.findall(d)]


def find_pds(d):

            

Reported by Pylint.

collectors/python.d.plugin/python_modules/urllib3/connection.py
43 issues
Attempted relative import beyond top-level package
Error

Line: 10 Column: 1

              import socket
from socket import error as SocketError, timeout as SocketTimeout
import warnings
from .packages import six
from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection
from .packages.six.moves.http_client import HTTPException  # noqa: F401

try:  # Compiled with SSL?
    import ssl

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 11 Column: 1

              from socket import error as SocketError, timeout as SocketTimeout
import warnings
from .packages import six
from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection
from .packages.six.moves.http_client import HTTPException  # noqa: F401

try:  # Compiled with SSL?
    import ssl
    BaseSSLError = ssl.SSLError

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 12 Column: 1

              import warnings
from .packages import six
from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection
from .packages.six.moves.http_client import HTTPException  # noqa: F401

try:  # Compiled with SSL?
    import ssl
    BaseSSLError = ssl.SSLError
except (ImportError, AttributeError):  # Platform-specific: No SSL.

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 32 Column: 1

                      pass


from .exceptions import (
    NewConnectionError,
    ConnectTimeoutError,
    SubjectAltNameWarning,
    SystemTimeWarning,
)

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 38 Column: 1

                  SubjectAltNameWarning,
    SystemTimeWarning,
)
from .packages.ssl_match_hostname import match_hostname, CertificateError

from .util.ssl_ import (
    resolve_cert_reqs,
    resolve_ssl_version,
    assert_fingerprint,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 40 Column: 1

              )
from .packages.ssl_match_hostname import match_hostname, CertificateError

from .util.ssl_ import (
    resolve_cert_reqs,
    resolve_ssl_version,
    assert_fingerprint,
    create_urllib3_context,
    ssl_wrap_socket

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 49 Column: 1

              )


from .util import connection

from ._collections import HTTPHeaderDict

log = logging.getLogger(__name__)


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 51 Column: 1

              
from .util import connection

from ._collections import HTTPHeaderDict

log = logging.getLogger(__name__)

port_by_scheme = {
    'http': 80,

            

Reported by Pylint.

Unused HTTPException imported from packages.six.moves.http_client
Error

Line: 12 Column: 1

              import warnings
from .packages import six
from .packages.six.moves.http_client import HTTPConnection as _HTTPConnection
from .packages.six.moves.http_client import HTTPException  # noqa: F401

try:  # Compiled with SSL?
    import ssl
    BaseSSLError = ssl.SSLError
except (ImportError, AttributeError):  # Platform-specific: No SSL.

            

Reported by Pylint.

Redefining built-in 'ConnectionError'
Error

Line: 26 Column: 5

              
try:  # Python 3:
    # Not a no-op, we're adding this to the namespace so it can be imported.
    ConnectionError = ConnectionError
except NameError:  # Python 2:
    class ConnectionError(Exception):
        pass



            

Reported by Pylint.

collectors/python.d.plugin/python_modules/pyyaml2/dumper.py
43 issues
Unable to import 'emitter'
Error

Line: 5 Column: 1

              
__all__ = ['BaseDumper', 'SafeDumper', 'Dumper']

from emitter import *
from serializer import *
from representer import *
from resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

            

Reported by Pylint.

Unable to import 'serializer'
Error

Line: 6 Column: 1

              __all__ = ['BaseDumper', 'SafeDumper', 'Dumper']

from emitter import *
from serializer import *
from representer import *
from resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):


            

Reported by Pylint.

Unable to import 'representer'
Error

Line: 7 Column: 1

              
from emitter import *
from serializer import *
from representer import *
from resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

    def __init__(self, stream,

            

Reported by Pylint.

Unable to import 'resolver'
Error

Line: 8 Column: 1

              from emitter import *
from serializer import *
from representer import *
from resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

    def __init__(self, stream,
            default_style=None, default_flow_style=None,

            

Reported by Pylint.

Undefined variable 'BaseRepresenter'
Error

Line: 10 Column: 39

              from representer import *
from resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

    def __init__(self, stream,
            default_style=None, default_flow_style=None,
            canonical=None, indent=None, width=None,
            allow_unicode=None, line_break=None,

            

Reported by Pylint.

Undefined variable 'Serializer'
Error

Line: 10 Column: 27

              from representer import *
from resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

    def __init__(self, stream,
            default_style=None, default_flow_style=None,
            canonical=None, indent=None, width=None,
            allow_unicode=None, line_break=None,

            

Reported by Pylint.

Undefined variable 'Emitter'
Error

Line: 10 Column: 18

              from representer import *
from resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

    def __init__(self, stream,
            default_style=None, default_flow_style=None,
            canonical=None, indent=None, width=None,
            allow_unicode=None, line_break=None,

            

Reported by Pylint.

Undefined variable 'BaseResolver'
Error

Line: 10 Column: 56

              from representer import *
from resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

    def __init__(self, stream,
            default_style=None, default_flow_style=None,
            canonical=None, indent=None, width=None,
            allow_unicode=None, line_break=None,

            

Reported by Pylint.

Undefined variable 'Emitter'
Error

Line: 18 Column: 9

                          allow_unicode=None, line_break=None,
            encoding=None, explicit_start=None, explicit_end=None,
            version=None, tags=None):
        Emitter.__init__(self, stream, canonical=canonical,
                indent=indent, width=width,
                allow_unicode=allow_unicode, line_break=line_break)
        Serializer.__init__(self, encoding=encoding,
                explicit_start=explicit_start, explicit_end=explicit_end,
                version=version, tags=tags)

            

Reported by Pylint.

Undefined variable 'Serializer'
Error

Line: 21 Column: 9

                      Emitter.__init__(self, stream, canonical=canonical,
                indent=indent, width=width,
                allow_unicode=allow_unicode, line_break=line_break)
        Serializer.__init__(self, encoding=encoding,
                explicit_start=explicit_start, explicit_end=explicit_end,
                version=version, tags=tags)
        Representer.__init__(self, default_style=default_style,
                default_flow_style=default_flow_style)
        Resolver.__init__(self)

            

Reported by Pylint.

collectors/python.d.plugin/python_modules/pyyaml3/dumper.py
43 issues
Attempted relative import beyond top-level package
Error

Line: 5 Column: 1

              
__all__ = ['BaseDumper', 'SafeDumper', 'Dumper']

from .emitter import *
from .serializer import *
from .representer import *
from .resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 6 Column: 1

              __all__ = ['BaseDumper', 'SafeDumper', 'Dumper']

from .emitter import *
from .serializer import *
from .representer import *
from .resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 7 Column: 1

              
from .emitter import *
from .serializer import *
from .representer import *
from .resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

    def __init__(self, stream,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 8 Column: 1

              from .emitter import *
from .serializer import *
from .representer import *
from .resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

    def __init__(self, stream,
            default_style=None, default_flow_style=None,

            

Reported by Pylint.

Undefined variable 'BaseResolver'
Error

Line: 10 Column: 56

              from .representer import *
from .resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

    def __init__(self, stream,
            default_style=None, default_flow_style=None,
            canonical=None, indent=None, width=None,
            allow_unicode=None, line_break=None,

            

Reported by Pylint.

Undefined variable 'BaseRepresenter'
Error

Line: 10 Column: 39

              from .representer import *
from .resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

    def __init__(self, stream,
            default_style=None, default_flow_style=None,
            canonical=None, indent=None, width=None,
            allow_unicode=None, line_break=None,

            

Reported by Pylint.

Undefined variable 'Emitter'
Error

Line: 10 Column: 18

              from .representer import *
from .resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

    def __init__(self, stream,
            default_style=None, default_flow_style=None,
            canonical=None, indent=None, width=None,
            allow_unicode=None, line_break=None,

            

Reported by Pylint.

Undefined variable 'Serializer'
Error

Line: 10 Column: 27

              from .representer import *
from .resolver import *

class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver):

    def __init__(self, stream,
            default_style=None, default_flow_style=None,
            canonical=None, indent=None, width=None,
            allow_unicode=None, line_break=None,

            

Reported by Pylint.

Undefined variable 'Emitter'
Error

Line: 18 Column: 9

                          allow_unicode=None, line_break=None,
            encoding=None, explicit_start=None, explicit_end=None,
            version=None, tags=None):
        Emitter.__init__(self, stream, canonical=canonical,
                indent=indent, width=width,
                allow_unicode=allow_unicode, line_break=line_break)
        Serializer.__init__(self, encoding=encoding,
                explicit_start=explicit_start, explicit_end=explicit_end,
                version=version, tags=tags)

            

Reported by Pylint.

Undefined variable 'Serializer'
Error

Line: 21 Column: 9

                      Emitter.__init__(self, stream, canonical=canonical,
                indent=indent, width=width,
                allow_unicode=allow_unicode, line_break=line_break)
        Serializer.__init__(self, encoding=encoding,
                explicit_start=explicit_start, explicit_end=explicit_end,
                version=version, tags=tags)
        Representer.__init__(self, default_style=default_style,
                default_flow_style=default_flow_style)
        Resolver.__init__(self)

            

Reported by Pylint.