ory-am/hydra

View on GitHub

Showing 402 of 849 total issues

Method Handler.ValidDynamicAuth has 5 return statements (exceeds 4 allowed).
Open

func (h *Handler) ValidDynamicAuth(r *http.Request, ps httprouter.Params) (fosite.Client, error) {
    c, err := h.r.ClientManager().GetConcreteClient(r.Context(), ps.ByName("id"))
    if err != nil {
        return nil, herodot.ErrUnauthorized.
            WithTrace(err).
Severity: Major
Found in client/handler.go - About 35 mins to fix

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

    func (p *Persister) VerifyAndInvalidateConsentRequest(ctx context.Context, verifier string) (*flow.AcceptOAuth2ConsentRequest, error) {
        ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.VerifyAndInvalidateConsentRequest")
        defer span.End()
    
        f, err := flowctx.Decode[flow.Flow](ctx, p.r.FlowCipher(), verifier, flowctx.AsConsentVerifier)
    Severity: Major
    Found in persistence/sql/persister_consent.go - About 35 mins to fix

      Method JanitorHandler.Args has 5 return statements (exceeds 4 allowed).
      Open

      func (*JanitorHandler) Args(cmd *cobra.Command, args []string) error {
          if len(args) == 0 &&
              !flagx.MustGetBool(cmd, ReadFromEnv) &&
              len(flagx.MustGetStringSlice(cmd, Config)) == 0 {
      
      
      Severity: Major
      Found in cmd/cli/handler_janitor.go - About 35 mins to fix

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

        func NewRevokeTokenCmd() *cobra.Command {
            cmd := &cobra.Command{
                Use:     "token the-token",
                Example: `{{ .CommandPath }} --client-id a0184d6c-b313-4e70-a0b9-905b581e9218 --client-secret Hh1BjioNNm ciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNT`,
                Args:    cobra.ExactArgs(1),
        Severity: Major
        Found in cmd/cmd_revoke_token.go - About 35 mins to fix

          Method migrationGroup.generateSQL has 5 return statements (exceeds 4 allowed).
          Open

          func (mg migrationGroup) generateSQL(sourceFS fs.FS, target string) error {
              ms := mg.Children
              if mg.fallbackDownMigration != nil {
                  ms = append(ms, mg.fallbackDownMigration)
              }
          Severity: Major
          Found in cmd/cli/handler_migrate.go - About 35 mins to fix

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

            func (p *Persister) mySQLConfirmLoginSession(ctx context.Context, session *flow.LoginSession) error {
                err := sqlcon.HandleError(p.Connection(ctx).Create(session))
                if err == nil {
                    return nil
                }
            Severity: Major
            Found in persistence/sql/persister_consent.go - About 35 mins to fix

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

              func NewListClientsCmd() *cobra.Command {
                  cmd := &cobra.Command{
                      Use:     "oauth2-clients",
                      Aliases: []string{"clients"},
                      Short:   "List OAuth 2.0 Clients",
              Severity: Major
              Found in cmd/cmd_list_clients.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 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 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 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

                          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

                            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

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

                                  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 Handler.oauth2TokenExchange has 5 return statements (exceeds 4 allowed).
                                      Open

                                      func (h *Handler) oauth2TokenExchange(w http.ResponseWriter, r *http.Request) {
                                          ctx := r.Context()
                                          session := NewSessionWithCustomClaims(ctx, h.c, "")
                                      
                                          accessRequest, err := h.r.OAuth2Provider().NewAccessRequest(ctx, r, session)
                                      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
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language