-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: new tool to run cfn-guard to detect inline broad scoped permissions #34115
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This review is outdated)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #34115 +/- ##
=======================================
Coverage 83.98% 83.98%
=======================================
Files 120 120
Lines 6976 6976
Branches 1178 1178
=======================================
Hits 5859 5859
Misses 1005 1005
Partials 112 112
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
733b2ef
to
9467c57
Compare
Exemption Request since github workflow separately tested on personal fork. |
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
required: false | ||
default: "single-line-summary" | ||
|
||
runs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since cfn-guard is required, I believe it worth adding a step to install cfn-guard, so we do not need every time we use this GH action to add a step to install it
@@ -0,0 +1,30 @@ | |||
name: 'cfn-guard-custom-rules-tool' | |||
description: 'CFN Guard for custom or granular guard rules' | |||
author: QuantumNeuralCoder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we remove the author :)
if (!rulePathToUse && ruleSetUrl) { | ||
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'rules-')); | ||
rulePathToUse = path.join(tempDir, 'rules.guard'); | ||
await downloadFile(ruleSetUrl, rulePathToUse); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the rules set file will be always a local file in the repo, why shall we download it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed all in latest commit
# Triggered from a separate job when a review is added | ||
workflow_run: | ||
workflows: [PR Linter Trigger] | ||
types: | ||
- completed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the PR Linter trigger will trigger this workflow along with PR Linter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to link it to PR Linter ?
echo "pr_number=$(cat pr/pr_number)" >> "$GITHUB_OUTPUT" | ||
echo "pr_sha=$(cat pr/pr_sha)" >> "$GITHUB_OUTPUT" | ||
|
||
validate-pr: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this step ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shas are referred in the next step. i have renamed the validate-pr step
download-if-workflow-run: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
pr_number: ${{ steps.pr_output.outputs.pr_number }} | ||
pr_sha: ${{ steps.pr_output.outputs.pr_sha }} | ||
# if conditions on all individual steps because subsequent jobs depend on this job | ||
# and we cannot skip it entirely | ||
steps: | ||
- name: 'Download workflow_run artifact' | ||
if: github.event_name == 'workflow_run' | ||
uses: dawidd6/action-download-artifact@v9 | ||
with: | ||
run_id: ${{ github.event.workflow_run.id }} | ||
name: pr_info | ||
path: pr/ | ||
search_artifacts: true | ||
|
||
- name: 'Determine PR info' | ||
# PR info comes from the artifact if downloaded, or GitHub context if not. | ||
if: github.event_name == 'workflow_run' | ||
id: 'pr_output' | ||
run: | | ||
if [[ ! -f pr/pr_number ]]; then | ||
echo "${{ github.event.pull_request.number }}" > pr/pr_number | ||
fi | ||
if [[ ! -f pr/pr_sha ]]; then | ||
echo "${{ github.event.pull_request.head.sha }}" > pr/pr_sha | ||
fi | ||
cat pr/* | ||
echo "pr_number=$(cat pr/pr_number)" >> "$GITHUB_OUTPUT" | ||
echo "pr_sha=$(cat pr/pr_sha)" >> "$GITHUB_OUTPUT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the value of these steps ?
permissions: | ||
contents: read | ||
pull-requests: write | ||
statuses: read | ||
issues: read | ||
checks: read |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not think we need these permissions, we will not update the PR
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Issue # (if applicable)
None
Closes #.
None
Reason for this change
Description of changes
Refer README.md
Also refer the pr-linter change here. This will be opened once current PR is merged.
Describe any new or updated permissions being added
N/A
Description of how you validated changes
Tested on personal fork. Refer QuantumNeuralCoder#6
PR Linter output shows test results.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license