ory-am/hydra

View on GitHub

Showing 849 of 849 total issues

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

        t.Run("case=flush-consent-request-timeout", func(t *testing.T) {
            jt := NewConsentJanitorTestHelper(network + "loginTimeout")

            t.Run(fmt.Sprintf("case=%s", "login-timeout"), func(t *testing.T) {

Severity: Major
Found in internal/testhelpers/janitor_test_helper.go and 1 other location - About 4 hrs to fix
internal/testhelpers/janitor_test_helper.go on lines 609..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 365.

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

      if (!skipLogin) {
        cy.get("#email").type(username, { delay: 1 })
        cy.get("#password").type(password, { delay: 1 })

        if (rememberLogin) {
Severity: Major
Found in cypress/support/commands.js and 1 other location - About 4 hrs to fix
cypress/support/commands.js on lines 65..78

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

      if (!skipLogin) {
        cy.get("#email").type(username, { delay: 1 })
        cy.get("#password").type(password, { delay: 1 })

        if (rememberLogin) {
Severity: Major
Found in cypress/support/commands.js and 1 other location - About 4 hrs to fix
cypress/support/commands.js on lines 147..160

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

Method OAuth2Client.ToMap has 146 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (o OAuth2Client) ToMap() (map[string]interface{}, error) {
    toSerialize := map[string]interface{}{}
    if !IsNil(o.AccessTokenStrategy) {
        toSerialize["access_token_strategy"] = o.AccessTokenStrategy
    }
Severity: Major
Found in internal/httpclient/model_o_auth2_client.go - About 4 hrs to fix

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

            testhelpers.NewLoginConsentUI(t, reg.Config(),
                checkAndAcceptLoginHandler(t, adminClient, subject, func(t *testing.T, res *hydra.OAuth2LoginRequest, err error) hydra.AcceptOAuth2LoginRequest {
                    require.NoError(t, err)
                    assert.Empty(t, res.Subject)
                    assert.Empty(t, pointerx.StringR(res.Client.ClientSecret))
    Severity: Major
    Found in consent/strategy_oauth_test.go and 1 other location - About 4 hrs to fix
    consent/strategy_oauth_test.go on lines 378..400

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

    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

            testhelpers.NewLoginConsentUI(t, reg.Config(),
                checkAndAcceptLoginHandler(t, adminClient, subject, func(t *testing.T, res *hydra.OAuth2LoginRequest, err error) hydra.AcceptOAuth2LoginRequest {
                    require.NoError(t, err)
                    assert.Empty(t, res.Subject)
                    assert.Empty(t, pointerx.StringR(res.Client.ClientSecret))
    Severity: Major
    Found in consent/strategy_oauth_test.go and 1 other location - About 4 hrs to fix
    consent/strategy_oauth_test.go on lines 556..578

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

    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

            it("should log in and remember login with back-channel", function () {
              cy.authCodeFlow(
                client,
                {
                  login: { remember: true },
    Severity: Major
    Found in cypress/integration/openid/logout.js and 1 other location - About 4 hrs to fix
    cypress/integration/openid/logout.js on lines 48..66

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

    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

            it("should log in and remember login without id_token_hint", function () {
              cy.authCodeFlow(
                client,
                {
                  login: { remember: true },
    Severity: Major
    Found in cypress/integration/openid/logout.js and 1 other location - About 4 hrs to fix
    cypress/integration/openid/logout.js on lines 125..143

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

    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

    Persister has 36 methods (exceeds 20 allowed). Consider refactoring.
    Open

    func (p *Persister) RevokeSubjectConsentSession(ctx context.Context, user string) error {
        ctx, span := p.r.Tracer(ctx).Tracer().Start(ctx, "persistence.sql.RevokeSubjectConsentSession")
        defer span.End()
    
        return p.Transaction(ctx, p.revokeConsentSession("consent_challenge_id IS NOT NULL AND subject = ?", user))
    Severity: Minor
    Found in persistence/sql/persister_consent.go - About 4 hrs to fix

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

          t.Run("case=should pass and check if login context is set properly", func(t *testing.T) {
              // This should pass because login was remembered and session id should be set and session context should also work
              subject := "aeneas-rekkas"
              c := createDefaultClient(t)
              testhelpers.NewLoginConsentUI(t, reg.Config(),
      Severity: Major
      Found in consent/strategy_oauth_test.go and 1 other location - About 4 hrs to fix
      consent/strategy_oauth_test.go on lines 1012..1037

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

      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

          t.Run("case=should be able to retry accept consent request", func(t *testing.T) {
              subject := "aeneas-rekkas"
              c := createDefaultClient(t)
              testhelpers.NewLoginConsentUI(t, reg.Config(),
                  acceptLoginHandler(t, subject, &hydra.AcceptOAuth2LoginRequest{
      Severity: Major
      Found in consent/strategy_oauth_test.go and 1 other location - About 4 hrs to fix
      consent/strategy_oauth_test.go on lines 609..634

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

      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 DefaultStrategy.issueLogoutVerifier has 140 lines of code (exceeds 50 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: Major
      Found in consent/strategy_default.go - About 4 hrs to fix

        Function NewImportClientCmd has a Cognitive Complexity of 46 (exceeds 20 allowed). Consider refactoring.
        Open

        func NewImportClientCmd() *cobra.Command {
            cmd := &cobra.Command{
                Use:     "oauth2-client <file-1.json> [<file-2.json> ...]",
                Aliases: []string{"client", "clients", "oauth2-clients"},
                Short:   "Import one or more OAuth 2.0 Clients from files or STDIN",
        Severity: Minor
        Found in cmd/cmd_import_client.go - About 4 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 TestValidate has 139 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func TestValidate(t *testing.T) {
            ctx := context.Background()
            c := internal.NewConfigurationWithDefaults()
            c.MustSet(ctx, config.KeySubjectTypesSupported, []string{"pairwise", "public"})
            c.MustSet(ctx, config.KeyDefaultClientScope, []string{"openid"})
        Severity: Major
        Found in client/validator_test.go - About 4 hrs to fix

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

          app.get("/openid/revoke/rt", async (req, res) => {
            const client = await nc(req)
            client
              .revoke(req.session.openid_token.refresh_token)
              .then(() => res.json({ result: "success" }))
          Severity: Major
          Found in test/e2e/oauth2-client/src/index.js and 1 other location - About 4 hrs to fix
          test/e2e/oauth2-client/src/index.js on lines 345..353

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

          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

          app.get("/openid/revoke/at", async (req, res) => {
            const client = await nc(req)
            client
              .revoke(req.session.openid_token.access_token)
              .then(() => res.json({ result: "success" }))
          Severity: Major
          Found in test/e2e/oauth2-client/src/index.js and 1 other location - About 4 hrs to fix
          test/e2e/oauth2-client/src/index.js on lines 355..363

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

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

          func TestCreateCsrfSession(t *testing.T) {
              type cookie struct {
                  httpOnly bool
                  secure   bool
                  domain   string
          Severity: Major
          Found in consent/helper_test.go - About 4 hrs to fix

            Function TestKeyManager_GetKeySet has 138 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func TestKeyManager_GetKeySet(t *testing.T) {
                ctrl := gomock.NewController(t)
                hsmContext := NewMockContext(ctrl)
                defer ctrl.Finish()
                l := logrusx.New("", "")
            Severity: Major
            Found in hsm/manager_hsm_test.go - About 4 hrs to fix

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

                    if (!skipConsent) {
                      acceptScope.forEach((s) => {
                        cy.get(`#${s}`).click()
                      })
              
              
              Severity: Major
              Found in cypress/support/commands.js and 1 other location - About 4 hrs to fix
              cypress/support/commands.js on lines 162..176

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

              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

                    if (!skipConsent) {
                      acceptScope.forEach((s) => {
                        cy.get(`#${s}`).click()
                      })
              
              
              Severity: Major
              Found in cypress/support/commands.js and 1 other location - About 4 hrs to fix
              cypress/support/commands.js on lines 80..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 125.

              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