ory-am/hydra

View on GitHub

Showing 850 of 850 total issues

Method NullDuration.UnmarshalJSON has 5 return statements (exceeds 4 allowed).
Open

func (ns *NullDuration) UnmarshalJSON(data []byte) error {
    if ns == nil {
        return errors.New("json.RawMessage: UnmarshalJSON on nil pointer")
    }

Severity: Major
Found in x/sqlx.go - About 35 mins to fix

    Function BenchmarkAuthCode has 5 return statements (exceeds 4 allowed).
    Open

    func BenchmarkAuthCode(b *testing.B) {
        flag.Parse()
    
        ctx := context.Background()
    
    
    Severity: Major
    Found in oauth2/oauth2_auth_code_bench_test.go - About 35 mins to fix

      Function OnlyPublicSDKKeys has 5 return statements (exceeds 4 allowed).
      Open

      func OnlyPublicSDKKeys(in []hydra.JsonWebKey) (out []hydra.JsonWebKey, _ error) {
          var interim []jose.JSONWebKey
          var b bytes.Buffer
      
          if err := json.NewEncoder(&b).Encode(&in); err != nil {
      Severity: Major
      Found in jwk/helper.go - About 35 mins to fix

        Function executeHookAndUpdateSession has 5 return statements (exceeds 4 allowed).
        Open

        func executeHookAndUpdateSession(ctx context.Context, reg x.HTTPClientProvider, hookConfig *config.HookConfig, reqBodyBytes []byte, session *Session) error {
            req, err := retryablehttp.NewRequestWithContext(ctx, http.MethodPost, hookConfig.URL, bytes.NewReader(reqBodyBytes))
            if err != nil {
                return errorsx.WithStack(
                    fosite.ErrServerError.
        Severity: Major
        Found in oauth2/token_hook.go - About 35 mins to fix

          Method Session.UnmarshalJSON has 5 return statements (exceeds 4 allowed).
          Open

          func (s *Session) UnmarshalJSON(original []byte) (err error) {
              transformed := original
              originalParsed := gjson.ParseBytes(original)
          
              for oldKey, newKey := range keyRewrites {
          Severity: Major
          Found in oauth2/session.go - About 35 mins to fix

            Method Handler.performOidcFrontOrBackChannelLogout has 5 return statements (exceeds 4 allowed).
            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 35 mins to fix

              Method Handler.introspectOAuth2Token has 5 return statements (exceeds 4 allowed).
              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 35 mins to fix

                Method Persister.deleteSessionByRequestID has 5 return statements (exceeds 4 allowed).
                Open

                func (p *Persister) deleteSessionByRequestID(ctx context.Context, id string, table tableName) (err error) {
                    ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.deleteSessionByRequestID")
                    defer otelx.End(span, &err)
                
                    err = p.QueryWithNetwork(ctx).
                Severity: Major
                Found in persistence/sql/persister_oauth2.go - About 35 mins to fix

                  Function checkStatus has 5 return statements (exceeds 4 allowed).
                  Open

                  func checkStatus(t *testing.T, testID string) (string, status) {
                      res, err := httpClient.Get(urlx.AppendPaths(server, "/api/info", testID).String())
                      require.NoError(t, err)
                      defer res.Body.Close()
                      body, err := io.ReadAll(res.Body)
                  Severity: Major
                  Found in test/conformance/run_test.go - About 35 mins to fix

                    Method OAuth2RequestSQL.toRequest has 5 return statements (exceeds 4 allowed).
                    Open

                    func (r *OAuth2RequestSQL) toRequest(ctx context.Context, session fosite.Session, p *Persister) (_ *fosite.Request, err error) {
                        ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.toRequest")
                        defer otelx.End(span, &err)
                    
                        sess := r.Session
                    Severity: Major
                    Found in persistence/sql/persister_oauth2.go - About 35 mins to fix

                      Method Persister.GetAccessTokenSession has 5 return statements (exceeds 4 allowed).
                      Open

                      func (p *Persister) GetAccessTokenSession(ctx context.Context, signature string, session fosite.Session) (request fosite.Requester, err error) {
                          ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.GetAccessTokenSession")
                          defer otelx.End(span, &err)
                      
                          r := OAuth2RequestSQL{Table: sqlTableAccess}
                      Severity: Major
                      Found in persistence/sql/persister_oauth2.go - About 35 mins to fix

                        Function claimsFromVCResponse has 5 return statements (exceeds 4 allowed).
                        Open

                        func claimsFromVCResponse(t *testing.T, reg driver.Registry, vc *hydraoauth2.VerifiableCredentialResponse) (*jwt.Token, *hydraoauth2.VerifableCredentialClaims) {
                            ctx := context.Background()
                            token, err := jwt.ParseWithClaims(vc.Credential, new(hydraoauth2.VerifableCredentialClaims), func(token *jwt.Token) (interface{}, error) {
                                kid, found := token.Header["kid"]
                                if !found {
                        Severity: Major
                        Found in oauth2/oauth2_auth_code_test.go - About 35 mins to fix

                          Method Duration.UnmarshalJSON has 5 return statements (exceeds 4 allowed).
                          Open

                          func (ns *Duration) UnmarshalJSON(data []byte) error {
                              if ns == nil {
                                  return errors.New("json.RawMessage: UnmarshalJSON on nil pointer")
                              }
                          
                          
                          Severity: Major
                          Found in x/sqlx.go - About 35 mins to fix

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

                                        checkAndAcceptLoginHandler(t, adminClient, subject, func(t *testing.T, res *hydra.OAuth2LoginRequest, err error) hydra.AcceptOAuth2LoginRequest {
                                            require.NoError(t, err)
                                            assert.False(t, res.Skip) // Skip should always be false here because prompt has login
                                            return hydra.AcceptOAuth2LoginRequest{Remember: pointerx.Bool(true)}
                                        }),
                            Severity: Minor
                            Found in consent/strategy_oauth_test.go and 1 other location - About 35 mins to fix
                            consent/strategy_oauth_test.go on lines 741..747

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

                            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

                                            checkAndAcceptLoginHandler(t, adminClient, subject, func(t *testing.T, res *hydra.OAuth2LoginRequest, err error) hydra.AcceptOAuth2LoginRequest {
                                                require.NoError(t, err)
                                                assert.False(t, res.Skip) // Skip should always be false here
                                                return hydra.AcceptOAuth2LoginRequest{
                                                    Remember: pointerx.Bool(true),
                            Severity: Minor
                            Found in consent/strategy_oauth_test.go and 1 other location - About 35 mins to fix
                            consent/strategy_oauth_test.go on lines 818..822

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

                            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

                                                {
                                                    name:      "proof=invalid type",
                                                    proofType: "invalid",
                                                    proof: func() string {
                                                        // Create mismatching public and private keys.
                            Severity: Minor
                            Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 35 mins to fix
                            oauth2/oauth2_auth_code_test.go on lines 445..455

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

                            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

                                                {
                                                    name:   "proof=invalid format",
                                                    format: "invalid_format",
                                                    proof: func() string {
                                                        // Create mismatching public and private keys.
                            Severity: Minor
                            Found in oauth2/oauth2_auth_code_test.go and 1 other location - About 35 mins to fix
                            oauth2/oauth2_auth_code_test.go on lines 456..466

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

                            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

                            func (p *Persister) DeletePKCERequestSession(ctx context.Context, signature string) (err error) {
                                ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.DeletePKCERequestSession")
                                defer otelx.End(span, &err)
                                return p.deleteSessionBySignature(ctx, signature, sqlTablePKCE)
                            }
                            Severity: Major
                            Found in persistence/sql/persister_oauth2.go and 4 other locations - About 35 mins to fix
                            persistence/sql/persister_oauth2.go on lines 435..439
                            persistence/sql/persister_oauth2.go on lines 455..459
                            persistence/sql/persister_oauth2.go on lines 480..484
                            persistence/sql/persister_oauth2.go on lines 492..496

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

                            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

                            func (p *Persister) RevokeRefreshToken(ctx context.Context, id string) (err error) {
                                ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.RevokeRefreshToken")
                                defer otelx.End(span, &err)
                                return p.deactivateSessionByRequestID(ctx, id, sqlTableRefresh)
                            }
                            Severity: Major
                            Found in persistence/sql/persister_oauth2.go and 4 other locations - About 35 mins to fix
                            persistence/sql/persister_oauth2.go on lines 435..439
                            persistence/sql/persister_oauth2.go on lines 455..459
                            persistence/sql/persister_oauth2.go on lines 474..478
                            persistence/sql/persister_oauth2.go on lines 492..496

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

                            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

                            func (p *Persister) DeleteOpenIDConnectSession(ctx context.Context, signature string) (err error) {
                                ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.DeleteOpenIDConnectSession")
                                defer otelx.End(span, &err)
                                return p.deleteSessionBySignature(ctx, signature, sqlTableOpenID)
                            }
                            Severity: Major
                            Found in persistence/sql/persister_oauth2.go and 4 other locations - About 35 mins to fix
                            persistence/sql/persister_oauth2.go on lines 435..439
                            persistence/sql/persister_oauth2.go on lines 474..478
                            persistence/sql/persister_oauth2.go on lines 480..484
                            persistence/sql/persister_oauth2.go on lines 492..496

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

                            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