Skip to content

Commit

Permalink
fix: cwd error
Browse files Browse the repository at this point in the history
  • Loading branch information
YairZ101 committed Jun 15, 2022
1 parent 0850ce4 commit b17ed2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cli/commands/test/iac/local-execution/types.ts
Expand Up @@ -299,6 +299,7 @@ export enum IaCErrorCodes {
// file-loader errors
NoFilesToScanError = 1010,
FailedToLoadFileError = 1011,
CurrentWorkingDirectoryTraversalError = 1012,

// file-parser errors
UnsupportedFileTypeError = 1020,
Expand Down
6 changes: 5 additions & 1 deletion src/cli/commands/test/iac/scan.ts
Expand Up @@ -19,7 +19,7 @@ import { assertIaCOptionsFlags } from './local-execution/assert-iac-options-flag
import { initRules } from './local-execution/rules/rules';
import { cleanLocalCache } from './local-execution/measurable-methods';
import * as ora from 'ora';
import { IacOrgSettings } from './local-execution/types';
import { IaCErrorCodes, IacOrgSettings } from './local-execution/types';
import * as pathLib from 'path';
import { CustomError } from '../../../../lib/errors';
import { OciRegistry } from './local-execution/rules/oci-registry';
Expand All @@ -28,6 +28,7 @@ import {
ResultsProcessor,
SingleGroupResultsProcessor,
} from './local-execution/process-results';
import { getErrorStringCode } from './local-execution/error-utils';

export async function scan(
iacOrgSettings: IacOrgSettings,
Expand Down Expand Up @@ -157,5 +158,8 @@ export async function scan(
class CurrentWorkingDirectoryTraversalError extends CustomError {
constructor() {
super('Path is outside the current working directory');
this.code = IaCErrorCodes.CurrentWorkingDirectoryTraversalError;
this.strCode = getErrorStringCode(this.code);
this.userMessage = `Path is outside the current working directory`;
}
}

0 comments on commit b17ed2c

Please sign in to comment.