Package com.vaadin.appsec.backend
Class AppSecService
java.lang.Object
com.vaadin.appsec.backend.AppSecService
Service that provides access to all AppSec Kit features, such as
vulnerability scanning and analysis storage.
-
Method Summary
Modifier and TypeMethodDescriptionaddScanEventListener(AppSecScanEventListener listener) Adds a listener for scan events.Gets the current configuration.getData()Gets the data object, reading it from the file-system if the file exists.Gets the list of application dependencies (including transitive).static AppSecServiceGet the AppSecService singleton instance.Gets the list of new vulnerabilities.Gets the list of Vaadin Flow versions for which the kit provides vulnerability assessments.Gets the list of vulnerabilities found in application dependencies.Gets the Vaadin Security Team assessments about known vulnerability coming from transitive dependencies of the current maintained Vaadin versions.voidinit()Initializes the service reading the SBOM file.refresh()Re-reads data from disk.Scans the application dependencies for vulnerabilities.voidSchedules automatic scan for vulnerabilities at a fixed rate set to the value configured withAppSecConfiguration.setAutoScanInterval(java.time.Duration).voidsetConfiguration(AppSecConfiguration configuration) Allows to set the configuration for this singleton instance.voidsetData(AppSecData data) Sets the data object, writing it to the file-system.
-
Method Details
-
getInstance
Get the AppSecService singleton instance.- Returns:
- singleton the singleton instance
-
init
public void init()Initializes the service reading the SBOM file. -
getSupportedFlowVersions
Gets the list of Vaadin Flow versions for which the kit provides vulnerability assessments.- Returns:
- the list of versions
-
getVulnerabilityAnalysis
Gets the Vaadin Security Team assessments about known vulnerability coming from transitive dependencies of the current maintained Vaadin versions.- Returns:
- the vulnerability analysis
- See Also:
-
scheduleAutomaticScan
public void scheduleAutomaticScan()Schedules automatic scan for vulnerabilities at a fixed rate set to the value configured withAppSecConfiguration.setAutoScanInterval(java.time.Duration). -
addScanEventListener
Adds a listener for scan events.All listeners will be invoked once a scan has been performed successfully.
- Parameters:
listener- the listener- Returns:
- a registration object that can be used to remove the listener
-
scanForVulnerabilities
Scans the application dependencies for vulnerabilities. The scan is performed against the OSV database (see osv.dev).The scan is performed asynchronously on a thread created by the
Executorset in the service configuration (the default is a single-thread executor). A custom executor can be set withAppSecConfiguration.setTaskExecutor(ScheduledExecutorService).- Returns:
- a future completed when the scan has ended
-
getDependencies
Gets the list of application dependencies (including transitive).- Returns:
- the list of dependencies
-
getVulnerabilities
Gets the list of vulnerabilities found in application dependencies. The list is always empty before the first scan. To scan dependencies for vulnerabilities seescanForVulnerabilities().- Returns:
- the list of vulnerabilities
-
getNewVulnerabilities
Gets the list of new vulnerabilities. A vulnerability is considered new if there is no developer assessment data for that vulnerability.- Returns:
- the list of new vulnerabilities
-
getData
Gets the data object, reading it from the file-system if the file exists.- Returns:
- the data object, not
null
-
setData
Sets the data object, writing it to the file-system.- Parameters:
data- the data object, notnull
-
refresh
Re-reads data from disk.- Returns:
- the data object, not
null
-
getConfiguration
Gets the current configuration. Changes to the instance returned from this method will not be applied until the instance is set withsetConfiguration(AppSecConfiguration).- Returns:
- the current configuration
-
setConfiguration
Allows to set the configuration for this singleton instance. When a new configuration is set, the service need to be initialized again withinit().- Parameters:
configuration- configuration to set
-