Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
1575ce4
feat: Add SAST-DAST correlation command with ExternalFindings injecti…
Apr 16, 2026
9d0f5f2
refactor(correlate-sast-dast): extract helpers, add progress logging,…
Apr 21, 2026
ab429e7
feat: Add entitlement management to Aviator application
AnkitRathod29 Apr 27, 2026
26a9d7e
feat(correlate-sast-dast): persist correlation state, skip already-tr…
Apr 30, 2026
564fa7b
Merge remote-tracking branch 'neeta_repo/feat/sast-dast-correlation' …
May 4, 2026
699ae52
fix(correlate-sast-dast): add succeeded/skipped output fields, fix Is…
May 5, 2026
5b2d0c7
Add unit tests for correlation helpers and SastFprCorrelationRecorder
May 5, 2026
8999352
Merge remote-tracking branch 'neeta_repo/feat/sast-dast-correlation' …
kireetivar May 5, 2026
3cf1d6c
feat: Add bulkcorrelate SSC action for automated SAST-DAST correlatio…
kireetivar May 6, 2026
7e5c342
Remove test resource files and dependent test classes for correlation
May 6, 2026
36a51b0
Merge remote-tracking branch 'neeta_repo/feat/sast-dast-correlation' …
kireetivar May 7, 2026
0e0ac42
refactor: Address PR review comments - shorten long methods, rename a…
May 11, 2026
00538d7
fix: prefer FPR source file types over configured extension fallback
kireetivar May 11, 2026
bacf477
Merge remote-tracking branch 'neeta_repo/feat/sast-dast-correlation' …
kireetivar May 11, 2026
f1ac0d5
fix(aviator): record issue suppression state changes in audit history
kireetivar May 12, 2026
17f6742
Merge remote-tracking branch 'neeta_repo/feat/sast-dast-correlation' …
kireetivar May 12, 2026
095af1b
fix: Count only OK/SUCCESS correlation responses for succeeded field …
May 12, 2026
1b150db
fix: "aviator ssc audit" preflight issue counting for "--no-filterset…
kireetivar May 15, 2026
1d1ed02
Merge pull request #986 from ankit2995/ankit/multi-entitlement
rsenden May 15, 2026
dd20968
Merge pull request #992 from mneeta/feat/sast-dast-correlation
rsenden May 15, 2026
d5d59ea
Merge remote-tracking branch 'upstream/feat/v3.x/aviator/26.3' into p…
May 15, 2026
68833c4
Merge remote-tracking branch 'upstream/feat/v3.x/aviator/26.3' into p…
May 15, 2026
3013907
Merge remote-tracking branch 'upstream/feat/v3.x/aviator/26.3' into p…
May 15, 2026
2f66589
Merge pull request #996 from kireetivar/p/kireetivar/bulk_correlation
rsenden May 15, 2026
80595f8
Merge pull request #999 from kireetivar/p/kireetivar/fix_extension_fa…
rsenden May 15, 2026
c108e45
Merge pull request #1001 from kireetivar/p/kireetivar/suppress_aduit_…
rsenden May 15, 2026
0f19514
chore: Add description key for applicationId parameter in add-entitle…
May 15, 2026
59d994a
chore(fcli): align Aviator customer-facing text with new product naming
kireetivar May 15, 2026
7040110
chore: remove Aviator branding regression test
kireetivar May 15, 2026
c79932c
Merge pull request #1002 from kireetivar/p/kireetivar/fix_test
rsenden May 15, 2026
fc4ebc1
fix : Add the files modified during apply-remediation in stdout and i…
May 11, 2026
5174fb1
feat: Add modifiedFiles to apply-remediations output and differentiat…
May 13, 2026
5faf0ab
fix: Add pre-upload SSC tag validation to prevent silent audit result…
May 18, 2026
28a23ff
chore: Preserve Aviator correlation order and harden FPR index.xml pa…
May 19, 2026
eb0a7d9
chore(aviator): relax correlate parser requirements
May 19, 2026
84186fb
chore: change log level from warn to debug for semaphore timeout
May 19, 2026
4061cad
Soft warning when last_correlation_attribute is not present in SSC
May 19, 2026
ddf9f2b
revert: Remove PROCESSED_BY_AVIATOR_WITH_REMEDIATION — SSC 26.2 built…
May 20, 2026
125a539
chore: fix --exclude-filter in bulkcorrelate action
kireetivar May 22, 2026
788b864
Merge pull request #1013 from kireetivar/fix/exclude_filter
rsenden May 24, 2026
c908cac
Merge pull request #1006 from mneeta/fix/bug-fixes
rsenden May 24, 2026
474d974
Merge pull request #1003 from kireetivar/p/kireetivar/rename_aviator2
rsenden May 24, 2026
7a51ee3
Merge pull request #1004 from kireetivar/p/kireetivar/nofilter_fix
rsenden May 24, 2026
048edbf
Merge pull request #1005 from kireetivar/fix/correlation_inconsistency
rsenden May 24, 2026
2efba01
feat: Implement admin session validation in Aviator gRPC client
AnkitRathod29 May 25, 2026
9ff41eb
Merge pull request #1017 from ankit2995/ankit/admin-session-validation
rsenden May 26, 2026
a54beb1
chore: Fix native SpEL OffsetDateTime reflection metadata
kireetivar May 27, 2026
a0bfee6
Merge pull request #1018 from kireetivar/fix_fcli_bulk_binary
rsenden May 27, 2026
f19fce1
Merge branch 'dev/v3.x' into feat/v3.x/aviator/26.3
rsenden May 27, 2026
678b011
fix: fcli aviator ssc audit: Reject --skip-if-exceeding-quota with --…
May 29, 2026
dafd376
Merge remote-tracking branch 'upstream/feat/v3.x/aviator/26.3' into p…
May 29, 2026
9900cf0
chore: move aviator SSC invalid option coverage to functional tests
May 30, 2026
4a4fb3e
chore: Align Aviator exception handling with Aviator simple/technical…
May 30, 2026
526e587
Added reflectable for native EXE
Jun 2, 2026
96c5a1a
Used logger.warn instead of logger.progress
Jun 2, 2026
40b6753
Merge pull request #1019 from kireetivar/p/kireetivar/option_bug
rsenden Jun 3, 2026
5700eda
Merge pull request #1020 from kireetivar/p/kireetivar/ex_handle
rsenden Jun 3, 2026
e1a579f
feat: Add capability detection for SSC 26.2+ system-managed Aviator tags
Jun 3, 2026
367dcdc
Merge branch 'feat/v3.x/aviator/26.3' into prepare-command-upgraded-ssc
mneeta Jun 3, 2026
bec5013
Merge branch 'dev/v3.x' into feat/v3.x/aviator/26.3
Jun 4, 2026
e3712cc
Refactored long methods
Jun 5, 2026
02d0f53
Merge pull request #1025 from mneeta/prepare-command-upgraded-ssc
rsenden Jun 5, 2026
a950ade
Resolved build failure issue
Jun 6, 2026
5608ce8
Merge pull request #1031 from mneeta/prepare-command-upgraded-ssc
rsenden Jun 7, 2026
c535ae0
fix: FoD apply-remediation output shows only relevant fields
Jun 15, 2026
a9aa8a2
Merge pull request #1036 from mneeta/fix/fod-apply-remediation-output
rsenden Jun 15, 2026
13adc46
chore: align prompt line-numbering behavior and init comment mapping
kireetivar Jul 3, 2026
7f36617
chore; remove redudant AviatorConfigManager test
kireetivar Jul 3, 2026
5029edc
chore: add resource configuration for Aviator includes
kireetivar Jul 3, 2026
1698011
chore: add reflection configuration for LanguagesCommentConfig
kireetivar Jul 3, 2026
c097f9e
Merge pull request #1049 from kireetivar/kireetivar/chore_line_num
rsenden Jul 3, 2026
32a651a
chore: add reflection configuration for DAST entitlement classes
Jul 9, 2026
4733576
Merge pull request #1052 from kireetivar/p/kireetivar/fix_list_dast
rsenden Jul 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"resources": {
"includes": [
{
"pattern": "extensions_config.yaml"
},
{
"pattern": "languages_comment_config.yaml"
},
{
"pattern": "default_tag_mapping.yaml"
},
{
"pattern": "remediations.xsd"
},
{
"pattern": "webinspect.xsd"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,96 @@
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "com.fortify.aviator.dastentitlement.ListDastEntitlementsByTenantRequest",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "com.fortify.aviator.dastentitlement.ListDastEntitlementsByTenantRequest$Builder",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "com.fortify.aviator.dastentitlement.ListDastEntitlementsByTenantResponse",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "com.fortify.aviator.dastentitlement.ListDastEntitlementsByTenantResponse$Builder",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "com.fortify.aviator.dastentitlement.DastEntitlement",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "com.fortify.aviator.dastentitlement.DastEntitlement$Builder",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "com.fortify.aviator.dastentitlement.DastTenantInfo",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "com.fortify.aviator.dastentitlement.DastTenantInfo$Builder",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "com.fortify.aviator.dastentitlement.DastCreditSummary",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "com.fortify.aviator.dastentitlement.DastCreditSummary$Builder",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true
},
{
"name": "com.fortify.aviator.grpc.AuditorResponse",
"allDeclaredConstructors": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
},{
"name" : "java.lang.Class",
"allPublicMethods" : true
},{
"name" : "java.time.OffsetDateTime",
"allPublicMethods" : true
},{
"name" : "java.util.ArrayList",
"allPublicMethods" : true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@
"allDeclaredMethods": true, "allPublicMethods": true,
"allDeclaredFields": true, "allPublicFields": true
},
{
"name":"com.fortify.cli.aviator.config.LanguagesCommentConfig",
"allDeclaredConstructors": true,
"allPublicConstructors": true,
"allDeclaredMethods": true,
"allPublicMethods": true,
"allDeclaredFields": true,
"allPublicFields": true,
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"setLineCommentSymbols","parameterTypes":["java.util.Map"] }]
},
{
"name":"com.fortify.cli.aviator.config.TagMappingConfig",
"allDeclaredFields":true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,22 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

class NativeYamlReflectConfigTest {
class NativeReflectConfigTest {
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private static final String SPEL_REFLECT_CONFIG = "META-INF/native-image/fcli/fcli-app/spel/reflect-config.json";
private static final String YAML_REFLECT_CONFIG = "META-INF/native-image/fcli/fcli-app/yaml/reflect-config.json";
private static final String GRPC_REFLECT_CONFIG = "META-INF/native-image/fcli/fcli-app/grpc/reflect-config.json";
private static final String OFFSET_DATE_TIME_CLASS = "java.time.OffsetDateTime";
private static final String TAG_MAPPING_CONFIG_CLASS = "com.fortify.cli.aviator.config.TagMappingConfig";
private static final List<String> TAG_MAPPING_NESTED_CLASSES = List.of(
"com.fortify.cli.aviator.config.TagMappingConfig$SuppressionExclusion",
Expand All @@ -36,21 +42,34 @@ class NativeYamlReflectConfigTest {
"com.fortify.cli.aviator.config.TagMappingConfig$Result");

@ParameterizedTest
@ValueSource(strings = {
"META-INF/native-image/fcli/fcli-app/yaml/reflect-config.json",
"META-INF/native-image/fcli/fcli-app/grpc/reflect-config.json"
})
void testTagMappingConfigNativeReflectConfigIncludesSuppressionExclusions(String resourcePath) throws Exception {
@MethodSource("getReflectConfigContracts")
void testNativeReflectConfigContracts(String resourcePath, String className,
boolean expectAllDeclaredFields, boolean expectAllPublicMethods,
List<String> expectedMethods, List<String> expectedEntries) throws Exception {
JsonNode reflectConfig = loadReflectConfig(resourcePath);
JsonNode tagMappingConfigEntry = getReflectConfigEntry(reflectConfig, TAG_MAPPING_CONFIG_CLASS);
JsonNode reflectConfigEntry = getReflectConfigEntry(reflectConfig, className);

assertTrue(tagMappingConfigEntry.path("allDeclaredFields").asBoolean(),
() -> "Expected allDeclaredFields for " + TAG_MAPPING_CONFIG_CLASS + " in " + resourcePath);
assertTrue(hasMethod(tagMappingConfigEntry, "setSuppression_exclusions"),
() -> "Expected setSuppression_exclusions metadata for " + TAG_MAPPING_CONFIG_CLASS + " in " + resourcePath);
if ( expectAllDeclaredFields ) {
assertTrue(reflectConfigEntry.path("allDeclaredFields").asBoolean(),
() -> "Expected allDeclaredFields for " + className + " in " + resourcePath);
}
if ( expectAllPublicMethods ) {
assertTrue(reflectConfigEntry.path("allPublicMethods").asBoolean(),
() -> "Expected allPublicMethods for " + className + " in " + resourcePath);
}
expectedMethods.forEach(methodName -> assertTrue(hasMethod(reflectConfigEntry, methodName),
() -> "Expected " + methodName + " metadata for " + className + " in " + resourcePath));
expectedEntries.forEach(expectedEntry -> assertTrue(hasReflectConfigEntry(reflectConfig, expectedEntry),
() -> "Expected reflect-config entry for " + expectedEntry + " in " + resourcePath));
}

TAG_MAPPING_NESTED_CLASSES.forEach(className -> assertTrue(hasReflectConfigEntry(reflectConfig, className),
() -> "Expected reflect-config entry for " + className + " in " + resourcePath));
private static Stream<Arguments> getReflectConfigContracts() {
return Stream.of(
Arguments.of(SPEL_REFLECT_CONFIG, OFFSET_DATE_TIME_CLASS, false, true, List.of(), List.of()),
Arguments.of(YAML_REFLECT_CONFIG, TAG_MAPPING_CONFIG_CLASS, true, false,
List.of("setSuppression_exclusions"), TAG_MAPPING_NESTED_CLASSES),
Arguments.of(GRPC_REFLECT_CONFIG, TAG_MAPPING_CONFIG_CLASS, true, false,
List.of("setSuppression_exclusions"), TAG_MAPPING_NESTED_CLASSES));
}

private JsonNode loadReflectConfig(String resourcePath) throws IOException {
Expand All @@ -76,4 +95,4 @@ private boolean hasMethod(JsonNode reflectConfigEntry, String methodName) {
return StreamSupport.stream(reflectConfigEntry.path("methods").spliterator(), false)
.anyMatch(node -> methodName.equals(node.path("name").asText()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,29 @@

import com.fortify.cli.aviator._common.exception.AviatorBugException;
import com.fortify.cli.aviator.config.ExtensionsConfig;
import com.fortify.cli.aviator.config.LanguagesCommentConfig;
import com.fortify.cli.aviator.config.TagMappingConfig;
import com.fortify.cli.aviator.util.FileTypeLanguageMapperUtil;
import com.fortify.cli.aviator.util.LanguageCommentMapperUtil;
import com.fortify.cli.aviator.util.ResourceUtil;

public class AviatorConfigManager {
private static final Logger LOG = LoggerFactory.getLogger(AviatorConfigManager.class);
private static final String EXTENSIONS_CONFIG_RESOURCE = "extensions_config.yaml";
private static final String LANGUAGES_COMMENT_CONFIG_RESOURCE = "languages_comment_config.yaml";
private static final String DEFAULT_TAG_MAPPING_RESOURCE = "default_tag_mapping.yaml";

private static volatile AviatorConfigManager instance;
private static final Object lock = new Object();

private final ExtensionsConfig extensionsConfig;
private final LanguagesCommentConfig languagesCommentConfig;
private final TagMappingConfig defaultTagMappingConfig;

private AviatorConfigManager() {
LOG.debug("Initializing AviatorConfigManager...");
this.extensionsConfig = ResourceUtil.loadYamlResource(EXTENSIONS_CONFIG_RESOURCE, ExtensionsConfig.class);
this.languagesCommentConfig = ResourceUtil.loadYamlResource(LANGUAGES_COMMENT_CONFIG_RESOURCE, LanguagesCommentConfig.class);
this.defaultTagMappingConfig = ResourceUtil.loadYamlResource(DEFAULT_TAG_MAPPING_RESOURCE, TagMappingConfig.class);

if (this.extensionsConfig != null) {
Expand All @@ -43,6 +48,12 @@ private AviatorConfigManager() {
} else {
LOG.error("ExtensionsConfig is null, FileTypeLanguageMapperUtil cannot be initialized properly.");
}
if (this.languagesCommentConfig != null) {
LanguageCommentMapperUtil.initializeConfig(this.languagesCommentConfig);
LOG.debug("LanguageCommentMapperUtil initialized.");
} else {
LOG.error("LanguagesCommentConfig is null, LanguageCommentMapperUtil cannot be initialized properly.");
}
LOG.debug("AviatorConfigManager initialized successfully.");
}

Expand All @@ -65,6 +76,14 @@ public ExtensionsConfig getExtensionsConfig() {
return extensionsConfig;
}

public LanguagesCommentConfig getLanguagesCommentConfig() {
if (languagesCommentConfig == null) {
LOG.error("LanguagesCommentConfig was not loaded. This indicates a bug.");
throw new AviatorBugException("Critical: LanguagesCommentConfig not loaded.");
}
return languagesCommentConfig;
}

public TagMappingConfig getDefaultTagMappingConfig() {
if (defaultTagMappingConfig == null) {
LOG.error("DefaultTagMappingConfig was not loaded. This indicates a bug.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ private static AuditOutcome performAviatorAudit(
ParsedFprData parsedData, IAviatorLogger logger,
String token, String appVersion, String url, String sscAppName, String sscAppVersion,
Map<String, AuditResponse> auditResponsesToFill, FilterSelection filterSelection, FprHandle fprHandle, List<String> folderPriorityOrder) {
SourceLanguageResolver sourceLanguageResolver =
new SourceLanguageResolver(parsedData.streamingFVDLProcessor.getFvdlMetadata());
parsedData.streamingFVDLProcessor.getFvdlMetadata().clearSourceFileTypeIndexes();

IssueAuditor issueAuditor = new IssueAuditor(
parsedData.vulnerabilities,
Expand All @@ -137,7 +140,8 @@ private static AuditOutcome performAviatorAudit(
sscAppVersion,
filterSelection,
logger,
folderPriorityOrder
folderPriorityOrder,
sourceLanguageResolver
);
return issueAuditor.performAudit(
auditResponsesToFill, token, appVersion, parsedData.fprInfo.getBuildId(), url, fprHandle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,15 @@ public class IssueAuditor {
private final TagDefinition analysisTag;
private TagDefinition humanAuditTag;
private TagDefinition aviatorStatusTag;
private final SourceLanguageResolver sourceLanguageResolver;

private final IAviatorLogger logger;
private final List<String> customPriorityOrder;

public IssueAuditor(List<Vulnerability> vulnerabilities, AuditProcessor auditProcessor, Map<String, AuditIssue> auditIssueMap, FPRInfo fprInfo, String SSCApplicationName, String SSCApplicationVersion, FilterSelection filterSelection , IAviatorLogger logger, List<String> customPriorityOrder) {
public IssueAuditor(List<Vulnerability> vulnerabilities, AuditProcessor auditProcessor, Map<String, AuditIssue> auditIssueMap,
FPRInfo fprInfo, String SSCApplicationName, String SSCApplicationVersion,
FilterSelection filterSelection, IAviatorLogger logger, List<String> customPriorityOrder,
SourceLanguageResolver sourceLanguageResolver) {
this.logger = logger;
this.customPriorityOrder = customPriorityOrder;
this.MAX_PER_CATEGORY = Constants.MAX_PER_CATEGORY;
Expand All @@ -98,6 +102,7 @@ public IssueAuditor(List<Vulnerability> vulnerabilities, AuditProcessor auditPro
this.filterSelection = filterSelection;
this.SSCApplicationName = SSCApplicationName;
this.SSCApplicationVersion = SSCApplicationVersion;
this.sourceLanguageResolver = sourceLanguageResolver;
this.analysisTag = fprInfo.getFilterTemplate().getTagDefinitions().stream().filter(t -> "Analysis".equalsIgnoreCase(t.getName())).findFirst().orElse(null);
this.resultsTag = resolveResultTag("", "", analysisTag);
}
Expand Down Expand Up @@ -207,7 +212,7 @@ private ConcurrentLinkedDeque<UserPrompt> prepareAndFilterPrompts() {

// Convert the filtered vulnerabilities to UserPrompts
List<UserPrompt> prompts = filteredVulnerabilities.stream()
.map(IssueObjBuilder::buildIssueObj)
.map(vulnerability -> IssueObjBuilder.buildIssueObj(vulnerability, sourceLanguageResolver))
.collect(Collectors.toList());

// Apply secondary checks (like 'isAudited')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,17 @@
*/
package com.fortify.cli.aviator.audit;

import java.util.HashSet;
import java.util.Set;

import com.fortify.cli.aviator.audit.model.AnalysisInfo;
import com.fortify.cli.aviator.audit.model.File;
import com.fortify.cli.aviator.audit.model.IssueData;
import com.fortify.cli.aviator.audit.model.UserPrompt;
import com.fortify.cli.aviator.fpr.Vulnerability;
import com.fortify.cli.aviator.util.FileTypeLanguageMapperUtil;
import com.fortify.cli.aviator.util.FileUtil;
import com.fortify.cli.aviator.util.StringUtil;

public class IssueObjBuilder {

public static UserPrompt buildIssueObj(Vulnerability vulnerability) {
public static UserPrompt buildIssueObj(Vulnerability vulnerability, SourceLanguageResolver languageResolver) {

IssueData issueData = IssueData.builder()
.accuracy(String.valueOf(vulnerability.getAccuracy()))
Expand All @@ -51,19 +47,9 @@ public static UserPrompt buildIssueObj(Vulnerability vulnerability) {
.explanation(vulnerability.getExplanation())
.build();

Set<String> programmingLanguages = new HashSet<>();
if (vulnerability.getFiles() != null) {
for (File file : vulnerability.getFiles()) {
String fileExtension = FileUtil.getFileExtension(file.getName());
String language = FileTypeLanguageMapperUtil.getProgrammingLanguage(fileExtension);
if (language != null) {
programmingLanguages.add(language);
}
}
}

String language = programmingLanguages.isEmpty() ? null : programmingLanguages.iterator().next();
String fileExtension = FileUtil.getFileExtension(vulnerability.getLastStackTraceElement().getFilename());
Set<String> programmingLanguages = languageResolver.resolveProgrammingLanguages(vulnerability);
String language = languageResolver.resolvePrimaryLanguage(vulnerability);
String fileExtension = languageResolver.resolvePrimaryFileExtension(vulnerability);

return UserPrompt.builder()
.issueData(issueData)
Expand Down
Loading
Loading