ory-am/hydra

View on GitHub

Showing 853 of 853 total issues

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

        cy.request(`${Cypress.env("client_url")}/openid/userinfo`, {
          failOnStatusCode: false,
        })
          .its("body")
          .then((response) => {
Severity: Major
Found in cypress/integration/openid/revoke.js and 2 other locations - About 2 hrs to fix
cypress/integration/openid/revoke.js on lines 64..70
cypress/integration/openid/revoke.js on lines 72..78

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

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

        cy.request(`${Cypress.env("client_url")}/openid/revoke/rt`, {
          failOnStatusCode: false,
        })
          .its("body")
          .then((response) => {
Severity: Major
Found in cypress/integration/openid/revoke.js and 2 other locations - About 2 hrs to fix
cypress/integration/openid/revoke.js on lines 40..46
cypress/integration/openid/revoke.js on lines 72..78

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

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

        cy.request(`${Cypress.env("client_url")}/openid/userinfo`, {
          failOnStatusCode: false,
        })
          .its("body")
          .then((response) => {
Severity: Major
Found in cypress/integration/openid/revoke.js and 2 other locations - About 2 hrs to fix
cypress/integration/openid/revoke.js on lines 40..46
cypress/integration/openid/revoke.js on lines 64..70

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

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

Method OAuth2APIService.ListOAuth2ConsentSessionsExecute has 81 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (a *OAuth2APIService) ListOAuth2ConsentSessionsExecute(r ApiListOAuth2ConsentSessionsRequest) ([]OAuth2ConsentSession, *http.Response, error) {
    var (
        localVarHTTPMethod  = http.MethodGet
        localVarPostBody    interface{}
        formFiles           []formFile
Severity: Major
Found in internal/httpclient/api_o_auth2.go - About 2 hrs to fix

    Method Handler.introspectOAuth2Token has 81 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (h *Handler) introspectOAuth2Token(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
        ctx := r.Context()
        session := NewSessionWithCustomClaims(ctx, h.c, "")
    
        if r.Method != "POST" {
    Severity: Major
    Found in oauth2/handler.go - About 2 hrs to fix

      Method OAuth2APIService.ListOAuth2ClientsExecute has 80 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (a *OAuth2APIService) ListOAuth2ClientsExecute(r ApiListOAuth2ClientsRequest) ([]OAuth2Client, *http.Response, error) {
          var (
              localVarHTTPMethod  = http.MethodGet
              localVarPostBody    interface{}
              formFiles           []formFile
      Severity: Major
      Found in internal/httpclient/api_o_auth2.go - About 2 hrs to fix

        Client has 21 methods (exceeds 20 allowed). Consider refactoring.
        Open

        type Client struct {
            NID uuid.UUID `db:"nid" faker:"-" json:"-"`
        
            // OAuth 2.0 Client ID
            //
        Severity: Minor
        Found in client/client.go - About 2 hrs to fix

          Method Handler.performOidcFrontOrBackChannelLogout has 79 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (h *Handler) performOidcFrontOrBackChannelLogout(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
              ctx := r.Context()
          
              handled, err := h.r.ConsentStrategy().HandleOpenIDConnectLogout(ctx, w, r)
              if errors.Is(err, consent.ErrAbortOAuth2Request) {
          Severity: Major
          Found in oauth2/handler.go - About 2 hrs to fix

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

                    t.Run("case=login-rejection", func(t *testing.T) {
                        jt := testhelpers.NewConsentJanitorTestHelper(t.Name())
                        reg, err := jt.GetRegistry(ctx, t.Name())
                        require.NoError(t, err)
            
            
            Severity: Major
            Found in cmd/cli/handler_janitor_test.go and 1 other location - About 2 hrs to fix
            cmd/cli/handler_janitor_test.go on lines 173..192

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

            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

                    t.Run("case=consent-rejection", func(t *testing.T) {
                        jt := testhelpers.NewConsentJanitorTestHelper(t.Name())
                        reg, err := jt.GetRegistry(ctx, t.Name())
                        require.NoError(t, err)
            
            
            Severity: Major
            Found in cmd/cli/handler_janitor_test.go and 1 other location - About 2 hrs to fix
            cmd/cli/handler_janitor_test.go on lines 152..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 198.

            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

            Method OAuth2APIService.Oauth2TokenExchangeExecute has 78 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func (a *OAuth2APIService) Oauth2TokenExchangeExecute(r ApiOauth2TokenExchangeRequest) (*OAuth2TokenExchange, *http.Response, error) {
                var (
                    localVarHTTPMethod  = http.MethodPost
                    localVarPostBody    interface{}
                    formFiles           []formFile
            Severity: Major
            Found in internal/httpclient/api_o_auth2.go - About 2 hrs to fix

              Method OAuth2APIService.PatchOAuth2ClientExecute has 78 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (a *OAuth2APIService) PatchOAuth2ClientExecute(r ApiPatchOAuth2ClientRequest) (*OAuth2Client, *http.Response, error) {
                  var (
                      localVarHTTPMethod  = http.MethodPatch
                      localVarPostBody    interface{}
                      formFiles           []formFile
              Severity: Major
              Found in internal/httpclient/api_o_auth2.go - About 2 hrs to fix

                Method OidcAPIService.SetOidcDynamicClientExecute has 78 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func (a *OidcAPIService) SetOidcDynamicClientExecute(r ApiSetOidcDynamicClientRequest) (*OAuth2Client, *http.Response, error) {
                    var (
                        localVarHTTPMethod  = http.MethodPut
                        localVarPostBody    interface{}
                        formFiles           []formFile
                Severity: Major
                Found in internal/httpclient/api_oidc.go - About 2 hrs to fix

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

                                  t.Run("case=hydra_oauth2_refresh", func(t *testing.T) {
                                      rs := []sql.OAuth2RequestSQL{}
                                      c.RawQuery("SELECT * FROM hydra_oauth2_refresh").All(&rs)
                                      require.Equal(t, 13, len(rs))
                  
                  
                  Severity: Major
                  Found in persistence/sql/migratest/migration_test.go and 4 other locations - About 2 hrs to fix
                  persistence/sql/migratest/migration_test.go on lines 195..209
                  persistence/sql/migratest/migration_test.go on lines 227..241
                  persistence/sql/migratest/migration_test.go on lines 243..257
                  persistence/sql/migratest/migration_test.go on lines 259..273

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

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

                                  t.Run("case=hydra_oauth2_oidc", func(t *testing.T) {
                                      os := []sql.OAuth2RequestSQL{}
                                      c.RawQuery("SELECT * FROM hydra_oauth2_oidc").All(&os)
                                      require.Equal(t, 13, len(os))
                  
                  
                  Severity: Major
                  Found in persistence/sql/migratest/migration_test.go and 4 other locations - About 2 hrs to fix
                  persistence/sql/migratest/migration_test.go on lines 195..209
                  persistence/sql/migratest/migration_test.go on lines 211..225
                  persistence/sql/migratest/migration_test.go on lines 227..241
                  persistence/sql/migratest/migration_test.go on lines 259..273

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

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

                                  t.Run("case=hydra_oauth2_pkce", func(t *testing.T) {
                                      ps := []sql.OAuth2RequestSQL{}
                                      c.RawQuery("SELECT * FROM hydra_oauth2_pkce").All(&ps)
                                      require.Equal(t, 11, len(ps))
                  
                  
                  Severity: Major
                  Found in persistence/sql/migratest/migration_test.go and 4 other locations - About 2 hrs to fix
                  persistence/sql/migratest/migration_test.go on lines 195..209
                  persistence/sql/migratest/migration_test.go on lines 211..225
                  persistence/sql/migratest/migration_test.go on lines 227..241
                  persistence/sql/migratest/migration_test.go on lines 243..257

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

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

                                  t.Run("case=hydra_oauth2_access", func(t *testing.T) {
                                      as := []sql.OAuth2RequestSQL{}
                                      c.RawQuery("SELECT * FROM hydra_oauth2_access").All(&as)
                                      require.Equal(t, 13, len(as))
                  
                  
                  Severity: Major
                  Found in persistence/sql/migratest/migration_test.go and 4 other locations - About 2 hrs to fix
                  persistence/sql/migratest/migration_test.go on lines 211..225
                  persistence/sql/migratest/migration_test.go on lines 227..241
                  persistence/sql/migratest/migration_test.go on lines 243..257
                  persistence/sql/migratest/migration_test.go on lines 259..273

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

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

                                  t.Run("case=hydra_oauth2_code", func(t *testing.T) {
                                      cs := []sql.OAuth2RequestSQL{}
                                      c.RawQuery("SELECT * FROM hydra_oauth2_code").All(&cs)
                                      require.Equal(t, 13, len(cs))
                  
                  
                  Severity: Major
                  Found in persistence/sql/migratest/migration_test.go and 4 other locations - About 2 hrs to fix
                  persistence/sql/migratest/migration_test.go on lines 195..209
                  persistence/sql/migratest/migration_test.go on lines 211..225
                  persistence/sql/migratest/migration_test.go on lines 243..257
                  persistence/sql/migratest/migration_test.go on lines 259..273

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

                  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

                          {
                              name: "Get ES256 enc",
                              args: args{
                                  ctx: context.TODO(),
                                  set: x.OpenIDConnectKeyName,
                  Severity: Major
                  Found in hsm/manager_hsm_test.go and 2 other locations - About 2 hrs to fix
                  hsm/manager_hsm_test.go on lines 398..410
                  hsm/manager_hsm_test.go on lines 463..475

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

                  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

                          {
                              name: "Get ES512 enc",
                              args: args{
                                  ctx: context.TODO(),
                                  set: x.OpenIDConnectKeyName,
                  Severity: Major
                  Found in hsm/manager_hsm_test.go and 2 other locations - About 2 hrs to fix
                  hsm/manager_hsm_test.go on lines 398..410
                  hsm/manager_hsm_test.go on lines 437..449

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

                  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