psono/psono-server

View on GitHub

Showing 228 of 423 total issues

Function validate_username has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_username(self, value):

        # According to RFC2142 all "authoritative" email addresses are:
        # ( https://www.ietf.org/rfc/rfc2142.txt )

Severity: Minor
Found in psono/restapi/serializers/register.py - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self, attrs: dict) -> dict:

        # We hardcode the settings for scrypt and the hashing parameters, as every client that is not providing them
        # is using those parameters below internally
        hashing_algorithm = attrs.get('hashing_algorithm', 'scrypt')
Severity: Minor
Found in psono/restapi/serializers/register.py - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self, attrs: dict) -> dict:

        request_type = attrs.get('request_type', '').lower().strip()

        if request_type not in ['notification', 'verification']:
Severity: Minor
Found in psono/restapi/serializers/ivalt_verify.py - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, request, group_id = None, *args, **kwargs):
        """
        Returns a list of all groups

        :param args:
Severity: Minor
Found in psono/administration/views/group.py - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(self, attrs: dict) -> dict:

        username = attrs.get('username')
        emergency_authkey = attrs.get('emergency_authkey')

Severity: Minor
Found in psono/restapi/serializers/activate_emergency_login.py - About 1 hr 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 11 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, request, user_id = None, *args, **kwargs):
        """
        Returns a list of all users or a the infos of a single user

        :param args:
Severity: Minor
Found in psono/administration/views/user.py - About 1 hr 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 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def get(self, request, *args, **kwargs):
        """
        Returns the Server's signed information and some additional data for a nice dashboard

        :param request:
Severity: Minor
Found in psono/administration/views/info.py - About 1 hr to fix

    Function put has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def put(self, request, *args, **kwargs):
            """
            Second step of the recovery code password reset.
            Validates the code and sets the new password.
    
    
    Severity: Minor
    Found in psono/restapi/views/password.py - About 1 hr to fix

      Function api_create_secret has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def api_create_secret(token, session_secret_key, encrypted_data, encrypted_data_nonce, link_id, parent_share_id, callback_url, callback_user, callback_pass):
      Severity: Major
      Found in examples/create_secret_in_share.py - About 1 hr to fix

        Function duo_auth_auth has 9 arguments (exceeds 4 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:
        Severity: Major
        Found in psono/restapi/utils/duo.py - About 1 hr to fix

          Function api_create_secret has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def api_create_secret(token, session_secret_key, encrypted_data, encrypted_data_nonce, link_id, parent_datastore_id, callback_url, callback_user, callback_pass):
          Severity: Major
          Found in examples/create_secret_in_datastore.py - About 1 hr to fix

            Function validate has 28 lines of code (exceeds 25 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_upload.py - About 1 hr to fix

              Function validate_cluster_shard_access has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate_cluster_shard_access(cluster_id, announced_shards):
              
                      fcsls = Fileserver_Cluster_Shard_Link.objects.filter(cluster_id=cluster_id).only('read', 'write', 'delete_capability', 'allow_link_shares').all()
                      shards = {}
                      for fcsl in fcsls:
              Severity: Minor
              Found in psono/restapi/authentication.py - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate(self, attrs: dict) -> dict:
              
                      login_info = attrs.get('login_info')
                      login_info_nonce = attrs.get('login_info_nonce')
                      public_key = attrs.get('public_key')
              Severity: Minor
              Found in psono/restapi/serializers/login.py - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate(self, attrs: dict) -> dict:
              
                      user_id = attrs.get('user_id', False)
                      group_id = attrs.get('group_id', False)
              
              
              Severity: Minor
              Found in psono/restapi/serializers/update_share_right.py - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def validate(self, attrs: dict) -> dict:
                      avatar_id = self.context['request'].parser_context['kwargs'].get('avatar_id', False)
                      user_id = self.context['request'].parser_context['kwargs'].get('user_id', False)
              
              
              
              Severity: Minor
              Found in psono/restapi/serializers/read_avatar.py - About 1 hr 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 10 (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_upload.py - About 1 hr 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 main has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def main():
                  # 1. Generate the login info including the private key for PFS
                  session_private_key, client_login_info = generate_client_login_info()
              
                  # 2. Send the login request and handle eventual exceptions, problems and so on ...
              Severity: Minor
              Found in examples/create_secret_in_share.py - About 1 hr to fix

                Function validate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def validate(self, attrs: dict) -> dict:
                
                        title = attrs.get('title', '').strip()
                        integration_key = attrs.get('integration_key', '').strip()
                        secret_key = attrs.get('secret_key', '').strip()
                Severity: Minor
                Found in psono/restapi/serializers/new_duo.py - About 1 hr to fix

                  Function validate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def validate(self, attrs: dict) -> dict:
                  
                          login_info = attrs.get('login_info')
                          login_info_nonce = attrs.get('login_info_nonce')
                          public_key = attrs.get('public_key')
                  Severity: Minor
                  Found in psono/restapi/serializers/login.py - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language