You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: refactored security guardian tool and security-guardian action. Enables local run. (#34158)
### Issue # (if applicable)
None
Closes #<issue number here>.
NA
### Reason for this change
With this change, developers can locally run security guardian against committed files to detect changed .template.json and run the 2 part scanner
1. cfn-guard to detect inline
2. custom scanner to detect intrinsics
Please note that this will detect templates where the developer has explicitly provided broadened scope permissions like
new AccountPrincipal();
We will use this as an opportunity to review if that is really needed or can be scoped down.
```bash
> cd tools/@aws-cdk/security-guardian
>yarn security-guardian
```
### Description of changes
### Describe any new or updated permissions being added
### Description of how you validated changes
### Checklist
- [ x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- detect broadly scoped inline policies in `*.template.json` files in incoming PRs and validate changed AWS CloudFormation templates against custom [cfn-guard](https://github.com/aws-cloudformation/cloudformation-guard) rules. Supports local paths for custom rule sets.
@@ -44,28 +44,52 @@ A GitHub Action tool designed to
44
44
45
45
## Local Development
46
46
47
-
### 1. Build
47
+
### 1. Install Dependencies
48
48
```bash
49
-
npm install
50
-
npm run build
49
+
cd tools/@aws-cdk/security-guardian && yarn install
51
50
```
52
51
53
52
### 2. Run Locally
53
+
The tool automatically detects changed templates and validates them.
54
+
54
55
```bash
55
-
node dist/index.js \
56
-
--data_directory=./changed_templates \
57
-
--rule_file_path=./rules.guard \
58
-
--output_format=single-line-summary \
59
-
--show_summary=fail
56
+
yarn security-guardian
60
57
```
61
58
59
+
> You can override defaults using:
60
+
> -`--base_sha=origin/main`
61
+
> -`--output_format=json`
62
+
> -`--show_summary=warn`
63
+
62
64
---
63
65
64
-
## Acknowledgments
66
+
## Output
67
+
68
+
In addition to validation results from `cfn-guard`, the tool logs detailed findings from the intrinsic scan (if applicable), such as:
65
69
66
-
Built on top of [cfn-guard](https://github.com/aws-cloudformation/cloudformation-guard) and [GitHub Actions Toolkit](https://github.com/actions/toolkit).
Built with care on top of [cfn-guard](https://github.com/aws-cloudformation/cloudformation-guard) and the [GitHub Actions Toolkit](https://github.com/actions/toolkit).
0 commit comments