All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.metaeffekt.artifact.enrichment.configurations.VulnerabilityAssessmentDashboardDetailLevelConfiguration Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2021-2024 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.metaeffekt.artifact.enrichment.configurations;

import com.metaeffekt.mirror.contents.store.AdvisoryTypeIdentifier;
import org.metaeffekt.core.inventory.processor.configuration.ProcessConfiguration;
import org.metaeffekt.core.inventory.processor.configuration.ProcessMisconfiguration;
import org.metaeffekt.core.inventory.processor.report.configuration.CentralSecurityPolicyConfiguration;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

/**
 * A generated VAD might be very large in its file size, depending on how many timelines and advisories are included.
 * Add a configuration parameter that allows for specifying different detail levels on vulnerability assessment levels:
 *
 * 
    *
  • insignificant
  • *
  • affected
  • *
  • ...
  • *
*

* Detail levels consist of a list of elements to hide from the dashboard: *

    *
  • timeline
  • *
  • advisors *
      *
    • different types of advisories (notice, ...)
    • *
    • by advisory providers (CERT-FR, ...)
    • *
    *
  • *
  • references
  • *
  • eol-date information
  • *
*/ public class VulnerabilityAssessmentDashboardDetailLevelConfiguration extends ProcessConfiguration { private boolean timeline = true; private boolean advisoriesGlobal = true; private boolean advisoriesReferences = true; private boolean references = true; private boolean eol = true; private List advisoryByTypes = new ArrayList<>(); private List advisoryByProviders = new ArrayList<>(); public VulnerabilityAssessmentDashboardDetailLevelConfiguration() { advisoryByTypes.add("any"); advisoryByProviders.add("any"); } public boolean isTimeline() { return timeline; } public boolean isAdvisoriesGlobal() { return advisoriesGlobal; } public boolean isAdvisoriesReferences() { return advisoriesReferences; } public List getAdvisoryByTypes() { return advisoryByTypes; } public boolean isAdvisoryTypeEnabled(String advisoryType) { return advisoryByTypes.contains(advisoryType) || CentralSecurityPolicyConfiguration.isAny(advisoryType) || CentralSecurityPolicyConfiguration.containsAny(advisoryByTypes); } public List getAdvisoryByProviders() { return advisoryByProviders; } public boolean isAdvisoryProviderEnabled(String advisoryProvider) { return advisoryByProviders.contains(advisoryProvider) || CentralSecurityPolicyConfiguration.isAny(advisoryProvider) || CentralSecurityPolicyConfiguration.containsAny(advisoryByProviders); } public boolean isAdvisoryProviderEnabled(AdvisoryTypeIdentifier advisoryProvider) { return isAdvisoryProviderEnabled(advisoryProvider.name()) || isAdvisoryProviderEnabled(advisoryProvider.getWellFormedName()); } public boolean isReferences() { return references; } public boolean isEol() { return eol; } public VulnerabilityAssessmentDashboardDetailLevelConfiguration setTimeline(boolean timeline) { this.timeline = timeline; return this; } public VulnerabilityAssessmentDashboardDetailLevelConfiguration setAdvisoriesGlobal(boolean advisoriesGlobal) { this.advisoriesGlobal = advisoriesGlobal; return this; } public VulnerabilityAssessmentDashboardDetailLevelConfiguration setAdvisoriesReferences(boolean advisoriesReferences) { this.advisoriesReferences = advisoriesReferences; return this; } public VulnerabilityAssessmentDashboardDetailLevelConfiguration setAdvisoryByTypes(List advisoryByTypes) { this.advisoryByTypes = advisoryByTypes; return this; } public VulnerabilityAssessmentDashboardDetailLevelConfiguration setAdvisoryByProviders(List advisoryByProviders) { this.advisoryByProviders = advisoryByProviders; return this; } public VulnerabilityAssessmentDashboardDetailLevelConfiguration setReferences(boolean references) { this.references = references; return this; } public void setEol(boolean eol) { this.eol = eol; } @Override public LinkedHashMap getProperties() { LinkedHashMap properties = new LinkedHashMap<>(); properties.put("timeline", timeline); properties.put("references", references); properties.put("advisoriesGlobal", advisoriesGlobal); properties.put("advisoriesReferences", advisoriesReferences); properties.put("advisoryByTypes", advisoryByTypes); properties.put("advisoryByProviders", advisoryByProviders); properties.put("eol", eol); return properties; } @Override public void setProperties(LinkedHashMap properties) { super.loadBooleanProperty(properties, "timeline", this::setTimeline); super.loadBooleanProperty(properties, "references", this::setReferences); super.loadBooleanProperty(properties, "advisoriesGlobal", this::setAdvisoriesGlobal); super.loadBooleanProperty(properties, "advisoriesReferences", this::setAdvisoriesReferences); super.loadListProperty(properties, "advisoryByTypes", String::valueOf, this::setAdvisoryByTypes); super.loadListProperty(properties, "advisoryByProviders", String::valueOf, this::setAdvisoryByProviders); super.loadBooleanProperty(properties, "eol", this::setEol); } @Override protected void collectMisconfigurations(List misconfigurations) { } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy