Skip to content

Commit

Permalink
Other/fix secret detection label with path and line(AST-69045) (#972)
Browse files Browse the repository at this point in the history
* update-js wrapper version

* update in package.json

* Fix gaps in scs feture
  • Loading branch information
Korjen97 authored Oct 9, 2024
1 parent 3ffe302 commit e1256c8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/models/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ export class AstResult extends CxResult {
this.scaType = result.scaType;
this.label = result.data.queryName
? result.data.queryName
: result.data.ruleName
? result.data.ruleName
: this.formatFilenameLine(result)
? this.formatFilenameLine(result)
: result.id
Expand Down Expand Up @@ -112,12 +110,13 @@ export class AstResult extends CxResult {
}

formatFilenameLine(result: {
data?: { line?: number; filename?: string };
data?: { line?: number; filename?: string; ruleName?: string };
}): string {
const filename = result.data?.filename?.split("/").pop();
const line = result.data?.line;
if (filename && line !== undefined) {
return `(/${filename}:${line})`;
const ruleName = result.data?.ruleName;
if (ruleName && filename && line !== undefined) {
return `${ruleName} (/${filename}:${line})`;
}
}

Expand Down
10 changes: 9 additions & 1 deletion src/utils/interface/details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ export class Details {
</body>`;
}

secretDetectiongeneralTab() {
return `<body>
<span>
${this.result.description ? "<p>" + this.result.description + "</p>" : ""}
</span>
</body>`;
}

scaView(
severityPath,
scaAtackVector,
Expand Down Expand Up @@ -177,7 +185,7 @@ export class Details {

return `
<div>
${remediation ? `<p>${remediation}</p>` : ""}
${remediation ? `<p>${remediation}.</p>` : ""}
</div>
`;
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/resultsView/astDetailsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export class AstDetailsDetached implements vscode.WebviewViewProvider {
)
: this.result.type === constants.scsSecretDetection
? html.tab(
html.generalTab(cxPath),
html.secretDetectiongeneralTab(),
html.secretDetectionDetailsDescriptionTab(),
html.secretDetectionDetailsRemediationTab(),
messages.generalTab,
Expand Down

0 comments on commit e1256c8

Please sign in to comment.