Skip to content

Commit

Permalink
Merge pull request #18 from suzuki-shunsuke/fix/support-old-tfsec
Browse files Browse the repository at this point in the history
fix: support old tfsec
  • Loading branch information
suzuki-shunsuke authored Feb 2, 2022
2 parents b6d367f + f1e826f commit cbf912c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9663,6 +9663,12 @@ function getSeverity(s) {
}
return null;
}
function getURL(result) {
if (result.links && result.links.length != 0) {
return result.links[0];
}
return '';
}
const run = (inputs) => __awaiter(void 0, void 0, void 0, function* () {
core.info('Running tfsec');
const out = yield exec.getExecOutput('tfsec', ['--format', 'json', '.'], {
Expand All @@ -9682,7 +9688,7 @@ const run = (inputs) => __awaiter(void 0, void 0, void 0, function* () {
message: result.description,
code: {
value: result.long_id ? result.long_id : result.rule_id,
url: result.links[0],
url: getURL(result),
},
location: {
path: result.location.filename,
Expand Down
9 changes: 8 additions & 1 deletion src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ function getSeverity(s: string): string | null {
return null;
}

function getURL(result: any): string {
if (result.links && result.links.length != 0) {
return result.links[0];
}
return '';
}

export const run = async (inputs: Inputs): Promise<void> => {
core.info('Running tfsec');
const out = await exec.getExecOutput('tfsec', ['--format', 'json', '.'], {
Expand All @@ -39,7 +46,7 @@ export const run = async (inputs: Inputs): Promise<void> => {
message: result.description,
code: {
value: result.long_id ? result.long_id : result.rule_id,
url: result.links[0],
url: getURL(result),
},
location: {
path: result.location.filename,
Expand Down

0 comments on commit cbf912c

Please sign in to comment.