Skip to content

Commit

Permalink
fix: disabledRules not respected (#125)
Browse files Browse the repository at this point in the history
In the guard 3.0 refactor the logic for disabling rules was dropped.
This adds it back in.

closes #123
  • Loading branch information
corymhall authored Aug 1, 2023
1 parent 754e013 commit aae2e9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class CfnGuardValidator implements IPolicyValidationPluginBeta1 {
private execGuard(config: GuardExecutionConfig): Pick<PolicyValidationPluginReportBeta1, 'success' | 'violations'> {
const flags = [
'validate',
...config.rulePaths.flatMap(rule => ['--rules', rule]),
...this.getRules(config.rulePaths).flatMap(rule => ['--rules', rule]),
...config.templatePaths.flatMap(template => ['--data', template]),
'--output-format', 'json',
'--show-summary', 'none',
Expand Down
6 changes: 5 additions & 1 deletion test/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,14 @@ describe('CfnGuardPlugin', () => {
expect(execMock).toHaveBeenCalledTimes(1);
expect(execMock).toHaveBeenCalledWith(expect.arrayContaining([
'--rules',
path.join(__dirname, '../rules/control-tower/cfn-guard'),
path.join(__dirname, '../rules/control-tower/cfn-guard/efs'),
'--data',
'template.json',
]), { json: true });
expect(execMock).toHaveBeenCalledWith(expect.arrayContaining([
'--rules',
expect.not.stringContaining('s3'),
]), { json: true });
});

test('additional rules can be provided', () => {
Expand Down

0 comments on commit aae2e9d

Please sign in to comment.