Skip to content

Commit 979a044

Browse files
committed
added gitleaks security scan
1 parent 00d079e commit 979a044

File tree

7 files changed

+68
-9
lines changed

7 files changed

+68
-9
lines changed

.github/actions/install-aptos-cli/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ inputs:
55
version:
66
description: "Aptos CLI version to install"
77
required: true
8-
default: "7.2.0"
8+
default: "7.7.0"
99

1010
runs:
1111
using: "composite"
@@ -37,7 +37,7 @@ runs:
3737
fi
3838
3939
# Download & Install
40-
URL="https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-v${VERSION}/${FILENAME}"
40+
URL="https://github.com/aptos-labs/aptos-core/releases/tag/aptos-cli-v${VERSION}/${FILENAME}"
4141
echo "Downloading Aptos CLI from $URL"
4242
curl -sL "$URL" -o aptos-cli.zip
4343
unzip aptos-cli.zip

.github/workflows/doc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Install Aptos CLI
3939
uses: ./.github/actions/install-aptos-cli
4040
with:
41-
version: "6.2.0"
41+
version: "7.7.0"
4242
- name: Run Aptos Create Local Testnet
4343
run: |
4444
make local-testnet &

.github/workflows/security-scan.yml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
- name: TruffleHog OSS Secret Scanning
2121
uses: trufflesecurity/trufflehog@main
2222
with:
23-
# Scan the entire repository
23+
# Scan the entire repository
2424
path: ./
25-
# Only show verified secrets and unknown (high confidence)
25+
# Only show verified secrets and unknown (high confidence)
2626
extra_args: --results=verified,unknown
2727

2828
- name: Setup Python for detect-secrets
@@ -79,6 +79,45 @@ jobs:
7979
8080
echo "✅ Custom secret checks passed!"
8181
82+
# ---- Gitleaks CLI pinned to 8.28.0 (no SARIF) ----
83+
- name: Download Gitleaks v8.28.0 (linux_x64) + verify checksum
84+
env:
85+
GITLEAKS_VERSION: "8.28.0"
86+
run: |
87+
set -euo pipefail
88+
TAR="gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
89+
BASE="https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}"
90+
curl -sSL "${BASE}/${TAR}" -o gitleaks.tar.gz
91+
curl -sSL "${BASE}/gitleaks_${GITLEAKS_VERSION}_checksums.txt" -o checksums.txt
92+
EXPECTED=$(grep "$TAR" checksums.txt | awk '{print $1}')
93+
ACTUAL=$(sha256sum gitleaks.tar.gz | awk '{print $1}')
94+
[ "$EXPECTED" = "$ACTUAL" ] || { echo "Checksum mismatch!"; exit 1; }
95+
tar -xzf gitleaks.tar.gz gitleaks
96+
chmod +x gitleaks
97+
./gitleaks version
98+
99+
# PRs: stage only changed files and scan staged diff (blocks on new leaks)
100+
- name: Run Gitleaks on staged PR changes (blocking)
101+
if: ${{ github.event_name == 'pull_request' }}
102+
run: |
103+
set -euo pipefail
104+
# Ensure base is present and compute changed files
105+
git fetch --no-tags --prune --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}
106+
git diff --name-only origin/${{ github.base_ref }}..HEAD > /tmp/changed_files.txt
107+
if [ -s /tmp/changed_files.txt ]; then
108+
xargs -a /tmp/changed_files.txt git add
109+
./gitleaks protect --staged --no-banner --redact --config-path .gitleaks.toml
110+
xargs -a /tmp/changed_files.txt git reset
111+
else
112+
echo "No changed files; skipping."
113+
fi
114+
115+
# Non-PR runs (e.g., merge_group/push): full scan, do not fail the job
116+
- name: Run Gitleaks full scan (non-blocking)
117+
if: ${{ github.event_name != 'pull_request' }}
118+
run: |
119+
./gitleaks detect --source . --no-banner --redact --config-path .gitleaks.toml || true
120+
82121
# Optional: Add Semgrep for additional security analysis
83122
semgrep:
84123
runs-on: ubuntu-latest
@@ -92,7 +131,7 @@ jobs:
92131
- name: Run Semgrep
93132
uses: returntocorp/semgrep-action@v1
94133
with:
95-
# Run security-focused rules
134+
# Run security-focused rules
96135
config: >-
97136
p/security-audit
98137
p/secrets

.github/workflows/testnet-deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- name: Install Aptos CLI
6767
uses: ./.github/actions/install-aptos-cli
6868
with:
69-
version: "6.2.0"
69+
version: "7.7.0"
7070

7171
- name: Set Aptos Workspace Config
7272
run: make set-workspace-config

.github/workflows/typescript-integration-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
- name: Install Aptos CLI
5555
uses: ./.github/actions/install-aptos-cli
5656
with:
57-
version: "6.2.0"
57+
version: "7.7.0"
5858

5959
- name: Install Node.js
6060
uses: actions/setup-node@v4

.github/workflows/unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Install Aptos CLI
4242
uses: ./.github/actions/install-aptos-cli
4343
with:
44-
version: "6.2.0"
44+
version: "7.7.0"
4545

4646
- name: Run Aptos Create Local Testnet
4747
run: |

.gitleaks.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
title = "Gitleaks Config (lean)"
2+
3+
[allowlist]
4+
description = "Common non-secret noise"
5+
paths = [
6+
'''(^|/)tests?(/|$)''',
7+
'''(^|/)fixtures?(/|$)''',
8+
'''(^|/)examples?(/|$)''',
9+
'''(^|/)docs?(/|$)''',
10+
'''(^|/)migrations?(/|$)''',
11+
'''\.md$''',
12+
'''package-lock\.json$''',
13+
'''yarn\.lock$''',
14+
'''pnpm-lock\.yaml$''',
15+
'''\.png$''',
16+
'''\.jpg$''',
17+
'''\.jpeg$''',
18+
'''\.gif$''',
19+
'''\.svg$''',
20+
]

0 commit comments

Comments
 (0)