-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/vulnerability scanning integration #325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hima700
wants to merge
13
commits into
SoftwareDesignLab:dev
Choose a base branch
from
hima700:feature/vulnerability-scanning-integration
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3691d80
feat(api,osi,parser): descriptive filenames, robust OSI tool JSON par…
hima700 1877437
chore(backend): Increase MySQL and Java memory settings in compose files
hima700 059163c
refactor(sbom): decouple entity serialization and prevent circular refs
hima700 7d0783b
Add application.properties and clean up ConflictFile entity
hima700 993ae9d
(feat):Improve null and empty checks in deserializers
hima700 a5f28ae
feat(api): integrate vulnerability scanning with dashboard tracking
hima700 06e2b54
Enhance SBOM scanning and project preparation
hima700 ad658aa
Merge branch 'dev' into feature/vulnerability-scanning-integration
hima700 573fb40
Update OSVClient.java
hima700 1ab4090
Merge branch 'feature/vulnerability-scanning-integration' of https://…
hima700 2cff35d
fix(vuln-scan): filter out CVSS v4 scores, prefer v3.x only
hima700 c1f497d
fix(osi): remap vulnerability refs and preserve merged SBOMs
hima700 3fbfe71
chore(repo): apply review feedback
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| build/ | ||
| build/ | ||
| .env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # TODO: Figure out how to use environment variables when running detached API | ||
| # Configure JDBC MySQL instance source | ||
| spring.datasource.url=jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:sbox}?autoReconnect=true | ||
| spring.datasource.username=${MYSQL_USER} | ||
| spring.datasource.password=${MYSQL_PASSWORD} | ||
| # Configure Hibernate | ||
| spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect | ||
| spring.jpa.hibernate.ddl-auto=update | ||
| # configure MultipartFile upload size | ||
| spring.servlet.multipart.max-file-size=2048MB | ||
| spring.servlet.multipart.max-request-size=2048MB | ||
| # configure OSI endpoint | ||
| osi.api.url=http://${OSI_HOST:localhost}:${OSI_PORT:5000} | ||
| # configure vulnerability scanning | ||
| vulnerability.scan.enabled=${VULN_SCAN_ENABLED:true} | ||
| vulnerability.scan.tools=${VULN_SCAN_TOOLS:grype,trivy} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /** | ||
| * Copyright 2021 Rochester Institute of Technology (RIT). Developed with | ||
| * government support under contract 70RCSA22C00000008 awarded by the United | ||
| * States Department of Homeland Security for Cybersecurity and Infrastructure Security Agency. | ||
| * <p> | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * <p> | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * <p> | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
|
|
||
| package org.svip.api.config; | ||
|
|
||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.scheduling.annotation.EnableAsync; | ||
|
|
||
| import java.util.concurrent.Executor; | ||
| import java.util.concurrent.Executors; | ||
|
|
||
| /** | ||
| * File: AsyncConfig.java | ||
| * Configuration for asynchronous task execution, specifically for parallel vulnerability scanning | ||
| * | ||
| * @author Ibrahim Matar | ||
| */ | ||
| @Configuration | ||
| @EnableAsync | ||
| public class AsyncConfig { | ||
|
|
||
| /** | ||
| * Executor service for parallel vulnerability scanning | ||
| * Uses virtual threads (Java 21+) if available, otherwise fixed thread pool | ||
| * | ||
| * @return Executor for vulnerability scanning tasks | ||
| */ | ||
| @Bean(name = "vulnerabilityScanExecutor") | ||
| public Executor vulnerabilityScanExecutor() { | ||
| // Use virtual threads if available (Java 21+), otherwise use fixed thread pool | ||
| try { | ||
| // Try to use virtual threads (more efficient for I/O-bound tasks like scanning) | ||
| return Executors.newVirtualThreadPerTaskExecutor(); | ||
| } catch (UnsupportedOperationException e) { | ||
| // Fall back to fixed thread pool for Java 17/19 | ||
| return Executors.newFixedThreadPool(4); | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| /** | ||
| * Copyright 2021 Rochester Institute of Technology (RIT). Developed with | ||
| * government support under contract 70RCSA22C00000008 awarded by the United | ||
| * States Department of Homeland Security for Cybersecurity and Infrastructure Security Agency. | ||
| * <p> | ||
| * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| * of this software and associated documentation files (the "Software"), to deal | ||
| * in the Software without restriction, including without limitation the rights | ||
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the Software is | ||
| * furnished to do so, subject to the following conditions: | ||
| * <p> | ||
| * The above copyright notice and this permission notice shall be included in | ||
| * all copies or substantial portions of the Software. | ||
| * <p> | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| * SOFTWARE. | ||
| */ | ||
|
|
||
| package org.svip.api.config; | ||
|
|
||
| import com.fasterxml.jackson.core.StreamReadConstraints; | ||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.context.annotation.Primary; | ||
|
|
||
| /** | ||
| * Jackson configuration to handle large SBOM files | ||
| * | ||
| * This configuration increases the maximum allowed string length for JSON parsing | ||
| * to handle very large SBOM files (up to 500MB of JSON text). | ||
| */ | ||
| @Configuration | ||
| public class JacksonConfig { | ||
|
|
||
| /** | ||
| * Configure Jackson to handle larger JSON strings | ||
| * Increases the max string length from 100MB to 500MB | ||
| */ | ||
| @Bean | ||
| public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() { | ||
| return builder -> { | ||
| builder.postConfigurer(objectMapper -> { | ||
| objectMapper.getFactory().setStreamReadConstraints( | ||
| StreamReadConstraints.builder() | ||
| .maxStringLength(500_000_000) // 500MB limit for JSON strings | ||
| .build() | ||
| ); | ||
| }); | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * Create a primary ObjectMapper bean with increased limits | ||
| * This will be used by default throughout the application | ||
| */ | ||
| @Bean | ||
| @Primary | ||
| public ObjectMapper objectMapper() { | ||
| ObjectMapper mapper = new ObjectMapper(); | ||
| mapper.getFactory().setStreamReadConstraints( | ||
| StreamReadConstraints.builder() | ||
| .maxStringLength(500_000_000) // 500MB limit for JSON strings | ||
| .build() | ||
| ); | ||
| return mapper; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update to the latest versions of these tools