|
| 1 | +# Socket Security Scan with Tier 1 Reachability Analysis |
| 2 | +# |
| 3 | +# This workflow scans dependencies and performs reachability analysis |
| 4 | +# to identify which vulnerabilities are actually reachable in the code. |
| 5 | +# |
| 6 | +# Required: SOCKET_SECURITY_API_KEY secret with enterprise plan |
| 7 | +# API token scopes needed: socket-basics, uploaded-artifacts, full-scans, repo |
| 8 | + |
| 9 | +name: Socket Security Scan |
| 10 | + |
| 11 | +on: |
| 12 | + schedule: |
| 13 | + - cron: "0 2 * * *" # Everyday at 2 AM UTC |
| 14 | + workflow_dispatch: |
| 15 | + inputs: |
| 16 | + enable_reachability: |
| 17 | + description: "Enable Tier 1 reachability analysis" |
| 18 | + required: false |
| 19 | + default: "true" |
| 20 | + type: choice |
| 21 | + options: |
| 22 | + - "true" |
| 23 | + - "false" |
| 24 | + |
| 25 | +concurrency: |
| 26 | + group: socket-security-scan |
| 27 | + cancel-in-progress: true |
| 28 | + |
| 29 | +jobs: |
| 30 | + socket-security: |
| 31 | + name: Socket Security Scan |
| 32 | + runs-on: ubuntu-latest |
| 33 | + timeout-minutes: 120 |
| 34 | + permissions: |
| 35 | + contents: read |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Checkout repository |
| 39 | + uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + fetch-depth: 0 |
| 42 | + |
| 43 | + - name: Setup Python |
| 44 | + uses: actions/setup-python@v5 |
| 45 | + with: |
| 46 | + python-version: "3.12" |
| 47 | + |
| 48 | + - name: Setup Node.js |
| 49 | + uses: actions/setup-node@v4 |
| 50 | + with: |
| 51 | + node-version: "20" |
| 52 | + |
| 53 | + - name: Install uv (Python package manager) |
| 54 | + uses: astral-sh/setup-uv@v4 |
| 55 | + |
| 56 | + - name: Install Socket CLI |
| 57 | + run: uv pip install socketsecurity --upgrade --system |
| 58 | + |
| 59 | + - name: Run Socket Security Scan |
| 60 | + env: |
| 61 | + SOCKET_SECURITY_API_TOKEN: ${{ secrets.SOCKET_SECURITY_API_KEY }} |
| 62 | + PYTHONUNBUFFERED: "1" |
| 63 | + ENABLE_REACH: ${{ github.event.inputs.enable_reachability }} |
| 64 | + run: | |
| 65 | + REPO_NAME="${GITHUB_REPOSITORY#*/}" |
| 66 | +
|
| 67 | + # Build reachability flags if enabled |
| 68 | + REACH_FLAGS="" |
| 69 | + if [[ "${ENABLE_REACH}" != "false" ]]; then |
| 70 | + REACH_FLAGS="--reach --reach-memory-limit 16384 --reach-timeout 3600" |
| 71 | + echo "Reachability analysis enabled" |
| 72 | + fi |
| 73 | +
|
| 74 | + echo "Scanning repository: $REPO_NAME" |
| 75 | +
|
| 76 | + socketcli \ |
| 77 | + --target-path "$GITHUB_WORKSPACE" \ |
| 78 | + --repo "$REPO_NAME" \ |
| 79 | + --enable-debug \ |
| 80 | + $REACH_FLAGS |
0 commit comments