ory-am/hydra

View on GitHub

Showing 402 of 849 total issues

AcceptOAuth2ConsentRequest has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

type AcceptOAuth2ConsentRequest struct {
    Context                  interface{} `json:"context,omitempty"`
    GrantAccessTokenAudience []string    `json:"grant_access_token_audience,omitempty"`
    GrantScope               []string    `json:"grant_scope,omitempty"`
    HandledAt                *time.Time  `json:"handled_at,omitempty"`
Severity: Minor
Found in internal/httpclient/model_accept_o_auth2_consent_request.go - About 3 hrs to fix

    Function TestIntrospectorSDK has 114 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func TestIntrospectorSDK(t *testing.T) {
        ctx := context.Background()
        conf := internal.NewConfigurationWithDefaults()
        conf.MustSet(ctx, config.KeyScopeStrategy, "wildcard")
        conf.MustSet(ctx, config.KeyIssuerURL, "https://foobariss")
    Severity: Major
    Found in oauth2/introspector_test.go - About 3 hrs to fix

      Function TestHelperGrantManagerCreateGetDeleteGrant has 113 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func TestHelperGrantManagerCreateGetDeleteGrant(t1 GrantManager, km jwk.Manager, parallel bool) func(t *testing.T) {
          tokenServicePubKey1 := jose.JSONWebKey{}
          tokenServicePubKey2 := jose.JSONWebKey{}
          mikePubKey := jose.JSONWebKey{}
      
      
      Severity: Major
      Found in oauth2/trust/manager_test_helpers.go - About 3 hrs to fix

        Config has 29 methods (exceeds 20 allowed). Consider refactoring.
        Open

        type Config struct {
            deps configDependencies
        
            authorizeEndpointHandlers  fosite.AuthorizeEndpointHandlers
            tokenEndpointHandlers      fosite.TokenEndpointHandlers
        Severity: Minor
        Found in fositex/config.go - About 3 hrs to fix

          Method APIClient.prepareRequest has 112 lines of code (exceeds 50 allowed). Consider refactoring.
          Open

          func (c *APIClient) prepareRequest(
              ctx context.Context,
              path string, method string,
              postBody interface{},
              headerParams map[string]string,
          Severity: Major
          Found in internal/httpclient/client.go - About 3 hrs to fix

            Function TestJWKSDK has 111 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func TestJWKSDK(t *testing.T) {
                t.Parallel()
                ctx := context.Background()
                conf := internal.NewConfigurationWithDefaults()
                reg := internal.NewRegistryMemory(t, conf, &contextx.Default{})
            Severity: Major
            Found in jwk/sdk_test.go - About 3 hrs to fix

              Method DefaultStrategy.verifyAuthentication has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
              Open

              func (s *DefaultStrategy) verifyAuthentication(
                  ctx context.Context,
                  w http.ResponseWriter,
                  r *http.Request,
                  req fosite.AuthorizeRequester,
              Severity: Minor
              Found in consent/strategy_default.go - About 3 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

              Method DefaultStrategy.issueLogoutVerifier has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
              Open

              func (s *DefaultStrategy) issueLogoutVerifier(ctx context.Context, w http.ResponseWriter, r *http.Request) (*flow.LogoutResult, error) {
                  // There are two types of log out flows:
                  //
                  // - RP initiated logout
                  // - OP initiated logout
              Severity: Minor
              Found in consent/strategy_default.go - About 3 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

              File model_oidc_user_info.go has 548 lines of code (exceeds 500 allowed). Consider refactoring.
              Open

              /*
              Ory Hydra API
              
              Documentation for all of Ory Hydra's APIs.
              
              
              Severity: Minor
              Found in internal/httpclient/model_oidc_user_info.go - About 3 hrs to fix

                Function TestViperProviderValidates has 103 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func TestViperProviderValidates(t *testing.T) {
                    ctx := context.Background()
                    l := logrusx.New("", "")
                    c := MustNew(context.Background(), l, configx.WithConfigFiles("../../internal/.hydra.yaml"))
                
                
                Severity: Major
                Found in driver/config/provider_test.go - About 3 hrs to fix

                  Function TestHelperCreateGetUpdateDeleteClient has 103 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func TestHelperCreateGetUpdateDeleteClient(k string, connection *pop.Connection, t1 Storage, t2 Storage) func(t *testing.T) {
                      return func(t *testing.T) {
                          ctx := context.Background()
                          _, err := t1.GetClient(ctx, "1234")
                          require.Error(t, err)
                  Severity: Major
                  Found in client/manager_test_helpers.go - About 3 hrs to fix

                    File client.go has 546 lines of code (exceeds 500 allowed). Consider refactoring.
                    Open

                    /*
                    Ory Hydra API
                    
                    Documentation for all of Ory Hydra's APIs.
                    
                    
                    Severity: Minor
                    Found in internal/httpclient/client.go - About 3 hrs to fix

                      Function parameterAddToHeaderOrQuery has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) {
                          var v = reflect.ValueOf(obj)
                          var value = ""
                          if v == reflect.ValueOf(nil) {
                              value = "null"
                      Severity: Minor
                      Found in internal/httpclient/client.go - About 3 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

                      Method Client.GetEffectiveLifespan has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
                      Open

                      func (c *Client) GetEffectiveLifespan(gt fosite.GrantType, tt fosite.TokenType, fallback time.Duration) time.Duration {
                          var cl *time.Duration
                          if gt == fosite.GrantTypeAuthorizationCode {
                              if tt == fosite.AccessToken && c.AuthorizationCodeGrantAccessTokenLifespan.Valid {
                                  cl = &c.AuthorizationCodeGrantAccessTokenLifespan.Duration
                      Severity: Minor
                      Found in client/client.go - About 3 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

                      Function TestAEAD has 100 lines of code (exceeds 50 allowed). Consider refactoring.
                      Open

                      func TestAEAD(t *testing.T) {
                          t.Parallel()
                          for _, tc := range []struct {
                              name string
                              new  func(aead.Dependencies) aead.Cipher
                      Severity: Major
                      Found in aead/aead_test.go - About 3 hrs to fix

                        OAuth2TokenExchange has 26 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        type OAuth2TokenExchange struct {
                            // The access token issued by the authorization server.
                            AccessToken *string `json:"access_token,omitempty"`
                            // The lifetime in seconds of the access token. For example, the value \"3600\" denotes that the access token will expire in one hour from the time the response was generated.
                            ExpiresIn *int64 `json:"expires_in,omitempty"`
                        Severity: Minor
                        Found in internal/httpclient/model_o_auth2_token_exchange.go - About 3 hrs to fix

                          OAuth2LogoutRequest has 26 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          type OAuth2LogoutRequest struct {
                              // Challenge is the identifier (\"logout challenge\") of the logout authentication request. It is used to identify the session.
                              Challenge *string       `json:"challenge,omitempty"`
                              Client    *OAuth2Client `json:"client,omitempty"`
                              // RequestURL is the original Logout URL requested.
                          Severity: Minor
                          Found in internal/httpclient/model_o_auth2_logout_request.go - About 3 hrs to fix

                            JanitorConsentTestHelper has 26 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            type JanitorConsentTestHelper struct {
                                uniqueName           string
                                flushLoginRequests   []*flow.LoginRequest
                                flushConsentRequests []*flow.OAuth2ConsentRequest
                                flushAccessRequests  []*fosite.Request
                            Severity: Minor
                            Found in internal/testhelpers/janitor_test_helper.go - About 3 hrs to fix

                              File handler_test.go has 540 lines of code (exceeds 500 allowed). Consider refactoring.
                              Open

                              // Copyright © 2022 Ory Corp
                              // SPDX-License-Identifier: Apache-2.0
                              
                              package client_test
                              
                              
                              Severity: Minor
                              Found in client/handler_test.go - About 2 hrs to fix

                                Function NewKeysImportCmd has 99 lines of code (exceeds 50 allowed). Consider refactoring.
                                Open

                                func NewKeysImportCmd() *cobra.Command {
                                    cmd := &cobra.Command{
                                        Use:  "jwk set-id file-1 [file-2] [file-n]",
                                        Args: cobra.MinimumNArgs(1),
                                        Example: `{{ .CommandPath }} my-set ./path/to/jwk.json ./path/to/jwk-2.json --format json
                                Severity: Major
                                Found in cmd/cmd_import_jwk.go - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language