ory-am/hydra

View on GitHub

Showing 850 of 850 total issues

File api_o_auth2.go has 2579 lines of code (exceeds 500 allowed). Consider refactoring.
Open

/*
Ory Hydra API

Documentation for all of Ory Hydra's APIs.

Severity: Major
Found in internal/httpclient/api_o_auth2.go - About 6 days to fix

    Function TestAuthCodeWithDefaultStrategy has 945 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func TestAuthCodeWithDefaultStrategy(t *testing.T) {
        ctx := context.Background()
        reg := internal.NewMockedRegistry(t, &contextx.Default{})
        reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, "opaque")
        reg.Config().MustSet(ctx, config.KeyRefreshTokenHook, "")
    Severity: Major
    Found in oauth2/oauth2_auth_code_test.go - About 4 days to fix

      File persister_nid_test.go has 1893 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      // Copyright © 2022 Ory Corp
      // SPDX-License-Identifier: Apache-2.0
      
      package sql_test
      
      
      Severity: Major
      Found in persistence/sql/persister_nid_test.go - About 4 days to fix

        Function TestStrategyLoginConsentNext has 850 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func TestStrategyLoginConsentNext(t *testing.T) {
            ctx := context.Background()
            reg := internal.NewMockedRegistry(t, &contextx.Default{})
            reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, "opaque")
            reg.Config().MustSet(ctx, config.KeyConsentRequestMaxAge, time.Hour)
        Severity: Major
        Found in consent/strategy_oauth_test.go - About 4 days to fix

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

          /*
          Ory Hydra API
          
          Documentation for all of Ory Hydra's APIs.
          
          
          Severity: Major
          Found in internal/httpclient/model_reject_o_auth2_request.go and 1 other location - About 3 days to fix
          internal/httpclient/model_error_o_auth2.go on lines 1..274

          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 1974.

          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

          /*
          Ory Hydra API
          
          Documentation for all of Ory Hydra's APIs.
          
          
          Severity: Major
          Found in internal/httpclient/model_error_o_auth2.go and 1 other location - About 3 days to fix
          internal/httpclient/model_reject_o_auth2_request.go on lines 1..274

          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 1974.

          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

          OAuth2Client has 194 methods (exceeds 20 allowed). Consider refactoring.
          Open

          type OAuth2Client struct {
              // OAuth 2.0 Access Token Strategy  AccessTokenStrategy is the strategy used to generate access tokens. Valid options are `jwt` and `opaque`. `jwt` is a bad idea, see https://www.ory.sh/docs/hydra/advanced#json-web-tokens Setting the stragegy here overrides the global setting in `strategies.access_token`.
              AccessTokenStrategy *string  `json:"access_token_strategy,omitempty"`
              AllowedCorsOrigins  []string `json:"allowed_cors_origins,omitempty"`
              Audience            []string `json:"audience,omitempty"`
          Severity: Major
          Found in internal/httpclient/model_o_auth2_client.go - About 3 days to fix

            File oauth2_auth_code_test.go has 1659 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            // Copyright © 2022 Ory Corp
            // SPDX-License-Identifier: Apache-2.0
            
            package oauth2_test
            
            
            Severity: Major
            Found in oauth2/oauth2_auth_code_test.go - About 3 days to fix

              Function ManagerTests has 658 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func ManagerTests(deps Deps, m consent.Manager, clientManager client.Manager, fositeManager x.FositeStorer, network string, parallel bool) func(t *testing.T) {
                  lr := make(map[string]*flow.LoginRequest)
              
                  return func(t *testing.T) {
                      if parallel {
              Severity: Major
              Found in consent/test/manager_test_helpers.go - About 3 days to fix

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

                    cy.request(
                      "POST",
                      Cypress.env("admin_url") + "/trust/grants/jwt-bearer/issuers",
                      JSON.stringify(grant),
                    ).then((response) => {
                Severity: Major
                Found in cypress/integration/admin/grant_jwtbearer.js and 1 other location - About 3 days to fix
                cypress/integration/admin/grant_jwtbearer.js on lines 46..75

                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 535.

                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

                    cy.request(
                      "POST",
                      Cypress.env("admin_url") + "/trust/grants/jwt-bearer/issuers",
                      JSON.stringify(grant),
                    ).then((response) => {
                Severity: Major
                Found in cypress/integration/admin/grant_jwtbearer.js and 1 other location - About 3 days to fix
                cypress/integration/admin/grant_jwtbearer.js on lines 148..179

                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 535.

                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

                File model_o_auth2_client.go has 1307 lines of code (exceeds 500 allowed). Consider refactoring.
                Open

                /*
                Ory Hydra API
                
                Documentation for all of Ory Hydra's APIs.
                
                
                Severity: Major
                Found in internal/httpclient/model_o_auth2_client.go - About 2 days to fix

                  Function ManagerTests has a Cognitive Complexity of 145 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func ManagerTests(deps Deps, m consent.Manager, clientManager client.Manager, fositeManager x.FositeStorer, network string, parallel bool) func(t *testing.T) {
                      lr := make(map[string]*flow.LoginRequest)
                  
                      return func(t *testing.T) {
                          if parallel {
                  Severity: Minor
                  Found in consent/test/manager_test_helpers.go - About 2 days 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 TestHandler has 500 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func TestHandler(t *testing.T) {
                      ctx := context.Background()
                      reg := internal.NewMockedRegistry(t, &contextx.Default{})
                      h := client.NewHandler(reg)
                      reg.WithContextualizer(&contextx.TestContextualizer{})
                  Severity: Major
                  Found in client/handler_test.go - About 2 days to fix

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

                    /*
                    Ory Hydra API
                    
                    Documentation for all of Ory Hydra's APIs.
                    
                    
                    Severity: Major
                    Found in internal/httpclient/model_token_pagination.go and 2 other locations - About 2 days to fix
                    internal/httpclient/model_pagination.go on lines 1..171
                    internal/httpclient/model_token_pagination_request_parameters.go on lines 1..171

                    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 1204.

                    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 (s *PersisterTestSuite) TestListUserAuthenticatedClientsWithFrontChannelLogout() {
                        t := s.T()
                        for k, r := range s.registries {
                            t.Run(k, func(t *testing.T) {
                                c1 := &client.Client{ID: "client-1", FrontChannelLogoutURI: "not-null"}
                    Severity: Major
                    Found in persistence/sql/persister_nid_test.go and 1 other location - About 2 days to fix
                    persistence/sql/persister_nid_test.go on lines 1512..1593

                    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 1204.

                    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 3 locations. Consider refactoring.
                    Open

                    /*
                    Ory Hydra API
                    
                    Documentation for all of Ory Hydra's APIs.
                    
                    
                    Severity: Major
                    Found in internal/httpclient/model_pagination.go and 2 other locations - About 2 days to fix
                    internal/httpclient/model_token_pagination.go on lines 1..171
                    internal/httpclient/model_token_pagination_request_parameters.go on lines 1..171

                    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 1204.

                    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 3 locations. Consider refactoring.
                    Open

                    /*
                    Ory Hydra API
                    
                    Documentation for all of Ory Hydra's APIs.
                    
                    
                    internal/httpclient/model_pagination.go on lines 1..171
                    internal/httpclient/model_token_pagination.go on lines 1..171

                    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 1204.

                    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 (s *PersisterTestSuite) TestListUserAuthenticatedClientsWithBackChannelLogout() {
                        t := s.T()
                        for k, r := range s.registries {
                            t.Run(k, func(t *testing.T) {
                                c1 := &client.Client{ID: "client-1", BackChannelLogoutURI: "not-null"}
                    Severity: Major
                    Found in persistence/sql/persister_nid_test.go and 1 other location - About 2 days to fix
                    persistence/sql/persister_nid_test.go on lines 1595..1676

                    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 1204.

                    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 TestAuthCodeWithMockStrategy has 492 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func TestAuthCodeWithMockStrategy(t *testing.T) {
                        ctx := context.Background()
                        for _, strat := range []struct{ d string }{{d: "opaque"}, {d: "jwt"}} {
                            t.Run("strategy="+strat.d, func(t *testing.T) {
                                conf := internal.NewConfigurationWithDefaults()
                    Severity: Major
                    Found in oauth2/oauth2_auth_code_test.go - About 2 days to fix
                      Severity
                      Category
                      Status
                      Source
                      Language