|
| 1 | +# Socket reachability scan for freighter. |
| 2 | +# Multi-eco: Node (yarn — yarn.lock + many sub-packages) + Ruby (Gemfile at root). |
| 3 | +# |
| 4 | +# Schedule: Sat 09:36 UTC weekly. The 129-repo fleet is |
| 5 | +# spread across Sat 00:00 – Mon 03:12 UTC with 24-minute spacing to avoid |
| 6 | +# Socket API rate limiting. Use workflow_dispatch to run on demand. |
| 7 | +# |
| 8 | +# ============================================================================ |
| 9 | +# Socket scan — reading the job status. (The scan step below produces this: an |
| 10 | +# exit code + an optional ::warning:: annotation, which GitHub Actions renders |
| 11 | +# as the job's state.) |
| 12 | +# ============================================================================ |
| 13 | +# GREEN (exit 0, no warning): scan completed and every analyzed vulnerability |
| 14 | +# got full Tier 1 reachability (precise, your-code-aware). Nothing to do. |
| 15 | +# YELLOW (exit 0 + "::warning:: Socket scan completed with Tier 2 fallbacks"): |
| 16 | +# scan completed, but Tier 1 could NOT be computed for some/all |
| 17 | +# vulnerabilities, which fell back to Tier 2 (precomputed) reachability. |
| 18 | +# You still get CVE detection + Tier 2 results, just reduced precision |
| 19 | +# for the affected CVEs. The job is NOT failing. |
| 20 | +# RED (non-zero exit): scan did not complete. Do not assume any part |
| 21 | +# succeeded — could be reachability hard-failing, a missing language |
| 22 | +# toolchain, the runner out of memory, a network/API error, or even the |
| 23 | +# underlying CVE/SBOM detection failing. Check the logs and fix before |
| 24 | +# relying on results. |
| 25 | +# ============================================================================ |
| 26 | + |
| 27 | +name: Socket reachability scan |
| 28 | + |
| 29 | +on: |
| 30 | + schedule: |
| 31 | + - cron: '36 9 * * 6' |
| 32 | + workflow_dispatch: |
| 33 | + |
| 34 | +permissions: |
| 35 | + contents: read |
| 36 | + |
| 37 | +jobs: |
| 38 | + socket-scan: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + - uses: ruby/setup-ruby@v1 |
| 43 | + with: |
| 44 | + ruby-version: "3" |
| 45 | + - uses: actions/setup-node@v4 |
| 46 | + with: |
| 47 | + node-version: "20" |
| 48 | + |
| 49 | + - name: Install Socket CLI + yarn |
| 50 | + run: npm install -g yarn socket |
| 51 | + |
| 52 | + - name: Run Socket reachability scan |
| 53 | + env: |
| 54 | + SOCKET_SECURITY_API_TOKEN: ${{ secrets.SOCKET_SECURITY_API_TOKEN }} |
| 55 | + run: | |
| 56 | + # Stream the scan output through tee so the run log captures it AND |
| 57 | + # we can grep it for Tier-2-fallback markers; capture the scan's |
| 58 | + # exit code via ${PIPESTATUS[0]} (tee always exits 0). If the scan |
| 59 | + # succeeded but logged a Tier 2 fallback, emit a ::warning:: |
| 60 | + # annotation that GitHub Actions renders as a yellow run-level |
| 61 | + # warning without failing the job. |
| 62 | + set +e |
| 63 | + socket scan create --reach \ |
| 64 | + --org=stellar \ |
| 65 | + --no-interactive \ |
| 66 | + --reach-continue-on-no-source-files \ |
| 67 | + --reach-continue-on-analysis-errors \ |
| 68 | + --reach-continue-on-install-errors \ |
| 69 | + --reach-continue-on-missing-lock-files \ |
| 70 | + . 2>&1 | tee /tmp/scan.log |
| 71 | + rc=${PIPESTATUS[0]} |
| 72 | + if [ $rc -eq 0 ] && grep -qE "Reachability falls back to Tier 2|fallback to the results from the pre-computed" /tmp/scan.log; then |
| 73 | + echo "::warning::Socket scan completed with Tier 2 fallbacks - some vulnerabilities used precomputed reachability instead of full Tier 1" |
| 74 | + fi |
| 75 | + exit $rc |
| 76 | +
|
0 commit comments