Untuk menjalankan Source Code Scanner, Anda perlu menginstal beberapa tools security dari sumber GitHub resmi.
- Semgrep - Static code analysis
- Grype - Dependency vulnerability scanning
- GitHub: https://github.com/anchore/grype
- TruffleHog - Secret detection
Opsi A: GitHub Tools Script (Recommended untuk GitHub)
# Jalankan sebagai Administrator - Install langsung dari GitHub releases
.\install_github_tools.ps1Opsi B: PowerShell Script (Standard)
# Buka PowerShell sebagai Administrator
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
.\install_tools.ps1Opsi C: Batch Script
# Jalankan sebagai Administrator
.\install_tools.batSumber: https://github.com/semgrep/semgrep
Via pip (Metode Resmi):
pip install semgrepVia Docker (Alternative):
docker pull semgrep/semgrepVerifikasi instalasi:
semgrep --versionSumber: https://github.com/anchore/grype
Windows (Metode Resmi):
- Download binary dari GitHub Releases
- Download file
grype_windows_amd64.zip - Extract ke folder (contoh:
C:\tools\grype) - Tambahkan folder tersebut ke PATH environment variable
Via Installation Script (Linux/macOS):
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/binVia Package Manager:
# Chocolatey
choco install grype
# Scoop
scoop install grypeVerifikasi instalasi:
grype versionSumber: https://github.com/trufflesecurity/trufflehog
Windows (Binary Release):
- Download dari GitHub Releases
- Download file
trufflehog_windows_amd64.tar.gz - Extract menggunakan tar atau 7-zip
- Tambahkan ke PATH environment variable
Via Installation Script (Linux/macOS):
curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/binVia Docker (Semua Platform):
docker pull trufflesecurity/trufflehog:latestVerifikasi instalasi:
trufflehog --versionError: "semgrep command not found"
- Pastikan Python dan pip terinstal
- Restart terminal setelah instalasi
- Cek PATH environment variable
Error: "Permission denied"
- Jalankan terminal sebagai Administrator
- Atau gunakan
pip install --user semgrep
Error: "grype command not found"
- Pastikan binary sudah di-extract dengan benar
- Tambahkan folder grype ke PATH
- Restart terminal
Error: "Access denied"
- Jalankan PowerShell sebagai Administrator
- Pastikan antivirus tidak memblokir file
Windows:
- Buka System Properties → Advanced → Environment Variables
- Edit PATH variable untuk User atau System
- Tambahkan path ke folder tools
- Restart terminal
PowerShell:
# Tambah ke PATH sementara (session ini saja)
$env:PATH += ";C:\path\to\your\tools"
# Tambah ke PATH permanent
[Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";C:\path\to\your\tools", "User")Setelah instalasi dari sumber GitHub, jalankan perintah berikut untuk memverifikasi:
# Check Semgrep
semgrep --version
# Check Grype
grype version
# Check TruffleHog
trufflehog --versionAtau gunakan script verifikasi:
python test_tools.pyJika mengalami kesulitan instalasi, Anda bisa menggunakan Docker dengan image resmi dari GitHub:
# Dockerfile menggunakan image resmi dari GitHub
FROM python:3.9-slim
# Install Semgrep dari GitHub
RUN pip install semgrep
# Install Grype dari GitHub
RUN curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b /usr/local/bin
# Install TruffleHog dari GitHub
RUN curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh | sh -s -- -b /usr/local/bin
WORKDIR /app
COPY . .
CMD ["python", "run.py"]Atau gunakan image resmi yang sudah ada:
# Semgrep
docker run --rm -v "${PWD}:/src" semgrep/semgrep
# Grype
docker run --rm -v "${PWD}:/pwd" anchore/grype
# TruffleHog
docker run --rm -v "${PWD}:/pwd" trufflesecurity/trufflehog:latest- Semgrep GitHub: https://github.com/semgrep/semgrep
- Semgrep Documentation: https://semgrep.dev/docs/
- Grype GitHub: https://github.com/anchore/grype
- Grype Documentation: https://github.com/anchore/grype#readme
- TruffleHog GitHub: https://github.com/trufflesecurity/trufflehog
- TruffleHog Documentation: https://github.com/trufflesecurity/trufflehog#readme
Jika masih mengalami masalah:
- Periksa dokumentasi resmi di GitHub masing-masing tool
- Lihat file
TROUBLESHOOTING.mduntuk masalah umum - Jalankan
python test_tools.pyuntuk diagnosis - Buat issue di repository ini dengan detail error yang dialami