OWASP/SSO_Project

View on GitHub

Showing 49 of 52 total issues

Function onCertRegister has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    onCertRegister(req, res, next) {
        const email = req.user.username;
        const label = req.body.label;
        
        if(email.indexOf("'") != -1) {
Severity: Minor
Found in js-backend/flows/authenticator-cert.js - About 1 hr to fix

    Function onFidoRegisterPost has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        onFidoRegisterPost(req, res, next) {
            const userId = req.user.id;
            const regResponse = req.body.response;
            const label = req.body.label;
            
    Severity: Minor
    Found in js-backend/flows/authenticator.js - About 1 hr to fix

      Function createAuthToken has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          createAuthToken(req, res, next) {
              if(!req.user.id) {
                  return res.status(403).send("User needs to be logged in to finish authentication");
              }
              
      Severity: Minor
      Found in js-backend/utils/middleware.js - About 1 hr to fix

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

                    https.get(toUrl, response => {
                        let body = "";
                        response.on("data", (chunk) => body += chunk);
                        response.on("end", () => resolve(body));
                    }).on("error", reject);
        Severity: Major
        Found in js-backend/utils/password.js and 1 other location - About 1 hr to fix
        js-backend/utils/password.js on lines 102..106

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

        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

                    const req = https.request(options, response => {
                        let body = "";
                        response.on("data", (chunk) => body += chunk);
                        response.on("end", () => resolve(body));
                    });
        Severity: Major
        Found in js-backend/utils/password.js and 1 other location - About 1 hr to fix
        js-backend/utils/password.js on lines 81..85

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

        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 parseP12 has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                parseP12(base64Data) {
                    return new Promise((resolve, reject) => {
                        // Clean up
                        const tmpName = os.tmpdir() + "/cypress";
                        try {
        Severity: Minor
        Found in cypress/plugins/index.js - About 1 hr to fix

          Function add has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              add(req, object, action, attribute) {
                  return new Promise((resolve, reject) => {
                      const userId = req.user ? req.user.id : null;
                      const userName = req.user && req.user.username ? req.user.username : null;
                      const ip = this.getIP(req);
          Severity: Minor
          Found in js-backend/utils/audit.js - About 1 hr to fix

            Function onFidoLoginGet has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                onFidoLoginGet(req, res, next) {
                    const userId = req.user.id;
                    
                    Promise.all([
                        this.f2l.assertionOptions(),
            Severity: Minor
            Found in js-backend/flows/authenticator.js - About 1 hr to fix

              Function onFlowIn has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  async onFlowIn(req, res, next) {
                      const dataIn = req.query.d || req.body.d;
                      const pageId = req.query.id || req.body.id;
                      if(!pageId || isNaN(pageId)) {
                          return res.status(400).send("Invalid flow request - missing parameters");
              Severity: Minor
              Found in js-backend/flows/sso-flow.js - About 1 hr 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

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

                      cy.get("#ssoFlowOutForm input[name=SAMLResponse]").invoke("val").then(value => {
                          expect(value).to.have.string("=");
                      });
              Severity: Major
              Found in cypress/integration/sso.js and 1 other location - About 1 hr to fix
              cypress/integration/sso.js on lines 13..15

              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

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

                      cy.get("#ssoFlowOutForm input[name=token]").invoke("val").then(value => {
                          expect(value).to.have.string(".");
                      });
              Severity: Major
              Found in cypress/integration/sso.js and 1 other location - About 1 hr to fix
              cypress/integration/sso.js on lines 24..26

              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

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

                      cy.get(".footer p").should(el => expect(el.text().trim()).to.equal("OWASP Foundation"));
              Severity: Minor
              Found in cypress/integration/guest.js and 1 other location - About 55 mins to fix
              cypress/integration/sso.js on lines 35..35

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

              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

                  cy.get(".footer p").should(el => expect(el.text().trim()).to.equal("E Corp"));
              Severity: Minor
              Found in cypress/integration/sso.js and 1 other location - About 55 mins to fix
              cypress/integration/guest.js on lines 73..73

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

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

                      app.get("/local/email-auth", MiddlewareHelper.rateLimit(5, 5, "Too many email authentication requests, please try again later."), MiddlewareHelper.isLoggedIn, this.localAuthFlow.onLocalEmailAuth.bind(this.localAuthFlow), MiddlewareHelper.showSuccess);
              Severity: Major
              Found in js-backend/flows/index.js and 2 other locations - About 50 mins to fix
              js-backend/flows/index.js on lines 43..43
              js-backend/flows/index.js on lines 50..50

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

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

                      app.post("/local/change-request", MiddlewareHelper.rateLimit(1, 5, "Too many change requests, please try again later."), MiddlewareHelper.antiTiming, this.localAuthFlow.onChangeRequest.bind(this.localAuthFlow), MiddlewareHelper.showSuccess);
              Severity: Major
              Found in js-backend/flows/index.js and 2 other locations - About 50 mins to fix
              js-backend/flows/index.js on lines 43..43
              js-backend/flows/index.js on lines 65..65

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

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

                      app.post("/local/register", MiddlewareHelper.rateLimit(1, 5, "Too many registration requests, please try again later."), MiddlewareHelper.antiTiming, this.localAuthFlow.onRegister.bind(this.localAuthFlow), MiddlewareHelper.showSuccess);
              Severity: Major
              Found in js-backend/flows/index.js and 2 other locations - About 50 mins to fix
              js-backend/flows/index.js on lines 50..50
              js-backend/flows/index.js on lines 65..65

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

              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

              Avoid deeply nested control flow statements.
              Open

                                          if(certHandler.webhook.successContains) {
                                              passCertificate = (response.indexOf(certHandler.webhook.successContains) != -1);
                                          } else if(certHandler.webhook.successRegex) {
                                              passCertificate = response.test(certHandler.webhook.successRegex);
                                          } else {
              Severity: Major
              Found in js-backend/flows/authenticator-cert.js - About 45 mins to fix

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

                        JWT.verify(req.body.token, this.ownJwtToken, {
                            maxAge: JWT.age().SHORT,
                            subject: userId,
                        }).then(jwtToken => {
                            challenge = jwtToken.challenge;
                Severity: Minor
                Found in js-backend/flows/authenticator.js and 1 other location - About 45 mins to fix
                js-backend/flows/authenticator.js on lines 51..65

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

                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

                Avoid deeply nested control flow statements.
                Open

                                            if(!passCertificate) {
                                                return res.status(403).send("Certificate denied by page");
                                            } else {
                                                Audit.add(req, "authenticator", "login", thisPage.name + " certificate").then(() => {
                                                    next();
                Severity: Major
                Found in js-backend/flows/authenticator-cert.js - About 45 mins to fix

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

                          JWT.verify(req.body.token, this.ownJwtToken, {
                              maxAge: JWT.age().SHORT,
                              subject: userId,
                          }).then(regToken => {
                              const challenge = regToken.challenge;
                  Severity: Minor
                  Found in js-backend/flows/authenticator.js and 1 other location - About 45 mins to fix
                  js-backend/flows/authenticator.js on lines 129..136

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

                  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