ory-am/hydra

View on GitHub

Showing 412 of 865 total issues

OidcUserInfo has 78 methods (exceeds 20 allowed). Consider refactoring.
Open

type OidcUserInfo struct {
    // End-User's birthday, represented as an ISO 8601:2004 [ISO8601‑2004] YYYY-MM-DD format. The year MAY be 0000, indicating that it is omitted. To represent only the year, YYYY format is allowed. Note that depending on the underlying platform's date related function, providing just year can result in varying month and day, so the implementers need to take this factor into account to correctly process the dates.
    Birthdate *string `json:"birthdate,omitempty"`
    // End-User's preferred e-mail address. Its value MUST conform to the RFC 5322 [RFC5322] addr-spec syntax. The RP MUST NOT rely upon this value being unique, as discussed in Section 5.7.
    Email *string `json:"email,omitempty"`
Severity: Major
Found in internal/httpclient/model_oidc_user_info.go - About 1 day to fix

    DefaultProvider has 73 methods (exceeds 20 allowed). Consider refactoring.
    Open

    type DefaultProvider struct {
        l *logrusx.Logger
        p *configx.Provider
        c contextx.Contextualizer
    }
    Severity: Major
    Found in driver/config/provider.go - About 1 day to fix

      Function Middleware has a Cognitive Complexity of 83 (exceeds 20 allowed). Consider refactoring.
      Open

      func Middleware(
          reg interface {
              x.RegistryLogger
              oauth2.Registry
              client.Registry
      Severity: Minor
      Found in x/oauth2cors/cors.go - About 1 day 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 TestClientCredentials has 290 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func TestClientCredentials(t *testing.T) {
          ctx := context.Background()
          reg := internal.NewMockedRegistry(t, &contextx.Default{})
          reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, "opaque")
          public, admin := testhelpers.NewOAuth2Server(ctx, t, reg)
      Severity: Major
      Found in oauth2/oauth2_client_credentials_test.go - About 1 day to fix

        File manager_hsm_test.go has 833 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        // Copyright © 2022 Ory Corp
        // SPDX-License-Identifier: Apache-2.0
        
        //go:build hsm
        // +build hsm
        Severity: Major
        Found in hsm/manager_hsm_test.go - About 1 day to fix

          File model_oidc_configuration.go has 832 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_oidc_configuration.go - About 1 day to fix

            JsonWebKey has 67 methods (exceeds 20 allowed). Consider refactoring.
            Open

            type JsonWebKey struct {
                // The \"alg\" (algorithm) parameter identifies the algorithm intended for use with the key.  The values used should either be registered in the IANA \"JSON Web Signature and Encryption Algorithms\" registry established by [JWA] or be a value that contains a Collision- Resistant Name.
                Alg string  `json:"alg"`
                Crv *string `json:"crv,omitempty"`
                D   *string `json:"d,omitempty"`
            Severity: Major
            Found in internal/httpclient/model_json_web_key.go - About 1 day to fix

              RegistrySQL has 63 methods (exceeds 20 allowed). Consider refactoring.
              Open

              type RegistrySQL struct {
                  l               *logrusx.Logger
                  al              *logrusx.Logger
                  conf            *config.DefaultProvider
                  ch              *client.Handler
              Severity: Major
              Found in driver/registry_sql.go - About 1 day to fix

                File handler.go has 787 lines of code (exceeds 500 allowed). Consider refactoring.
                Open

                // Copyright © 2022 Ory Corp
                // SPDX-License-Identifier: Apache-2.0
                
                package oauth2
                
                
                Severity: Major
                Found in oauth2/handler.go - About 1 day to fix

                  Function TestOAuth2AwareCORSMiddleware has 239 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func TestOAuth2AwareCORSMiddleware(t *testing.T) {
                      ctx := context.Background()
                      r := internal.NewRegistryMemory(t, internal.NewConfigurationWithDefaults(), &contextx.Default{})
                      token, signature, _ := r.OAuth2HMACStrategy().GenerateAccessToken(ctx, nil)
                  
                  
                  Severity: Major
                  Found in x/oauth2cors/cors_test.go - About 1 day to fix

                    Function TestUserinfo has 239 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func TestUserinfo(t *testing.T) {
                        ctx := context.Background()
                        conf := internal.NewConfigurationWithDefaults()
                        conf.MustSet(ctx, config.KeyScopeStrategy, "")
                        conf.MustSet(ctx, config.KeyAuthCodeLifespan, lifespan)
                    Severity: Major
                    Found in oauth2/handler_test.go - About 1 day to fix

                      Function testFositeJWTBearerGrantStorage has 236 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func testFositeJWTBearerGrantStorage(x InternalRegistry) func(t *testing.T) {
                          return func(t *testing.T) {
                              grantManager := x.GrantManager()
                              keyManager := x.KeyManager()
                              grantStorage := x.OAuth2Storage().(rfc7523.RFC7523KeyStorage)
                      Severity: Major
                      Found in oauth2/fosite_store_helpers.go - About 1 day to fix

                        IntrospectedOAuth2Token has 58 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        type IntrospectedOAuth2Token struct {
                            // Active is a boolean indicator of whether or not the presented token is currently active.  The specifics of a token's \"active\" state will vary depending on the implementation of the authorization server and the information it keeps about its tokens, but a \"true\" value return for the \"active\" property will generally indicate that a given token has been issued by this authorization server, has not been revoked by the resource owner, and is within its given time window of validity (e.g., after its issuance time and before its expiration time).
                            Active bool `json:"active"`
                            // Audience contains a list of the token's intended audiences.
                            Aud []string `json:"aud,omitempty"`
                        Severity: Major
                        Found in internal/httpclient/model_introspected_o_auth2_token.go - About 1 day to fix

                          Method Validator.Validate has a Cognitive Complexity of 68 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func (v *Validator) Validate(ctx context.Context, c *Client) error {
                              if c.TokenEndpointAuthMethod == "" {
                                  c.TokenEndpointAuthMethod = "client_secret_basic"
                              } else if c.TokenEndpointAuthMethod == "private_key_jwt" {
                                  if len(c.JSONWebKeysURI) == 0 && c.JSONWebKeys == nil {
                          Severity: Minor
                          Found in client/validator.go - About 1 day 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 TestMigrations has a Cognitive Complexity of 68 (exceeds 20 allowed). Consider refactoring.
                          Open

                          func TestMigrations(t *testing.T) {
                              connections := make(map[string]*pop.Connection, 1)
                          
                              if testing.Short() {
                                  reg := internal.NewMockedRegistry(t, &contextx.Default{})
                          Severity: Minor
                          Found in persistence/sql/migratest/migration_test.go - About 1 day 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

                          OAuth2APIService has 56 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          type OAuth2APIService service
                          Severity: Major
                          Found in internal/httpclient/api_o_auth2.go - About 1 day to fix

                            File grant_jwtbearer.js has 500 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            // Copyright © 2022 Ory Corp
                            // SPDX-License-Identifier: Apache-2.0
                            
                            import {
                              createClient,
                            Severity: Minor
                            Found in cypress/integration/oauth2/grant_jwtbearer.js - About 1 day to fix

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

                              func (c *APIClient) prepareRequest(
                                  ctx context.Context,
                                  path string, method string,
                                  postBody interface{},
                                  headerParams map[string]string,
                              Severity: Minor
                              Found in internal/httpclient/client.go - About 7 hrs 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

                              OAuth2ConsentRequest has 54 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              type OAuth2ConsentRequest struct {
                                  // ACR represents the Authentication AuthorizationContext Class Reference value for this authentication session. You can use it to express that, for example, a user authenticated using two factor authentication.
                                  Acr *string  `json:"acr,omitempty"`
                                  Amr []string `json:"amr,omitempty"`
                                  // ID is the identifier (\"authorization challenge\") of the consent authorization request. It is used to identify the session.
                              Severity: Major
                              Found in internal/httpclient/model_o_auth2_consent_request.go - About 7 hrs to fix

                                File janitor_test_helper.go has 734 lines of code (exceeds 500 allowed). Consider refactoring.
                                Open

                                // Copyright © 2022 Ory Corp
                                // SPDX-License-Identifier: Apache-2.0
                                
                                package testhelpers
                                
                                
                                Severity: Minor
                                Found in internal/testhelpers/janitor_test_helper.go - About 7 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language