Package com.denimgroup.threadfix.data.entities

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


    if (!PermissionUtils.isAuthorized(Permission.CAN_MANAGE_APPLICATIONS, orgId, appId)) {
      return "403";
    }
   
    Application app = applicationService.loadApplication(appId);
   
    if (app == null) {
      log.warn(ResourceNotFoundException.getLogMessage("Application", appId));
      throw new ResourceNotFoundException();
    }
   
    // TODO validate this attachment - not a high priority as it doesn't affect anything really
    app.setProjectRoot(application.getProjectRoot());
    applicationService.storeApplication(app);
    scanMergeService.updateSurfaceLocation(app);
    scanMergeService.updateVulnerabilities(app);
    status.setComplete();
    return "redirect:/organizations/" + String.valueOf(orgId) + "/applications/"
View Full Code Here


    }

        Map<String, Object> map = new HashMap<>();
    Vulnerability vuln = allVulns.get(0);

    Application application = vuln.getApplication();
   
    if (application != null) {
      applicationService.decryptCredentials(application);
    }
   
    AbstractDefectTracker dt = DefectTrackerFactory.getTracker(application);
    if (dt == null) {
      log.warn("Unable to load Defect Tracker.");
      return null;
    }
   
    String editedSummary = summary, editedPreamble = preamble;

    // TODO handle error cases better.
    if (editedSummary == null || editedSummary.equals("")) {
      if (vuln.getGenericVulnerability() != null && vuln.getSurfaceLocation() != null) {
        editedSummary = createMessage(vuln);
      } else {
        editedSummary = "No editedSummary could be parsed.";
      }
    }

    if (editedPreamble == null || editedPreamble.equals("")) {
      if (vuln.getGenericVulnerability() != null && vuln.getSurfaceLocation() != null) {

                if(additionalScannerInfo){
                    String additionalScannerInfoStr = getAdditionalScannerInfo(allVulns);

                    if(additionalScannerInfoStr == null || additionalScannerInfoStr.equals("")){
                        editedPreamble = createMessage(vuln);
                    } else  {
                        editedPreamble = createMessageWithScannerInfo(vuln, additionalScannerInfoStr);
                    }
                } else {
                    editedPreamble = createMessage(vuln);
                }
      } else {
        editedPreamble = "No editedPreamble could be parsed.";
      }
    }

    List<Vulnerability> vulnsWithoutDefects = list();

    for (Vulnerability vulnerability : allVulns) {
      if (vulnerability.getDefect() == null) {
        vulnsWithoutDefects.add(vulnerability);
      }
    }

    if (vulnsWithoutDefects.size() == 0) {
      log.warn("All the vulnerabilities already had defects, exiting.");
      return null;
    }
   
    String defectTrackerName = null;
    if (application != null && application.getDefectTracker() != null
        && application.getDefectTracker().getDefectTrackerType() != null
        && application.getDefectTracker().getDefectTrackerType().getName() != null) {
      defectTrackerName = application.getDefectTracker().getDefectTrackerType().getName();
    }
   
    if (defectTrackerName != null) {
      log.info("About to submit a defect to " + defectTrackerName + ".");
    } else {
      log.info("About to submit a defect to the defect tracker.");
    }
   
    String defectId = dt.createDefect(vulnsWithoutDefects,
        new DefectMetadata(editedSummary, editedPreamble,
        component, version, severity, priority, status, fieldsMap));

    if (defectId != null) {
     
      Defect defect = new Defect();
      defect.setNativeId(defectId);
      defect.setVulnerabilities(vulnsWithoutDefects);
      defect.setApplication(application);
            Object sObj = null;
            if (fieldsMap != null && status == null) {
                sObj = fieldsMap.get("status")==null ? fieldsMap.get("Status") : fieldsMap.get("status");
            }
      status = (sObj != null ? String.valueOf(sObj) : status);

            // By default, set status to Open
            if (status == null)
                status = "Open";

            defect.setStatus(status);
      defect.setDefectURL(dt.getBugURL(
          application.getDefectTracker().getUrl(), defectId));
      defectDao.saveOrUpdate(defect);

      for (Vulnerability vulnerability : vulnsWithoutDefects) {
        vulnerability.setDefect(defect);
        vulnerability.setDefectSubmittedTime(Calendar.getInstance());
View Full Code Here

    Vulnerability vuln = vulns.get(0);
    if (vuln == null || vuln.getApplication() == null) {
      return noDefectTrackerError;
    }

    Application application = vuln.getApplication();

        applicationService.decryptCredentials(application);

        AbstractDefectTracker dt = DefectTrackerFactory.getTracker(application);
    if (dt == null) {
View Full Code Here

  @Override
  @Transactional(readOnly = false)
  public boolean updateVulnsFromDefectTracker(Integer appId) {
   
    Application application = applicationService.loadApplication(appId);
   
    int numUpdated = 0;
   
    if (application == null) {
      log.warn("Application wasn't found, exiting.");
      return false;
    }
   
        applicationService.decryptCredentials(application);

    AbstractDefectTracker dt = DefectTrackerFactory.getTracker(application);
    if (dt == null) {
      log.warn("Unable to load Defect Tracker, exiting.");
      return false;
    }
   
    if (application.getDefectList() == null ||
        application.getDefectList().size() == 0) {
      log.warn("No Defects found, updating information is " +
          "only useful after creating Defects. Exiting.");
      return false;
    }

    Map<Defect, Boolean> defectMap = dt.getMultipleDefectStatus(
        application.getDefectList());
    if (defectMap == null) {
      log.warn("There was an error retrieving information from the " +
          "Defect Tracker, exiting.");
      return false;
    }
View Full Code Here

      return false;
    }
   
    Vulnerability vuln = vulnerabilities.get(0);

    Application application = vuln.getApplication();

        if (application == null) {
            return false;
        }

        applicationService.decryptCredentials(application);

    AbstractDefectTracker dt = DefectTrackerFactory.getTracker(application);
    if (dt == null) {
      log.warn("Unable to load Defect Tracker.");
      return false;
    }
    Defect defect = new Defect();
    defect.setNativeId(id);
    defect.setDefectURL(dt.getBugURL(
        application.getDefectTracker().getUrl(), id));
    defect.setApplication(application);
    List<Defect> defectList = list();
    defectList.add(defect);
        Map<Defect, Boolean> map = dt.getMultipleDefectStatus(defectList);
        if (map.isEmpty())
View Full Code Here

            } else {
                mav.addObject("canAddApps", true);
            }

            mav.addObject("isEnterprise", EnterpriseTest.isEnterprise());
            mav.addObject("application", new Application());
            mav.addObject("applicationTypes", FrameworkType.values());
            mav.addObject("tags", tagService.loadAll());
            mav.addObject("successMessage", ControllerUtils.getSuccessMessage(request));
            if (PermissionUtils.isAuthorized(Permission.CAN_MANAGE_USERS,orgId,null)) {
                mav.addObject("users", userService.getPermissibleUsers(orgId, null));
View Full Code Here

        if (result.hasErrors()) {
            return FormRestResponse.failure("Encountered errors.", result);
        }

        Application application = applicationService.loadApplication(appId);

        if (application == null || !application.isActive()) {
            return RestResponse.failure("Application was not found for ID " + appId);
        }

        int scheduledScanId = scheduledScanService.save(appId, scheduledScan);
    if (scheduledScanId < 0) {
      return RestResponse.failure("Adding Scheduled Scan failed.");
    }

        //Add new job to scheduler
        if (scheduledScanScheduler.addScheduledScan(scheduledScan)) {
            log.info("Successfully added new scheduled scan to scheduler");
            return RestResponse.success(application.getScheduledScans());

        } else {
            log.warn("Failed to add new scheduled scan to scheduler");
            String message = "Adding new "+ scheduledScan.getFrequency() + " Scan for " + scheduledScan.getScanner() + " failed.";
View Full Code Here

                        break;
                    }
                }
                if (scan != null) {
                    if (parameters.getApplicationId() != -1) {
                        Application application = scan.getApplication();
                        appId = application.getId();
                        appName = application.getName();
                        teamId = application.getOrganization().getId();
                        teamName = application.getOrganization().getName();
                    } else {
                        Organization organization = scan.getApplication().getOrganization();
                        teamId = organization.getId();
                        teamName = organization.getName();
                    }
View Full Code Here

TOP

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

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.