Skip to content

Commit d25cab5

Browse files
authored
feat(ci): Add Fortress Code Reviewer security scan workflow (#5639)
Add GitHub Actions workflow to run Fortress Code Reviewer security scan on every PR against the master branch. The workflow: - Triggers on pull_request_target against master - Performs collaborator check (auto-approve for collaborators, manual approval for external contributors) - Configures AWS credentials via OIDC - Triggers the sagemaker-python-sdk-ci-fortress-scan CodeBuild project The CodeBuild project installs Fortress at runtime from S3-hosted wheels and uses Bedrock (Claude) to analyze code for security vulnerabilities. --- X-AI-Prompt: Add Fortress security scan GitHub workflow for PR scanning X-AI-Tool: Kiro
1 parent 6a174f4 commit d25cab5

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Fortress Security Scan
2+
on:
3+
pull_request_target:
4+
branches:
5+
- "master"
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
id-token: write
13+
14+
jobs:
15+
collab-check:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
approval-env: ${{ steps.collab-check.outputs.result }}
19+
steps:
20+
- name: Collaborator Check
21+
uses: actions/github-script@v7
22+
id: collab-check
23+
with:
24+
github-token: ${{ secrets.COLLAB_CHECK_TOKEN }}
25+
result-encoding: string
26+
script: |
27+
try {
28+
const res = await github.rest.repos.checkCollaborator({
29+
owner: context.repo.owner,
30+
repo: context.repo.repo,
31+
username: "${{ github.event.pull_request.user.login }}",
32+
});
33+
console.log("Verified ${{ github.event.pull_request.user.login }} is a repo collaborator. Auto Approving.")
34+
return res.status == "204" ? "auto-approve" : "manual-approval"
35+
} catch (error) {
36+
console.log("${{ github.event.pull_request.user.login }} is not a collaborator. Requiring Manual Approval.")
37+
return "manual-approval"
38+
}
39+
40+
wait-for-approval:
41+
runs-on: ubuntu-latest
42+
needs: [collab-check]
43+
environment: ${{ needs.collab-check.outputs.approval-env }}
44+
steps:
45+
- run: echo "Workflow Approved! Starting Fortress Security Scan."
46+
47+
fortress-scan:
48+
runs-on: ubuntu-latest
49+
needs: [wait-for-approval]
50+
steps:
51+
- name: Configure AWS Credentials
52+
uses: aws-actions/configure-aws-credentials@v4
53+
with:
54+
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
55+
aws-region: us-west-2
56+
role-duration-seconds: 10800
57+
58+
- name: Run Fortress Security Scan
59+
uses: aws-actions/aws-codebuild-run-build@v1
60+
with:
61+
project-name: ${{ github.event.repository.name }}-ci-fortress-scan
62+
source-version-override: 'refs/pull/${{ github.event.pull_request.number }}/head^{${{ github.event.pull_request.head.sha }}}'

0 commit comments

Comments
 (0)