psono/psono-server

View on GitHub

Showing 228 of 423 total issues

Function create_secret has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

def create_secret(
Severity: Major
Found in examples/create_secret_in_share.py - About 1 hr to fix

    Function decrypt_secret has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def decrypt_secret(encrypted_secret_hex, encrypted_secret_hex_nonce, password, user_sauce, u, r, p, l) -> bytes:
    Severity: Major
    Found in psono/restapi/utils/various.py - About 1 hr to fix

      Function create_secret has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def create_secret(
      Severity: Major
      Found in examples/create_secret_in_datastore.py - About 1 hr to fix

        Function duo_auth_check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def duo_auth_check(integration_key: str, secret_key: str, host: str) -> dict:
            """
            Calls the Duo auth check api
        
            :param integration_key: The Duo integration key
        Severity: Minor
        Found in psono/restapi/utils/duo.py - About 55 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

        Function setup_user_in_baggage_and_spans has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def setup_user_in_baggage_and_spans(user, token):
            if not is_opentelemetry_enabled():
                return
        
            current_span = get_current_span()
        Severity: Minor
        Found in psono/restapi/telemetry.py - About 55 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

        Function get_ip has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_ip(request):
            """
            Analyzes a request and returns the ip of the client.
        
            :param request:
        Severity: Minor
        Found in psono/restapi/utils/various.py - About 55 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

        Function duo_auth_auth has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def duo_auth_auth(integration_key: str, secret_key: str, host: str, username: str, factor: str, device: str = None, pushinfo: str = None, passcode: str = None, async_txn: bool = False) -> dict:
            """
            Auth call with the user id
        
            :param integration_key: The Duo integration key
        Severity: Minor
        Found in psono/restapi/utils/duo.py - About 55 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

        Function get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def get(self, request, *args, **kwargs):
                """
                Returns the user status, e.g. unapproved shares and so on
        
                :param request:
        Severity: Minor
        Found in psono/restapi/views/status.py - About 55 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

        Function post has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def post(self, request, *args, **kwargs):
                """
                Use a link share to access a secret.
        
                :param request:
        Severity: Minor
        Found in psono/restapi/views/link_share_access.py - About 55 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

        Function duo_auth_enroll_status has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def duo_auth_enroll_status(integration_key: str, secret_key: str, host: str, user_id: str, activation_code: str) -> dict:
            """
            Anonymous enrollment of a new device
        
            :param integration_key: The Duo integration key
        Severity: Minor
        Found in psono/restapi/utils/duo.py - About 55 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

        Function validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self, attrs: dict) -> dict:
                parent_share_id = attrs.get('parent_share_id', None)
                parent_datastore_id = attrs.get('parent_datastore_id', None)
        
        
        
        Severity: Minor
        Found in psono/restapi/serializers/bulk_create_secret.py - About 55 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

        Function validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self, attrs: dict) -> dict:
        
                secret_id = attrs.get('secret_id', None)
                file_id = attrs.get('file_id', None)
                allowed_reads = attrs.get('allowed_reads', None)
        Severity: Minor
        Found in psono/restapi/serializers/create_link_share.py - About 55 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

        Function validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self, attrs: dict) -> dict:
                parent_share_id = attrs.get('parent_share_id', None)
                parent_datastore_id = attrs.get('parent_datastore_id', None)
        
                if parent_share_id is None and parent_datastore_id is None:
        Severity: Minor
        Found in psono/restapi/serializers/create_secret.py - About 55 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

        Function save has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def save(self, *args, **kwargs):
        
                try:
                    stored_user = User.objects.get(pk=self.id)
        
        
        Severity: Minor
        Found in psono/restapi/models.py - About 55 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

        Function validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self, attrs: dict) -> dict:
        
                user_id = attrs.get('user_id')
                is_active = attrs.get('is_active', None)
                is_email_active = attrs.get('is_email_active', None)
        Severity: Minor
        Found in psono/administration/serializers/update_user.py - About 55 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

        Function validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self, attrs: dict) -> dict:
        
                api_key_id = attrs.get('api_key_id')
                secret_id = attrs.get('secret_id')
                api_key_secret_key = attrs.get('api_key_secret_key', False)
        Severity: Minor
        Found in psono/restapi/serializers/read_secret_with_api_key.py - About 55 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

        Function validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self, attrs: dict) -> dict:
                parent_share_id = attrs.get('parent_share_id', None)
                parent_datastore_id = attrs.get('parent_datastore_id', None)
                key_type = attrs.get('key_type')
        
        
        Severity: Minor
        Found in psono/restapi/serializers/create_share.py - About 55 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

        Function validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def validate(self, attrs: dict) -> dict:
        
                file_transfer_id = attrs.get('file_transfer_id')
                ticket_encrypted = attrs.get('ticket')
                ticket_nonce = attrs.get('ticket_nonce')
        Severity: Minor
        Found in psono/fileserver/serializers/authorize_download.py - About 55 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

        Function encrypt_secret has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def encrypt_secret(secret, password, user_sauce, u, r, p, l) -> Tuple[bytes, bytes]:
        Severity: Major
        Found in psono/restapi/utils/various.py - About 50 mins to fix

          Function generate_authkey has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def generate_authkey(username, password, u, r, p, l) -> bytes:
          Severity: Minor
          Found in psono/restapi/utils/various.py - About 45 mins to fix
            Severity
            Category
            Status
            Source
            Language