Skip to content
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

GitHub Action | Fix SAST & IAC Vul + Threshold (AST-47971) #192

Merged
merged 115 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
3b82e6e
trigger pipe
Aug 14, 2024
dd628d7
fix iac
Aug 14, 2024
679945d
add threshold
Aug 14, 2024
af57853
rm threshold
Aug 14, 2024
7b2ee25
add sha
elchananarb Aug 15, 2024
850a023
change to nonroot in docker file
elchananarb Aug 15, 2024
695d717
revert to root
elchananarb Aug 15, 2024
52c800c
rm user root
elchananarb Aug 22, 2024
6c55e67
Update Dockerfile
elchananarb Aug 22, 2024
214fc9b
Update Dockerfile
elchananarb Aug 26, 2024
ae0a33e
Update Dockerfile
elchananarb Aug 27, 2024
fe135e8
Update Dockerfile
elchananarb Aug 27, 2024
d064365
Update Dockerfile
elchananarb Aug 27, 2024
6256be1
Update Dockerfile
elchananarb Aug 27, 2024
860726e
Update Dockerfile
elchananarb Aug 27, 2024
7363c26
Update Dockerfile
elchananarb Aug 27, 2024
b5dace1
add app-get..
elchananarb Aug 27, 2024
fe4613a
try use apk
elchananarb Aug 27, 2024
9205004
Update Dockerfile
elchananarb Aug 27, 2024
47ce0ec
revert
elchananarb Aug 27, 2024
23e261f
add user nonroot before chmode
elchananarb Aug 27, 2024
084db3f
add USER nonroot in end
elchananarb Aug 27, 2024
8800306
add permissions for nonroot
elchananarb Aug 27, 2024
c4977ca
permissions for all directories
elchananarb Aug 27, 2024
3cfc9ed
rm github /workspace /home/runner
elchananarb Aug 27, 2024
afe9f03
Update Dockerfile
elchananarb Aug 27, 2024
a6fc3d4
add root before
elchananarb Aug 27, 2024
0d0b8da
Update Dockerfile
elchananarb Aug 27, 2024
dc60e42
add root
elchananarb Aug 27, 2024
adb80b7
up entrypoint.sh & cleanup.sh
elchananarb Sep 8, 2024
087f8e0
add root also before
elchananarb Sep 8, 2024
343e620
up the open cx_result.json path
elchananarb Sep 8, 2024
9ee7b3d
rm github/file_commands from docker file
elchananarb Sep 8, 2024
b818f15
Adjust permissions for GitHub file commands at runtime
elchananarb Sep 8, 2024
0f871b4
rm sudo
elchananarb Sep 8, 2024
efaf220
Update Dockerfile
elchananarb Sep 8, 2024
f45da4f
Update Dockerfile
elchananarb Sep 8, 2024
783136c
change to nonroot
elchananarb Sep 8, 2024
4a723fd
Update Dockerfile
elchananarb Sep 8, 2024
ea909f1
Update Dockerfile
elchananarb Sep 10, 2024
31d9f33
change 2.2.5
elchananarb Sep 10, 2024
44b4e07
change to 555
elchananarb Sep 10, 2024
75b4424
Update Dockerfile
elchananarb Sep 10, 2024
e05c1f2
Update Dockerfile
elchananarb Sep 10, 2024
75e6eb7
fix
elchananarb Sep 10, 2024
9f84101
fix attempt to permission denied for output.log
amacedoo Sep 16, 2024
819d6a2
fix attempt 2
amacedoo Sep 16, 2024
ec5566b
fix attempt 3
amacedoo Sep 16, 2024
e559880
fix attempt 3
amacedoo Sep 16, 2024
fc80075
fix 4
amacedoo Sep 16, 2024
77b5ca3
my fault
amacedoo Sep 16, 2024
3cc24f1
fix attempt 5
amacedoo Sep 16, 2024
bd10c29
update cleanup.sh
amacedoo Sep 16, 2024
6ba81c6
user needs to write the results
amacedoo Sep 16, 2024
715af5f
fix attempt n+1
amacedoo Sep 16, 2024
6c4be33
fix
amacedoo Sep 16, 2024
9a16d2b
Merge branch 'main' into elchanan/fix_sast_and_iac_vul
elchananarb Sep 24, 2024
6287118
revert change
elchananarb Sep 24, 2024
c76f359
revert 2
elchananarb Sep 24, 2024
095ae5b
After fips change in cli
elchananarb Sep 24, 2024
b26a0d6
up threshold and change user to 65532
elchananarb Sep 25, 2024
2a3bfd0
Update CLI to 2.2.7
Sep 25, 2024
55d8b9a
check root
Sep 25, 2024
5fd19ee
to 65532
Sep 25, 2024
5702b57
USE 65532 AFTER
Sep 25, 2024
21e9a07
Update Dockerfile
Sep 25, 2024
8bb8634
add /app
Sep 25, 2024
f2f567f
add touch /app/output.log
Sep 25, 2024
199ce09
v3
Sep 25, 2024
ad6a757
v4
Sep 25, 2024
54d6fec
Update Dockerfile
Sep 25, 2024
0f2a3ea
add ls -la
Sep 25, 2024
6fe308a
Update entrypoint.sh
Sep 25, 2024
67021f3
tag 2.2.7-snapshot-v3
Sep 25, 2024
6f1b1c9
Update Dockerfile
Sep 25, 2024
4d2d60c
Fix permissions
amacedoo Sep 26, 2024
f7938f0
Update dockerfile
amacedoo Sep 26, 2024
c3bc063
Update dockerfile
amacedoo Sep 26, 2024
84cd784
My bad
amacedoo Sep 26, 2024
a7300fe
Add output.log
amacedoo Sep 26, 2024
eccac99
Update Dockerfile
amacedoo Sep 26, 2024
9203f95
Add user root
amacedoo Sep 26, 2024
d865f33
Fix
amacedoo Sep 26, 2024
0419eb6
Fix
amacedoo Sep 26, 2024
0bdf8f4
Fix entrypoint
amacedoo Sep 26, 2024
9472c99
fix permissions
amacedoo Sep 26, 2024
00d7527
fix file name
amacedoo Sep 26, 2024
655b90c
fix
amacedoo Sep 26, 2024
9a7df75
try again with the right binary arch
amacedoo Sep 26, 2024
b07103d
try again
amacedoo Sep 26, 2024
e3561cd
add right permissions to file_commands
amacedoo Sep 26, 2024
b6f0e0a
fix
amacedoo Sep 26, 2024
45cbef2
try to fix
amacedoo Sep 26, 2024
dc4564c
fix
amacedoo Sep 26, 2024
563367e
my bad
amacedoo Sep 26, 2024
68479da
debug
amacedoo Sep 26, 2024
77bc78e
debug
amacedoo Sep 26, 2024
8fc32ac
debug
amacedoo Sep 26, 2024
2593056
fix entrypoint
amacedoo Sep 26, 2024
9fcfd40
test
amacedoo Sep 26, 2024
b6cd417
test 2
amacedoo Sep 26, 2024
770cbd2
test n-1
amacedoo Sep 26, 2024
2536ab7
debug
amacedoo Sep 26, 2024
367d179
777
amacedoo Sep 26, 2024
ed8381f
debug
amacedoo Sep 26, 2024
b0b40ca
777 x2
amacedoo Sep 26, 2024
c2c30ca
debug
amacedoo Sep 26, 2024
d6bdd7c
final commit
amacedoo Sep 26, 2024
eddfb00
add execute permissions
amacedoo Sep 26, 2024
8213ba6
add exec perm
amacedoo Sep 26, 2024
6f8133c
restore everthing
amacedoo Sep 26, 2024
c01aac7
add sha
amacedoo Sep 26, 2024
abf2487
create output file
amacedoo Sep 26, 2024
3937734
fix
amacedoo Sep 26, 2024
576c98f
update cxone scan
amacedoo Sep 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .github/workflows/checkmarx-one-scan.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
name: Checkmarx One Scan

on: [ pull_request, workflow_dispatch ]
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
schedule:
- cron: '00 7 * * *' # Every day at 07:00

jobs:
cx-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Checkmarx One CLI Action
uses: checkmarx/ast-github-action@main
uses: checkmarx/ast-github-action@9fda5a4a2c297608117a5a56af424502a9192e57 # v.2.0.34
with:
base_uri: ${{ secrets.AST_RND_SCANS_BASE_URI }}
cx_tenant: ${{ secrets.AST_RND_SCANS_TENANT }}
cx_client_id: ${{ secrets.AST_RND_SCANS_CLIENT_ID }}
cx_client_secret: ${{ secrets.AST_RND_SCANS_CLIENT_SECRET }}
additional_params: --tags phoenix --threshold "sast-high=1;sca-high=1;sca-medium=3;sca-low=1" --debug
additional_params: --tags phoenix --threshold "sast-critical=1;sast-high=1;sast-medium=1;sast-low=1;sca-critical=1;sca-high=1;sca-medium=1;sca-low=1;iac-security-critical=1;iac-security-high=1;iac-security-medium=1;iac-security-low=1;"
4 changes: 2 additions & 2 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.6.0
uses: dependabot/fetch-metadata@c9c4182bf1b97f5224aee3906fd373f6b61b4526 #v1.6.0
with:
github-token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
Expand All @@ -20,6 +20,6 @@ jobs:
GITHUB_TOKEN: ${{secrets.PERSONAL_ACCESS_TOKEN}}
run: gh pr merge --auto --merge "$PR_URL"
- name: Auto approve dependabot PRs
uses: hmarr/auto-approve-action@v3
uses: hmarr/auto-approve-action@a2e6f2a0ccf5c63ef8754de360464edbf47e66ee #v3
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
steps:
- name: Create Release
id: draf_release
uses: release-drafter/release-drafter@v5
uses: release-drafter/release-drafter@09c613e259eb8d4e7c81c2cb00618eb5fc4575a7 #v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v4.1.0
- name: Create Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 #v1
with:
tag_name: ${{ github.ref_name }}
generate_release_notes: true
Expand All @@ -31,7 +31,7 @@ jobs:
echo "::set-output name=body_release::$body_release"
- name: Converts Markdown to HTML
id: convert
uses: lifepal/markdown-to-html@v1.2
uses: lifepal/markdown-to-html@253bbd85fbdeafe2d1f18c1b9289be24e5cf8f8f #v1.2
with:
text: "${{ steps.release.outputs.body_release }}"

Expand All @@ -43,7 +43,7 @@ jobs:
echo "::set-output name=clean::$clean"
- name: Send a Notification
id: notify
uses: thechetantalwar/teams-notify@v2
uses: thechetantalwar/teams-notify@8a78811f5e8f58cdd204efebd79158006428c46b #v2
with:
teams_webhook_url: ${{ secrets.TEAMS_WEBHOOK_URI }}
message: "<h1>Checkmarx One Github Action ${{ github.ref_name }}</h1>${{ steps.clean.outputs.clean }}"
16 changes: 7 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#Use AST Base image
FROM checkmarx/ast-cli:2.2.5
# Use AST Base image
FROM checkmarx/ast-cli:2.2.8@sha256:6bdb2d0b18246ca1a269de2860938313ea14ca2d6e443c953c84fbac9ee5df85

USER root
# Copy the entrypoint script and properties used for the action
COPY --chmod=500 entrypoint.sh /app/entrypoint.sh
COPY --chmod=500 cleanup.sh /app/cleanup.sh

#Copy the entrypoint script and properties used for the action
COPY entrypoint.sh /app/entrypoint.sh
COPY cleanup.sh /app/cleanup.sh

RUN chmod +x /app/entrypoint.sh \
&& chmod +x /app/cleanup.sh
# Docker actions must be run by the default Docker user (root).
USER root
6 changes: 3 additions & 3 deletions cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
cancelId=(`grep -E '"(ID)":"((\\"|[^"])*)"' ./output.log | cut -d',' -f1 | cut -d':' -f2 | tr -d '"'`)

if [ -z "$cancelId" ]
then
then
echo "Scan not created. Terminating job."
else

else
echo "Canceling scan with ID:" $cancelId
/app/bin/cx scan cancel --scan-id "${cancelId}"
fi
Expand Down
7 changes: 3 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fi


if [ -n "$scanId" ]; then
/app/bin/cx results show --scan-id "${scanId}" --report-format markdown
/app/bin/cx results show --scan-id "${scanId}" --report-format markdown
cat ./cx_result.md >$GITHUB_STEP_SUMMARY
rm ./cx_result.md
echo "cxScanID=$scanId" >> $GITHUB_OUTPUT
Expand All @@ -29,7 +29,6 @@ if [ $exitCode -eq 0 ]
then
echo "Scan completed"
else
echo "Scan failed"
echo "Scan failed"
exit $exitCode
fi

fi
2 changes: 1 addition & 1 deletion sample-yml/checkmarx-ast-scan-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Checkmarx AST CLI Action
uses: checkmarx/ast-github-action@main #Github Action version
uses: checkmarx/ast-github-action@1fe318de2993222574e6249750ba9000a4e2a6cd #main
with:
base_uri: https://ast.checkmarx.net/
cx_tenant: your_tenant
Expand Down
2 changes: 1 addition & 1 deletion sample-yml/checkmarx-ast-scan-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Checkmarx AST CLI Action
uses: checkmarx/ast-github-action@main #Github Action version
uses: checkmarx/ast-github-action@1fe318de2993222574e6249750ba9000a4e2a6cd #main
with:
base_uri: https://ast.checkmarx.net/
cx_tenant: your_tenant
Expand Down
4 changes: 2 additions & 2 deletions sample-yml/checkmarx-ast-scan-sarif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkmarx scan
uses: checkmarx/ast-github-action@main
uses: checkmarx/ast-github-action@1fe318de2993222574e6249750ba9000a4e2a6cd #main
with:
base_uri: https://ast.checkmarx.net
cx_client_id: ${{ secrets.CX_CLIENT_ID }}
cx_client_secret: ${{ secrets.CX_CLIENT_SECRET }}
cx_tenant: ${{ secrets.CX_TENANT }} # This should be replaced by users' tenant name
additional_params: --report-format sarif --output-path .
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@404b712ccd1b4eeea961470c9187609bd64e5db4 #v2
with:
# Path to SARIF file relative to the root of the repository
sarif_file: cx_result.sarif