alsutton/enterprisepasswordsafe

View on GitHub

Showing 206 of 206 total issues

Method doPost has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
            throws IOException, ServletException{
        String csrfToken = request.getParameter("token");
        if(csrfToken == null || !csrfToken.equals(request.getSession(true).getAttribute("csrfToken"))) {

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

Method doGet has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
            throws IOException, ServletException {
        request.setAttribute("error_page", "/admin/AuthSources");

    Method getDefaultPermissionsForNodeIncludingInherited has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public void getDefaultPermissionsForNodeIncludingInherited(final String nodeId,
                                                                   final Map<String,PasswordPermission> userPermMap,
                                                                   final Map<String,PasswordPermission> groupPermMap)
                throws SQLException, GeneralSecurityException {
            if( nodeId == null )

      Method process has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              @Override
              public void process(final HierarchyNode node, final Password password) {
                  if (password == null || password.getPasswordType() == Password.TYPE_PERSONAL) {
                      return;
                  }

        Method process has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public void process(final HierarchyNode node, final Password testPassword)
                throws  GeneralSecurityException, SQLException, UnsupportedEncodingException {
                if (testPassword == null || !testPassword.expires()) {
                    return;

          Method update has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public void update()
                      throws SQLException, UnsupportedEncodingException, GeneralSecurityException {
                  synchronized(SchemaVersion.class) {
                      Long currentSchema = getCurrentSchemaVersion();
                      if (currentSchema == null) {

            Method doEndTag has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public int doEndTag() {
                    try {
                        JspWriter writer = pageContext.getOut();
                        writer.print("<input type=\"");
                        writer.print(type);

              Method doGet has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @Override
                  protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
                          throws IOException, ServletException {
                      request.setAttribute("error_page", "/admin/ViewGroups");
              
              

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

                    public PasswordRestriction create(final String name, final int minLower,
                            final int minUpper, final int minNumeric, final int minSpecial,
                            final int minLength, final int maxLength, final String special,
                            final int lifetime)

                  Method doGet has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Override
                      protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
                          throws ServletException {
                          Map<String,String> systemProperties = new TreeMap<>();
                  
                  

                    Method valueOfToken has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private String valueOfToken(final String variable)
                                throws SQLException {
                            int colonIdx = variable.indexOf(':');
                            if (colonIdx == -1) {
                                return variable;

                      Method getModule has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private AuthenticationSourceModule getModule() {
                              if( module != null )
                                  return module;
                              
                              synchronized(this) {

                        Method generate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public String generate( final int upperCount, final int lowerCount,
                                    final int numericCount, int specialCount, int minLength,
                                    int maxLength, final String specialChars, boolean startSpecial ) {
                                if(    specialChars.length() > 0
                                &&  specialCount > 0

                        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

                        Method doPost has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @Override
                            protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
                                    throws ServletException, IOException {
                                try {
                                    String zoneName = request.getParameter("zonename");

                        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

                        Method valueOfToken has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private String valueOfToken(final String variable)
                                    throws SQLException {
                                int colonIdx = variable.indexOf(':');
                                if (colonIdx == -1) {
                                    return variable;

                        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

                        Method getAccessibilityForUser has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @Override
                            public byte getAccessibilityForUser( final String nodeId, final User user, boolean recurse)
                                throws SQLException, GeneralSecurityException {
                                if(nodeId == null || nodeId.equals(HierarchyNode.ROOT_NODE_ID)) {
                                    return ACCESIBILITY_ALLOWED;

                        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

                        Method doPost has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @Override
                            protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
                                    throws IOException, ServletException {
                                request.setAttribute("error_page", "/admin/CreateUser");
                        
                        

                        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

                        Method validateSelectedNodes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private void validateSelectedNodes(User deletingUser, HierarchyNode parent, String[] nodes)
                                    throws SQLException, GeneralSecurityException, UnsupportedEncodingException {
                                for (String thisNodeId : nodes) {
                                    if (thisNodeId != null && thisNodeId.startsWith("p_")) {
                                        thisNodeId = hierarchyNodeDAO.getNodeIDForObject(parent.getNodeId(), thisNodeId.substring(2));

                        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

                        Method getAccessibilityForUser has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            @Override
                            public byte getAccessibilityForUser( final String nodeId, final User user, boolean recurse)
                                throws SQLException, GeneralSecurityException {
                                if(nodeId == null || nodeId.equals(HierarchyNode.ROOT_NODE_ID)) {
                                    return ACCESIBILITY_ALLOWED;

                        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

                        Method doPost has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            @Override
                            protected void doPost( final HttpServletRequest request, final HttpServletResponse response)
                                throws IOException, ServletException {
                                User thisUser = SecurityUtils.getRemoteUser(request);
                        
                        
                          Severity
                          Category
                          Status
                          Source
                          Language