Skip to content

Commit

Permalink
Update to AnalyzerManager v1.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Sep 27, 2024
1 parent eacc0a1 commit e1a6b58
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/scanLogic/scanRunners/analyzerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { LogUtils } from '../../log/logUtils';
export class AnalyzerManager {
private static readonly RELATIVE_DOWNLOAD_URL: string = '/xsc-gen-exe-analyzer-manager-local/v1';
private static readonly BINARY_NAME: string = 'analyzerManager';
public static readonly ANALYZER_MANAGER_VERSION: string = '1.8.14';
public static readonly ANALYZER_MANAGER_VERSION: string = '1.9.2';
public static readonly ANALYZER_MANAGER_PATH: string = Utils.addWinSuffixIfNeeded(
path.join(ScanUtils.getIssuesPath(), AnalyzerManager.BINARY_NAME, AnalyzerManager.BINARY_NAME)
);
Expand Down
1 change: 1 addition & 0 deletions src/main/scanLogic/scanRunners/analyzerModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface AnalyzerDriver {
export interface AnalyzerRule {
id: string;
fullDescription?: ResultContent;
shortDescription?: ResultContent;
properties?: { [key: string]: string };
}

Expand Down
14 changes: 9 additions & 5 deletions src/main/scanLogic/scanRunners/sastScan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,14 @@ export class SastRunner extends JasRunner {

// Prepare
let rulesFullDescription: Map<string, string> = new Map<string, string>();
let rulesShortDescription: Map<string, string> = new Map<string, string>();
for (const rule of analyzerScanRun.tool.driver.rules) {
if (rule.fullDescription) {
rulesFullDescription.set(rule.id, rule.fullDescription.text);
}
if (rule.shortDescription) {
rulesShortDescription.set(rule.id, rule.shortDescription.text);
}
}
// Generate response data
let ignoreCount: number = 0;
Expand All @@ -149,7 +153,7 @@ export class SastRunner extends JasRunner {
ignoreCount++;
return;
}
this.generateIssueData(sastResponse, analyzeIssue, rulesFullDescription.get(analyzeIssue.ruleId));
this.generateIssueData(sastResponse, analyzeIssue, rulesFullDescription.get(analyzeIssue.ruleId), rulesShortDescription.get(analyzeIssue.ruleId));
});
sastResponse.ignoreCount = ignoreCount;
return sastResponse;
Expand All @@ -162,10 +166,10 @@ export class SastRunner extends JasRunner {
* @param analyzeIssue - Issue to handle and generate information base on it
* @param fullDescription - The description of the analyzeIssue
*/
public generateIssueData(sastResponse: SastScanResponse, analyzeIssue: AnalyzeIssue, fullDescription?: string) {
public generateIssueData(sastResponse: SastScanResponse, analyzeIssue: AnalyzeIssue, fullDescription?: string, shortDescription?: string) {
analyzeIssue.locations.forEach(location => {
let fileWithIssues: SastFileIssues = this.getOrCreateSastFileIssues(sastResponse, location.physicalLocation.artifactLocation.uri);
let fileIssue: SastIssue = this.getOrCreateSastIssue(fileWithIssues, analyzeIssue, fullDescription);
let fileIssue: SastIssue = this.getOrCreateSastIssue(fileWithIssues, analyzeIssue, fullDescription, shortDescription);
let issueLocation: SastIssueLocation = this.getOrCreateIssueLocation(fileIssue, location.physicalLocation);
if (analyzeIssue.codeFlows) {
this.generateCodeFlowData(fileWithIssues.full_path, issueLocation, analyzeIssue.codeFlows);
Expand Down Expand Up @@ -227,15 +231,15 @@ export class SastRunner extends JasRunner {
* @param fullDescription - the description of the issue
* @returns - the sast issue
*/
private getOrCreateSastIssue(fileWithIssues: SastFileIssues, analyzeIssue: AnalyzeIssue, fullDescription?: string): SastIssue {
private getOrCreateSastIssue(fileWithIssues: SastFileIssues, analyzeIssue: AnalyzeIssue, fullDescription?: string, shortDescription?: string): SastIssue {
let potential: SastIssue | undefined = fileWithIssues.issues.find(issue => issue.ruleId === analyzeIssue.ruleId);
if (potential) {
return potential;
}
let fileIssue: SastIssue = {
ruleId: analyzeIssue.ruleId,
severity: Translators.levelToSeverity(analyzeIssue.level),
ruleName: analyzeIssue.message.text,
ruleName: shortDescription ?? analyzeIssue.message.text,
fullDescription: fullDescription,
locations: []
} as SastIssue;
Expand Down

0 comments on commit e1a6b58

Please sign in to comment.