duncanmmacleod/requests-ecp

View on GitHub

Showing 34 of 34 total issues

Function is_gitlab_auth_redirect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def is_gitlab_auth_redirect(response):
    """Return `True` if a response indicates a gitlab auth redirect.

    Parameters
    ----------
Severity: Minor
Found in requests_ecp/auth.py - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

At least two spaces before inline comment
Open

</S:Envelope>""".strip(), # noqa
Severity: Minor
Found in requests_ecp/ecp.py by pep8

Separate inline comments by at least two spaces.

An inline comment is a comment on the same line as a statement.
Inline comments should be separated by at least two spaces from the
statement. They should start with a # and a single space.

Each line of a block comment starts with a # and a single space
(unless it is indented text inside the comment).

Okay: x = x + 1  # Increment x
Okay: x = x + 1    # Increment x
Okay: # Block comment
E261: x = x + 1 # Increment x
E262: x = x + 1  #Increment x
E262: x = x + 1  #  Increment x
E265: #Block comment
E266: ### Block comment

Possible hardcoded password: 'mypasswd'
Open

        auth = self.TEST_CLASS._init_auth(
            "https://idp.test.com",
            username="me",
            password="mypasswd",
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert isinstance(auth, HTTPBasicAuth)
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert session.auth._num_ecp_auth == 0
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit

Using etree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace etree with the equivalent defusedxml package.
Open

from lxml import etree

Severity: Info
Found in requests_ecp/tests/test_ecp.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert auth.username == "me"
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert auth.password == "mypasswd"
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert requests_ecp_auth.is_ecp_auth_redirect(resp)
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert isinstance(auth, requests_gssapi.HTTPKerberosAuth)
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert requests_mock.call_count == 3
Severity: Info
Found in requests_ecp/tests/test_session.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert requests_ecp_auth.is_gitlab_auth_redirect(resp)
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert not requests_ecp_auth.is_gitlab_auth_redirect(resp)
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit

Possible hardcoded password: 'passwd'
Open

            session.auth = self.TEST_CLASS(
                idp="test",
                username="user",
                password="passwd",
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit

Possible hardcoded password: 'passwd'
Open

            session.auth = self.TEST_CLASS(
                idp="test",
                username="user",
                password="passwd",
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

    assert ecp._get_xml_attribute(
        etree.XML(SP_ECP_PAOS_RESPONSE),
        "//ecp:RelayState",
    ).text.strip() == "relay_state_text"
Severity: Info
Found in requests_ecp/tests/test_ecp.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert auth.password == "passwd"
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert sess.auth.idp == "test"
Severity: Info
Found in requests_ecp/tests/test_session.py by bandit

Using etree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace etree with the equivalent defusedxml package.
Open

from lxml import etree

Severity: Info
Found in requests_ecp/ecp.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert auth.username == "me"
Severity: Info
Found in requests_ecp/tests/test_auth.py by bandit
Severity
Category
Status
Source
Language