Package com.denimgroup.threadfix.data.entities

Examples of com.denimgroup.threadfix.data.entities.Application$Info


        if (!permissionService.isAuthorized(Permission.CAN_MANAGE_APPLICATIONS, orgId, appId)) {
            return "403";
        }

        if(application != null && application.getId() != null) {
            Application databaseApplication = applicationService.loadApplication(application.getId());
            if (databaseApplication == null) {
                result.rejectValue("waf.id", null, null, "We were unable to retrieve the application.");
            } else {
                if (application.getWaf() != null && (application.getWaf().getId() == null ||
                        application.getWaf().getId() == 0)) {
                    databaseApplication.setWaf(null);
                }

                if (application.getWaf() != null && application.getWaf().getId() != null && application.getWaf().getId() != 0) {
                    Waf waf = wafService.loadWaf(application.getWaf().getId());

                    if (waf == null) {
                        result.rejectValue("waf.id", "errors.invalid",
                                new String [] { "WAF Choice" }, null);
                    } else {
                        databaseApplication.setWaf(waf);
                    }
                }

                applicationService.storeApplication(databaseApplication);
View Full Code Here


        assert foundBasicEndpoint : "Didn't find /WebForm1.aspx";
    }

    @Test
    public void testXSSVulnsMerge() {
        Application application = Merger.mergeFromDifferentScanners(TestConstants.WEB_FORMS_ROOT,
                "SBIR/webform.xml", "SBIR/webform.fpr");

        List<Scan> scans = application.getScans();
        assert scans.size() == 2 :
                "Got " + scans.size() + " scans instead of 2.";

        boolean hasMergedXSSVuln = false;

        for (Vulnerability vulnerability : application.getVulnerabilities()) {
            if (vulnerability.getGenericVulnerability().getDisplayId().equals(79)) {
                if (vulnerability.getFindings().size() == 2) {
                    hasMergedXSSVuln = true;
                    System.out.println("Found it!");
                } else {
View Full Code Here

   
    if (!validationResult.equals("SUCCESS")) {
      return FormRestResponse.failure(validationResult, result);
    }
   
    Application application = null;
    if (request.getParameter("applicationId") != null) {
      try {
                Integer testId = Integer.valueOf(request.getParameter("applicationId"));
        application = applicationService.loadApplication(testId);
      } catch (NumberFormatException e) {
        log.warn("Non-numeric value discovered in applicationId field. Someone is trying to tamper with it.");
      }
    }
   
    if (application != null) {
            // remove any outdated vuln -> waf rule links
            applicationService.updateWafRules(application, 0);
      application.setWaf(waf);
      applicationService.storeApplication(application);
    }

        return RestResponse.success(waf);
  }
View Full Code Here

        if (!permissionService.isAuthorized(Permission.CAN_MANAGE_APPLICATIONS, orgId, appId)) {
            return "403";
        }

        if(application != null && application.getId() != null) {
            Application databaseApplication = applicationService.loadApplication(application.getId());
        } else {
            result.rejectValue("waf.id", null, null, "We were unable to retrieve the application.");
        }

        if (result.hasErrors()) {
View Full Code Here

    if (appId == null || file == null) {
      log.warn("The document upload file failed to save, it had null input.");
      return null;
    }
   
    Application application = applicationDao.retrieveById(appId);
   
    if (application == null) {
      log.warn("Unable to retrieve Application - document save failed.");
      return null;
    }
   
    if (!contentTypeService.isValidUpload(file.getContentType())){
      log.warn("Invalid filetype for upload: "+file.getContentType());
      return null;
    }
   
    Document doc = new Document();
    String fileFullName;
   
    if(overrideFilename != null) {
      fileFullName = overrideFilename;
    } else {
      fileFullName = file.getOriginalFilename();
    }
    doc.setApplication(application);
    doc.setName(getFileName(fileFullName));
    doc.setType(getFileType(fileFullName));
    if(!doc.getType().equals("json")){
      doc.setContentType(contentTypeService.translateContentType(file.getContentType()))
    }else{
      doc.setContentType(contentTypeService.translateContentType("json"));
    }

    try {
      Blob blob = new SerialBlob(file.getBytes());
      doc.setFile(blob);

      List<Document> appDocs = application.getDocuments();
      if (appDocs == null) {
        appDocs = list();
      }
      appDocs.add(doc);
     
View Full Code Here

  @Override
  public String deleteDocument(Document document) {
   
    if (document.getApplication() != null && document.getApplication().getId() != null ) {
      Application application = applicationDao.retrieveById(document.getApplication().getId());
      application.getDocuments().remove(document);
      document.setApplication(null);
      documentDao.delete(document);
      applicationDao.saveOrUpdate(application);
      return "redirect:/organizations/" + application.getOrganization().getId() + "/applications/" + application.getId();
    }
   
    if (document.getVulnerability() != null && document.getVulnerability().getId() != null ) {
      Vulnerability vulnerability = vulnerabilityDao.retrieveById(document.getVulnerability().getId());
      vulnerability.getDocuments().remove(document);
View Full Code Here

        if (!permissionService.isAuthorized(Permission.CAN_MANAGE_APPLICATIONS, orgId, appId)) {
            return "403";
        }

        Application databaseApplication = applicationService.loadApplication(appId);
        if (databaseApplication == null || !databaseApplication.isActive()) {
            log.warn(ResourceNotFoundException.getLogMessage("Application", appId));
            throw new ResourceNotFoundException();
        }

        // These should not be editable in this method.
        // TODO split into 3 controllers and use setAllowedFields
        application.setWaf(databaseApplication.getWaf());
        application.setDefectTracker(databaseApplication.getDefectTracker());
        application.setUserName(databaseApplication.getUserName());
        application.setPassword(databaseApplication.getPassword());

        if(!result.hasErrors()) {
            applicationService.validateAfterEdit(application, result);
        }
View Full Code Here

        if (!permissionService.isAuthorized(Permission.CAN_MANAGE_APPLICATIONS, orgId, appId)) {
            return "403";
        }

        if(application != null && application.getId() != null) {
            Application databaseApplication = applicationService.loadApplication(application.getId());
            if (databaseApplication == null) {
                result.rejectValue("waf.id", null, null, "We were unable to retrieve the application.");
            } else {
                if (application.getWaf() != null && (application.getWaf().getId() == null ||
                        application.getWaf().getId() == 0)) {
                    databaseApplication.setWaf(null);
                }

                if (application.getWaf() != null && application.getWaf().getId() != null && application.getWaf().getId() != 0) {
                    Waf waf = wafService.loadWaf(application.getWaf().getId());

                    if (waf == null) {
                        result.rejectValue("waf.id", "errors.invalid",
                                new String [] { "WAF Choice" }, null);
                    } else {
                        databaseApplication.setWaf(waf);
                    }
                }

                applicationService.storeApplication(databaseApplication);
View Full Code Here

        if (!permissionService.isAuthorized(Permission.CAN_MANAGE_APPLICATIONS, orgId, appId)) {
            return "403";
        }

        if(application != null && application.getId() != null) {
            Application databaseApplication = applicationService.loadApplication(application.getId());
        } else {
            result.rejectValue("waf.id", null, null, "We were unable to retrieve the application.");
        }

        if (result.hasErrors()) {
View Full Code Here

    if (!PermissionUtils.isAuthorized(Permission.CAN_MANAGE_APPLICATIONS,orgId,appId)) {
      return new ModelAndView("403");
    }
   
    ModelAndView mav = new ModelAndView("path/path");
    Application application = applicationService.loadApplication(appId);
   
    if (application == null) {
      log.warn(ResourceNotFoundException.getLogMessage("Application", appId));
      throw new ResourceNotFoundException();
    }
   
    List<String> pathList = list();
    for (Vulnerability vuln : application.getVulnerabilities()) {
      if (vuln != null && vuln.getFindings() != null) {
        for (Finding finding : vuln.getFindings()) {
          if (finding != null && finding.getSourceFileLocation() != null) {
            pathList.add(finding.getSourceFileLocation());
          }
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.data.entities.Application$Info

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.