ory-am/hydra

View on GitHub

Showing 853 of 853 total issues

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

        withWrongScopeAfterLogin := &http.Client{
            Jar: testhelpers.NewEmptyCookieJar(t),
            CheckRedirect: func(req *http.Request, _ []*http.Request) error {
                if req.URL.Path != "/oauth2/auth" {
                    return nil
Severity: Major
Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
oauth2/oauth2_auth_code_test.go on lines 569..583

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

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

        {
            ID:                   fmt.Sprintf("%s_flush-consent-3", uniqueName),
            RequestedScope:       []string{"foo", "bar"},
            Subject:              fmt.Sprintf("%s_flush-consent-3", uniqueName),
            OpenIDConnectContext: nil,
Severity: Major
Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 1 hr to fix
internal/testhelpers/janitor_test_helper.go on lines 824..835

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

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

        withWrongScopeAfterConsent := &http.Client{
            Jar: testhelpers.NewEmptyCookieJar(t),
            CheckRedirect: func(req *http.Request, _ []*http.Request) error {
                if req.URL.Path != "/oauth2/auth" {
                    return nil
Severity: Major
Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
oauth2/oauth2_auth_code_test.go on lines 553..567

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

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 (p *Persister) CreateRefreshTokenSession(ctx context.Context, signature string, requester fosite.Requester) (err error) {
    ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.CreateRefreshTokenSession")
    defer otelx.End(span, &err)
    events.Trace(ctx, events.RefreshTokenIssued, toEventOptions(requester)...)
    return p.createSession(ctx, signature, requester, sqlTableRefresh, requester.GetSession().GetExpiresAt(fosite.RefreshToken).UTC())
Severity: Major
Found in persistence/sql/persister_oauth2.go and 1 other location - About 1 hr to fix
persistence/sql/persister_oauth2.go on lines 441..447

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

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

func (a *OAuth2APIService) OAuth2AuthorizeExecute(r ApiOAuth2AuthorizeRequest) (*ErrorOAuth2, *http.Response, error) {
    var (
        localVarHTTPMethod  = http.MethodGet
        localVarPostBody    interface{}
        formFiles           []formFile
Severity: Minor
Found in internal/httpclient/api_o_auth2.go - About 1 hr to fix

    Method OidcAPIService.DiscoverOidcConfigurationExecute has 62 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func (a *OidcAPIService) DiscoverOidcConfigurationExecute(r ApiDiscoverOidcConfigurationRequest) (*OidcConfiguration, *http.Response, error) {
        var (
            localVarHTTPMethod  = http.MethodGet
            localVarPostBody    interface{}
            formFiles           []formFile
    Severity: Minor
    Found in internal/httpclient/api_oidc.go - About 1 hr to fix

      Method OidcAPIService.GetOidcUserInfoExecute has 62 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func (a *OidcAPIService) GetOidcUserInfoExecute(r ApiGetOidcUserInfoRequest) (*OidcUserInfo, *http.Response, error) {
          var (
              localVarHTTPMethod  = http.MethodGet
              localVarPostBody    interface{}
              formFiles           []formFile
      Severity: Minor
      Found in internal/httpclient/api_oidc.go - About 1 hr to fix

        Method DefaultStrategy.executeBackChannelLogout has 62 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func (s *DefaultStrategy) executeBackChannelLogout(r *http.Request, subject, sid string) error {
            ctx := r.Context()
            clients, err := s.r.ConsentManager().ListUserAuthenticatedClientsWithBackChannelLogout(ctx, subject, sid)
            if err != nil {
                return err
        Severity: Minor
        Found in consent/strategy_default.go - About 1 hr to fix

          Method WellknownAPIService.DiscoverJsonWebKeysExecute has 62 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (a *WellknownAPIService) DiscoverJsonWebKeysExecute(r ApiDiscoverJsonWebKeysRequest) (*JsonWebKeySet, *http.Response, error) {
              var (
                  localVarHTTPMethod  = http.MethodGet
                  localVarPostBody    interface{}
                  formFiles           []formFile
          Severity: Minor
          Found in internal/httpclient/api_wellknown.go - About 1 hr to fix

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

            func TestProviderPublicDisableHealthAccessLog(t *testing.T) {
                ctx := context.Background()
                l := logrusx.New("", "")
                l.Logrus().SetOutput(io.Discard)
            
            
            Severity: Major
            Found in driver/config/provider_test.go and 1 other location - About 1 hr to fix
            driver/config/provider_test.go on lines 104..118

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

            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 TestProviderAdminDisableHealthAccessLog(t *testing.T) {
                ctx := context.Background()
                l := logrusx.New("", "")
                l.Logrus().SetOutput(io.Discard)
            
            
            Severity: Major
            Found in driver/config/provider_test.go and 1 other location - About 1 hr to fix
            driver/config/provider_test.go on lines 120..134

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

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

            func readMigrations(migrationSourceFS fs.FS, expectedDialects []string) (map[string]*migrationGroup, error) {
                mgs := make(map[string]*migrationGroup)
                err := fs.WalkDir(migrationSourceFS, ".", func(p string, d fs.DirEntry, err2 error) error {
                    if err2 != nil {
                        fmt.Println("Warning: unexpected error " + err2.Error())
            Severity: Minor
            Found in cmd/cli/handler_migrate.go - About 1 hr to fix

              Function TestHandlerFindPublicKey has 61 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func TestHandlerFindPublicKey(t *testing.T) {
                  t.Parallel()
              
                  t.Run("Test_Helper/Run_FindPublicKey_With_RSA", func(t *testing.T) {
                      t.Parallel()
              Severity: Minor
              Found in jwk/helper_test.go - About 1 hr to fix

                Method APIClient.decode has 15 return statements (exceeds 4 allowed).
                Open

                func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
                    if len(b) == 0 {
                        return nil
                    }
                    if s, ok := v.(*string); ok {
                Severity: Major
                Found in internal/httpclient/client.go - About 1 hr to fix

                  Method APIClient.decode has a Cognitive Complexity of 27 (exceeds 20 allowed). Consider refactoring.
                  Open

                  func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
                      if len(b) == 0 {
                          return nil
                      }
                      if s, ok := v.(*string); ok {
                  Severity: Minor
                  Found in internal/httpclient/client.go - About 1 hr to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

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

                                      cb: func(t *testing.T) httprouter.Handle {
                                          return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                                              code = r.URL.Query().Get("code")
                                              err := r.URL.Query().Get("error")
                                              require.Empty(t, code)
                  Severity: Major
                  Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
                  oauth2/oauth2_auth_code_test.go on lines 1435..1442

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

                  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

                                      cb: func(t *testing.T) httprouter.Handle {
                                          return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                                              code = r.URL.Query().Get("code")
                                              err := r.URL.Query().Get("error")
                                              require.Empty(t, code)
                  Severity: Major
                  Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 1 hr to fix
                  oauth2/oauth2_auth_code_test.go on lines 1405..1412

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

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

                  func (a *OAuth2APIService) RevokeOAuth2LoginSessionsExecute(r ApiRevokeOAuth2LoginSessionsRequest) (*http.Response, error) {
                      var (
                          localVarHTTPMethod = http.MethodDelete
                          localVarPostBody   interface{}
                          formFiles          []formFile
                  Severity: Minor
                  Found in internal/httpclient/api_o_auth2.go - About 1 hr to fix

                    Method OidcUserInfo.ToMap has 59 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func (o OidcUserInfo) ToMap() (map[string]interface{}, error) {
                        toSerialize := map[string]interface{}{}
                        if !IsNil(o.Birthdate) {
                            toSerialize["birthdate"] = o.Birthdate
                        }
                    Severity: Minor
                    Found in internal/httpclient/model_oidc_user_info.go - About 1 hr to fix

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

                          {
                              ID:             "flush-2",
                              RequestedAt:    time.Now().Round(time.Second).Add(-(lifespan + time.Minute)),
                              Client:         &client.Client{ID: "foobar"},
                              RequestedScope: fosite.Arguments{"fa", "ba"},
                      Severity: Major
                      Found in oauth2/fosite_store_helpers.go and 1 other location - About 1 hr to fix
                      oauth2/fosite_store_helpers.go on lines 138..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 150.

                      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