ory-am/hydra

View on GitHub

Showing 853 of 853 total issues

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

func (mr *MockOAuth2ProviderMockRecorder) WriteAccessError(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
    mr.mock.ctrl.T.Helper()
    return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteAccessError", reflect.TypeOf((*MockOAuth2Provider)(nil).WriteAccessError), arg0, arg1, arg2, arg3)
}
Severity: Major
Found in oauth2/oauth2_provider_mock_test.go and 5 other locations - About 45 mins to fix
oauth2/oauth2_provider_mock_test.go on lines 202..205
oauth2/oauth2_provider_mock_test.go on lines 214..217
oauth2/oauth2_provider_mock_test.go on lines 226..229
oauth2/oauth2_provider_mock_test.go on lines 262..265
oauth2/oauth2_provider_mock_test.go on lines 274..277

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

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 6 locations. Consider refactoring.
Open

func (mr *MockOAuth2ProviderMockRecorder) WriteAccessResponse(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
    mr.mock.ctrl.T.Helper()
    return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteAccessResponse", reflect.TypeOf((*MockOAuth2Provider)(nil).WriteAccessResponse), arg0, arg1, arg2, arg3)
}
Severity: Major
Found in oauth2/oauth2_provider_mock_test.go and 5 other locations - About 45 mins to fix
oauth2/oauth2_provider_mock_test.go on lines 190..193
oauth2/oauth2_provider_mock_test.go on lines 214..217
oauth2/oauth2_provider_mock_test.go on lines 226..229
oauth2/oauth2_provider_mock_test.go on lines 262..265
oauth2/oauth2_provider_mock_test.go on lines 274..277

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

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 6 locations. Consider refactoring.
Open

func (mr *MockOAuth2ProviderMockRecorder) WritePushedAuthorizeError(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
    mr.mock.ctrl.T.Helper()
    return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WritePushedAuthorizeError", reflect.TypeOf((*MockOAuth2Provider)(nil).WritePushedAuthorizeError), arg0, arg1, arg2, arg3)
}
Severity: Major
Found in oauth2/oauth2_provider_mock_test.go and 5 other locations - About 45 mins to fix
oauth2/oauth2_provider_mock_test.go on lines 190..193
oauth2/oauth2_provider_mock_test.go on lines 202..205
oauth2/oauth2_provider_mock_test.go on lines 214..217
oauth2/oauth2_provider_mock_test.go on lines 226..229
oauth2/oauth2_provider_mock_test.go on lines 274..277

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

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 6 locations. Consider refactoring.
Open

func (mr *MockOAuth2ProviderMockRecorder) WritePushedAuthorizeResponse(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
    mr.mock.ctrl.T.Helper()
    return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WritePushedAuthorizeResponse", reflect.TypeOf((*MockOAuth2Provider)(nil).WritePushedAuthorizeResponse), arg0, arg1, arg2, arg3)
}
Severity: Major
Found in oauth2/oauth2_provider_mock_test.go and 5 other locations - About 45 mins to fix
oauth2/oauth2_provider_mock_test.go on lines 190..193
oauth2/oauth2_provider_mock_test.go on lines 202..205
oauth2/oauth2_provider_mock_test.go on lines 214..217
oauth2/oauth2_provider_mock_test.go on lines 226..229
oauth2/oauth2_provider_mock_test.go on lines 262..265

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

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 6 locations. Consider refactoring.
Open

func (mr *MockOAuth2ProviderMockRecorder) WriteAuthorizeError(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
    mr.mock.ctrl.T.Helper()
    return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteAuthorizeError", reflect.TypeOf((*MockOAuth2Provider)(nil).WriteAuthorizeError), arg0, arg1, arg2, arg3)
}
Severity: Major
Found in oauth2/oauth2_provider_mock_test.go and 5 other locations - About 45 mins to fix
oauth2/oauth2_provider_mock_test.go on lines 190..193
oauth2/oauth2_provider_mock_test.go on lines 202..205
oauth2/oauth2_provider_mock_test.go on lines 226..229
oauth2/oauth2_provider_mock_test.go on lines 262..265
oauth2/oauth2_provider_mock_test.go on lines 274..277

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

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 (p *Persister) CreateLogoutRequest(ctx context.Context, request *flow.LogoutRequest) (err error) {
    ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.CreateLogoutRequest")
    defer otelx.End(span, &err)

    return errorsx.WithStack(p.CreateWithNetwork(ctx, request))
Severity: Minor
Found in persistence/sql/persister_consent.go and 1 other location - About 45 mins to fix
persistence/sql/persister_oauth2.go on lines 217..222

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

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 (p *Persister) deactivateSessionByRequestID(ctx context.Context, id string, table tableName) (err error) {
    ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.deactivateSessionByRequestID")
    defer otelx.End(span, &err)

    /* #nosec G201 table is static */
Severity: Minor
Found in persistence/sql/persister_oauth2.go and 1 other location - About 45 mins to fix
persistence/sql/persister_oauth2.go on lines 326..340

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

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 (p *Persister) ListUserAuthenticatedClientsWithFrontChannelLogout(ctx context.Context, subject, sid string) (_ []client.Client, err error) {
    ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.ListUserAuthenticatedClientsWithFrontChannelLogout")
    defer otelx.End(span, &err)

    return p.listUserAuthenticatedClients(ctx, subject, sid, "front")
Severity: Minor
Found in persistence/sql/persister_consent.go and 1 other location - About 45 mins to fix
persistence/sql/persister_consent.go on lines 635..640

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

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 (p *Persister) SetClientAssertionJWTRaw(ctx context.Context, jti *oauth2.BlacklistedJTI) (err error) {
    ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.SetClientAssertionJWTRaw")
    defer otelx.End(span, &err)

    return sqlcon.HandleError(p.CreateWithNetwork(ctx, jti))
Severity: Minor
Found in persistence/sql/persister_oauth2.go and 1 other location - About 45 mins to fix
persistence/sql/persister_consent.go on lines 673..678

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

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 (p *Persister) ListUserAuthenticatedClientsWithBackChannelLogout(ctx context.Context, subject, sid string) (_ []client.Client, err error) {
    ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.ListUserAuthenticatedClientsWithBackChannelLogout")
    defer otelx.End(span, &err)

    return p.listUserAuthenticatedClients(ctx, subject, sid, "back")
Severity: Minor
Found in persistence/sql/persister_consent.go and 1 other location - About 45 mins to fix
persistence/sql/persister_consent.go on lines 628..633

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

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 (p *Persister) InvalidateAuthorizeCodeSession(ctx context.Context, signature string) (err error) {
    ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.InvalidateAuthorizeCodeSession")
    defer otelx.End(span, &err)

    /* #nosec G201 table is static */
Severity: Minor
Found in persistence/sql/persister_oauth2.go and 1 other location - About 45 mins to fix
persistence/sql/persister_oauth2.go on lines 297..311

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

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 OAuth2APIService.DeleteOAuth2ClientExecute has 7 return statements (exceeds 4 allowed).
Open

func (a *OAuth2APIService) DeleteOAuth2ClientExecute(r ApiDeleteOAuth2ClientRequest) (*http.Response, error) {
    var (
        localVarHTTPMethod = http.MethodDelete
        localVarPostBody   interface{}
        formFiles          []formFile
Severity: Major
Found in internal/httpclient/api_o_auth2.go - About 45 mins to fix

    Method OAuth2APIService.DeleteTrustedOAuth2JwtGrantIssuerExecute has 7 return statements (exceeds 4 allowed).
    Open

    func (a *OAuth2APIService) DeleteTrustedOAuth2JwtGrantIssuerExecute(r ApiDeleteTrustedOAuth2JwtGrantIssuerRequest) (*http.Response, error) {
        var (
            localVarHTTPMethod = http.MethodDelete
            localVarPostBody   interface{}
            formFiles          []formFile
    Severity: Major
    Found in internal/httpclient/api_o_auth2.go - About 45 mins to fix

      Method Handler.rejectOAuth2LoginRequest has 7 return statements (exceeds 4 allowed).
      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: Major
      Found in consent/handler.go - About 45 mins to fix

        Method Handler.acceptOAuth2ConsentRequest has 7 return statements (exceeds 4 allowed).
        Open

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

          Function ManagerTests has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          func ManagerTests(deps Deps, m consent.Manager, clientManager client.Manager, fositeManager x.FositeStorer, network string, parallel bool) func(t *testing.T) {
          Severity: Minor
          Found in consent/test/manager_test_helpers.go - About 45 mins to fix

            Method OidcAPIService.DeleteOidcDynamicClientExecute has 7 return statements (exceeds 4 allowed).
            Open

            func (a *OidcAPIService) DeleteOidcDynamicClientExecute(r ApiDeleteOidcDynamicClientRequest) (*http.Response, error) {
                var (
                    localVarHTTPMethod = http.MethodDelete
                    localVarPostBody   interface{}
                    formFiles          []formFile
            Severity: Major
            Found in internal/httpclient/api_oidc.go - About 45 mins to fix

              Method OAuth2APIService.RevokeOAuth2LoginSessionsExecute has 7 return statements (exceeds 4 allowed).
              Open

              func (a *OAuth2APIService) RevokeOAuth2LoginSessionsExecute(r ApiRevokeOAuth2LoginSessionsRequest) (*http.Response, error) {
                  var (
                      localVarHTTPMethod = http.MethodDelete
                      localVarPostBody   interface{}
                      formFiles          []formFile
              Severity: Major
              Found in internal/httpclient/api_o_auth2.go - About 45 mins to fix

                Method DefaultStrategy.forwardConsentRequest has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    ctx context.Context,
                    w http.ResponseWriter,
                    r *http.Request,
                    ar fosite.AuthorizeRequester,
                    f *flow.Flow,
                Severity: Minor
                Found in consent/strategy_default.go - About 45 mins to fix

                  Method DefaultStrategy.forwardConsentRequest has 7 return statements (exceeds 4 allowed).
                  Open

                  func (s *DefaultStrategy) forwardConsentRequest(
                      ctx context.Context,
                      w http.ResponseWriter,
                      r *http.Request,
                      ar fosite.AuthorizeRequester,
                  Severity: Major
                  Found in consent/strategy_default.go - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language