cyberark/secretless-broker

View on GitHub

Showing 1,856 of 1,876 total issues

Line is too long. [91/80]
Open

# This is the default theme for new Jekyll sites. You may change this to anything you like.
Severity: Minor
Found in docs/Gemfile by rubocop

This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop. It also ignores a shebang line by default.

This cop has some autocorrection capabilities. It can programmatically shorten certain long lines by inserting line breaks into expressions that can be safely split across lines. These include arrays, hashes, and method calls with argument lists.

If autocorrection is enabled, the following Layout cops are recommended to further format the broken lines.

- ParameterAlignment
- ArgumentAlignment
- ClosingParenthesisIndentation
- FirstArgumentIndentation
- FirstArrayElementIndentation
- FirstHashElementIndentation
- FirstParameterIndentation
- HashAlignment
- MultilineArrayLineBreaks
- MultilineHashBraceLayout
- MultilineHashKeyLineBreaks
- MultilineMethodArgumentLineBreaks

Together, these cops will pretty print hashes, arrays, method calls, etc. For example, let's say the max columns is 25:

Example:

# bad
{foo: "0000000000", bar: "0000000000", baz: "0000000000"}

# good
{foo: "0000000000",
bar: "0000000000", baz: "0000000000"}

# good (with recommended cops enabled)
{
  foo: "0000000000",
  bar: "0000000000",
  baz: "0000000000",
}

Function main has 74 lines of code (exceeds 70 allowed). Consider refactoring.
Open

func main() {
    log.Println("Secretless CRD watcher starting up...")

    var kubeConfig *string
    if home := getHomeDir(); home != "" {
Severity: Minor
Found in resource-definitions/crd_watcher.go - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            go func() {
                for {
                    data := make([]byte, 1024)
                    len, err := clientChannel.Read(data)
                    if err == io.EOF {
    Severity: Major
    Found in internal/plugin/connectors/ssh/service_connector.go and 1 other location - About 1 hr to fix
    internal/plugin/connectors/ssh/service_connector.go on lines 171..186

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 139.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            go func() {
                for {
                    data := make([]byte, 1024)
                    len, err := serverChannel.Read(data)
                    if err == io.EOF {
    Severity: Major
    Found in internal/plugin/connectors/ssh/service_connector.go and 1 other location - About 1 hr to fix
    internal/plugin/connectors/ssh/service_connector.go on lines 154..169

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 139.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function handleAuthSCRAM has 14 return statements (exceeds 7 allowed).
    Open

    func handleAuthSCRAM(username string, password string, connection net.Conn) error {
        sc := scram.NewClient(sha256.New, username, password)
        sc.Step(nil)
        if sc.Err() != nil {
            return fmt.Errorf("SCRAM-SHA-256 error: %s", sc.Err().Error())
    Severity: Major
    Found in internal/plugin/connectors/tcp/pg/protocol/auth.go - About 1 hr to fix

      Function UnpackHandshakeV10 has 14 return statements (exceeds 7 allowed).
      Open

      func UnpackHandshakeV10(packet []byte) (*HandshakeV10, error) {
          r := bytes.NewReader(packet)
      
          // Header
          header, err := GetPacketHeader(r)
      Severity: Major
      Found in internal/plugin/connectors/tcp/mysql/protocol/protocol.go - About 1 hr to fix

        Function UnpackHandshakeResponse41 has 72 lines of code (exceeds 70 allowed). Consider refactoring.
        Open

        func UnpackHandshakeResponse41(packet []byte) (*HandshakeResponse41, error) {
            r := bytes.NewReader(packet)
        
            // Skip packet header (but save in struct)
            header, err := GetPacketHeader(r)
        Severity: Minor
        Found in internal/plugin/connectors/tcp/mysql/protocol/protocol.go - About 1 hr to fix

          Function TestV1HttpHandlerConversion has 72 lines of code (exceeds 70 allowed). Consider refactoring.
          Open

          func TestV1HttpHandlerConversion(t *testing.T) {
              t.Run("connectorConfig field maps correctly", func(t *testing.T) {
                  v1Cfg := v1HttpExample()
                  v2Cfg, err := NewV2Config(v1Cfg)
                  assert.NoError(t, err)
          Severity: Minor
          Found in pkg/secretless/config/v1/v2_conversion_test.go - About 1 hr to fix

            Function UnpackHandshakeV10 has a Cognitive Complexity of 24 (exceeds 20 allowed). Consider refactoring.
            Open

            func UnpackHandshakeV10(packet []byte) (*HandshakeV10, error) {
                r := bytes.NewReader(packet)
            
                // Header
                header, err := GetPacketHeader(r)
            Severity: Minor
            Found in internal/plugin/connectors/tcp/mysql/protocol/protocol.go - 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func TestAddressCanBeUsedInsteadOfHostAndPort(t *testing.T) {
                options := map[string][]byte{
                    "address": []byte("myhost2:12345"),
                }
            
            
            Severity: Minor
            Found in internal/plugin/connectors/tcp/pg/connect_details_test.go and 1 other location - About 50 mins to fix
            internal/plugin/connectors/tcp/pg/connect_details_test.go on lines 137..149

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 121.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            func TestAddressWithoutPortCanBeUsedInsteadOfHostAndPort(t *testing.T) {
                options := map[string][]byte{
                    "address": []byte("myhost2"),
                }
            
            
            Severity: Minor
            Found in internal/plugin/connectors/tcp/pg/connect_details_test.go and 1 other location - About 50 mins to fix
            internal/plugin/connectors/tcp/pg/connect_details_test.go on lines 123..135

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 121.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    go func() {
                        for serverRequest := range serverRequests {
                            h.logger.Debugf("Server request : %s", serverRequest.Type)
                            ok, err := clientChannel.SendRequest(serverRequest.Type, serverRequest.WantReply, serverRequest.Payload)
                            if err != nil {
            Severity: Minor
            Found in internal/plugin/connectors/ssh/service_connector.go and 1 other location - About 50 mins to fix
            internal/plugin/connectors/ssh/service_connector.go on lines 122..133

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 120.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    go func() {
                        for clientRequest := range clientRequests {
                            h.logger.Debugf("Client request : %s", clientRequest.Type)
                            ok, err := serverChannel.SendRequest(clientRequest.Type, clientRequest.WantReply, clientRequest.Payload)
                            if err != nil {
            Severity: Minor
            Found in internal/plugin/connectors/ssh/service_connector.go and 1 other location - About 50 mins to fix
            internal/plugin/connectors/ssh/service_connector.go on lines 135..146

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 120.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function UnpackHandshakeResponse41 has 11 return statements (exceeds 7 allowed).
            Open

            func UnpackHandshakeResponse41(packet []byte) (*HandshakeResponse41, error) {
                r := bytes.NewReader(packet)
            
                // Skip packet header (but save in struct)
                header, err := GetPacketHeader(r)
            Severity: Major
            Found in internal/plugin/connectors/tcp/mysql/protocol/protocol.go - About 50 mins to fix

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  runCommand := func(args []string) (lines []string, err error) {
                      var buffer bytes.Buffer
                      writer := bufio.NewWriter(&buffer)
              
                      err = command.RunCLI(args, writer)
              Severity: Minor
              Found in test/providers/vault/vault_summon_test.go and 1 other location - About 45 mins to fix
              test/summon2/summon2_cmd_test.go on lines 21..32

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 116.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  runCommand := func(args []string) (lines []string, err error) {
                      var buffer bytes.Buffer
                      writer := bufio.NewWriter(&buffer)
              
                      err = command.RunCLI(args, writer)
              Severity: Minor
              Found in test/summon2/summon2_cmd_test.go and 1 other location - About 45 mins to fix
              test/providers/vault/vault_summon_test.go on lines 25..36

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 116.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              func (logger *Logger) panicln(sev severity, args ...interface{}) {
                  if !logger.shouldPrint(sev) {
                      return
                  }
              
              
              Severity: Minor
              Found in internal/log/log.go and 1 other location - About 45 mins to fix
              internal/log/log.go on lines 124..136

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 113.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              func (logger *Logger) logln(sev severity, args ...interface{}) {
                  if !logger.shouldPrint(sev) {
                      return
                  }
              
              
              Severity: Minor
              Found in internal/log/log.go and 1 other location - About 45 mins to fix
              internal/log/log.go on lines 160..172

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 113.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              func TestAddress(t *testing.T) {
                  options := map[string][]byte{
                      "host": []byte("myhost2"),
                      "port": []byte("12345"),
                  }
              Severity: Minor
              Found in internal/plugin/connectors/tcp/pg/connect_details_test.go and 1 other location - About 45 mins to fix
              internal/plugin/connectors/tcp/mysql/connection_details_test.go on lines 87..99

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 113.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              func TestAddress(t *testing.T) {
                  credentials := map[string][]byte{
                      "host": []byte("myhost2"),
                      "port": []byte("12345"),
                  }
              Severity: Minor
              Found in internal/plugin/connectors/tcp/mysql/connection_details_test.go and 1 other location - About 45 mins to fix
              internal/plugin/connectors/tcp/pg/connect_details_test.go on lines 151..163

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 113.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language