ory-am/hydra

View on GitHub

Showing 853 of 853 total issues

Method OAuth2APIService.GetOAuth2LoginRequestExecute has 11 return statements (exceeds 4 allowed).
Open

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

    Method OAuth2APIService.GetOAuth2LogoutRequestExecute has 11 return statements (exceeds 4 allowed).
    Open

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

      Method APIClient.prepareRequest has 11 return statements (exceeds 4 allowed).
      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 1 hr to fix

        Function NewPerformAuthorizationCodeCmd has 11 return statements (exceeds 4 allowed).
        Open

        func NewPerformAuthorizationCodeCmd() *cobra.Command {
            cmd := &cobra.Command{
                Use:     "authorization-code",
                Example: "{{ .CommandPath }} --client-id ... --client-secret ...",
                Short:   "An exemplary OAuth 2.0 Client performing the OAuth 2.0 Authorize Code Flow",
        Severity: Major
        Found in cmd/cmd_perform_authorization_code.go - About 1 hr to fix

          Function readMigrations has 11 return statements (exceeds 4 allowed).
          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: Major
          Found in cmd/cli/handler_migrate.go - About 1 hr to fix

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

                    c := createClientWithBackchannelLogout(t, backChannelWG, func(t *testing.T, logoutToken gjson.Result) {
                        assert.EqualValues(t, <-sid, logoutToken.Get("sid").String(), logoutToken.Raw)
                        assert.Empty(t, logoutToken.Get("sub").String(), logoutToken.Raw) // The sub claim should be empty because it doesn't work with forced obfuscation and thus we can't easily recover it.
                        assert.Empty(t, logoutToken.Get("nonce").String(), logoutToken.Raw)
                    })
            Severity: Major
            Found in consent/strategy_logout_test.go and 1 other location - About 1 hr to fix
            consent/strategy_logout_test.go on lines 590..594

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

            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

                    c := createClientWithBackchannelLogout(t, backChannelWG, func(t *testing.T, logoutToken gjson.Result) {
                        assert.EqualValues(t, <-sid, logoutToken.Get("sid").String(), logoutToken.Raw)
                        assert.Empty(t, logoutToken.Get("sub").String(), logoutToken.Raw) // The sub claim should be empty because it doesn't work with forced obfuscation and thus we can't easily recover it.
                        assert.Empty(t, logoutToken.Get("nonce").String(), logoutToken.Raw)
                    })
            Severity: Major
            Found in consent/strategy_logout_test.go and 1 other location - About 1 hr to fix
            consent/strategy_logout_test.go on lines 332..336

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

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

            func TestHelperNID(r interface {
                client.ManagerProvider
                FlowCipher() *aead.XChaCha20Poly1305
            }, t1ValidNID consent.Manager, t2InvalidNID consent.Manager) func(t *testing.T) {
                testClient := client.Client{ID: "2022-03-11-client-nid-test-1"}
            Severity: Minor
            Found in consent/test/manager_test_helpers.go - About 1 hr to fix

              Method Handler.rejectOAuth2ConsentRequest has 52 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func (h *Handler) rejectOAuth2ConsentRequest(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                  ctx := r.Context()
              
                  challenge := stringsx.Coalesce(
                      r.URL.Query().Get("consent_challenge"),
              Severity: Minor
              Found in consent/handler.go - About 1 hr to fix

                Function TestGetLoginRequestWithDuplicateAccept has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func TestGetLoginRequestWithDuplicateAccept(t *testing.T) {
                    t.Run("Test get login request with duplicate accept", func(t *testing.T) {
                        ctx := context.Background()
                        challenge := "challenge"
                        requestURL := "http://192.0.2.1"
                Severity: Minor
                Found in consent/handler_test.go - About 1 hr to fix

                  Method APIClient.decode has 52 lines of code (exceeds 50 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

                    Function TestGetOrGenerateKeys has 52 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                    func TestGetOrGenerateKeys(t *testing.T) {
                        t.Parallel()
                        reg := internal.NewMockedRegistry(t, &contextx.Default{})
                    
                        setId := uuid.NewUUID().String()
                    Severity: Minor
                    Found in jwk/helper_test.go - About 1 hr to fix

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

                              run := func(strategy string) func(t *testing.T) {
                                  return func(t *testing.T) {
                                      reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, strategy)
                      
                                      cl, conf := newClient(t)
                      Severity: Major
                      Found in oauth2/oauth2_client_credentials_test.go and 1 other location - About 1 hr to fix
                      oauth2/oauth2_client_credentials_bench_test.go on lines 125..132

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

                      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 (m *MockSignerDecrypter) Decrypt(arg0 io.Reader, arg1 []byte, arg2 crypto.DecrypterOpts) ([]byte, error) {
                          m.ctrl.T.Helper()
                          ret := m.ctrl.Call(m, "Decrypt", arg0, arg1, arg2)
                          ret0, _ := ret[0].([]byte)
                          ret1, _ := ret[1].(error)
                      Severity: Major
                      Found in hsm/crypto11_mock_test.go and 1 other location - About 1 hr to fix
                      hsm/crypto11_mock_test.go on lines 88..94

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

                      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 (m *MockSignerDecrypter) Sign(arg0 io.Reader, arg1 []byte, arg2 crypto.SignerOpts) ([]byte, error) {
                          m.ctrl.T.Helper()
                          ret := m.ctrl.Call(m, "Sign", arg0, arg1, arg2)
                          ret0, _ := ret[0].([]byte)
                          ret1, _ := ret[1].(error)
                      Severity: Major
                      Found in hsm/crypto11_mock_test.go and 1 other location - About 1 hr to fix
                      hsm/crypto11_mock_test.go on lines 45..51

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

                      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

                          run := func(strategy string) func(b *testing.B) {
                              return func(t *testing.B) {
                                  reg.Config().MustSet(ctx, config.KeyAccessTokenStrategy, strategy)
                      
                                  cl, conf := newClient(b)
                      Severity: Major
                      Found in oauth2/oauth2_client_credentials_bench_test.go and 1 other location - About 1 hr to fix
                      oauth2/oauth2_client_credentials_test.go on lines 139..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 133.

                      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

                            login: {
                              accept: acceptLogin = true,
                              skip: skipLogin = false,
                              remember: rememberLogin = false,
                              username = "foo@bar.com",
                      Severity: Major
                      Found in cypress/support/commands.js and 1 other location - About 1 hr to fix
                      cypress/support/commands.js on lines 118..124

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

                      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

                            login: {
                              accept: acceptLogin = true,
                              skip: skipLogin = false,
                              remember: rememberLogin = false,
                              username = "foo@bar.com",
                      Severity: Major
                      Found in cypress/support/commands.js and 1 other location - About 1 hr to fix
                      cypress/support/commands.js on lines 43..49

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

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

                      func (h *Handler) rejectOAuth2LoginRequest(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
                          ctx := r.Context()
                      
                          challenge := stringsx.Coalesce(
                              r.URL.Query().Get("login_challenge"),
                      Severity: Minor
                      Found in consent/handler.go - About 1 hr to fix

                        Function purge has 51 lines of code (exceeds 50 allowed). Consider refactoring.
                        Open

                        func purge(cmd *cobra.Command, args []string, sl *servicelocatorx.Options, dOpts []driver.OptionsModifier) error {
                            ctx := cmd.Context()
                            var d driver.Registry
                        
                            co := []configx.OptionModifier{
                        Severity: Minor
                        Found in cmd/cli/handler_janitor.go - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language