|
| 1 | +# Socket reachability scan for rs-stellar-strkey. |
| 2 | +# For general Socket reachability documentation, see https://docs.socket.dev/docs/full-application-reachability |
| 3 | +# Rust-only project (has a `fuzz/` subcrate). |
| 4 | +# |
| 5 | +# Schedule: Sun 00:48 UTC weekly. Use workflow_dispatch to run on demand. |
| 6 | +# |
| 7 | +# ============================================================================ |
| 8 | +# Socket scan — reading the job status. (The scan step below produces this: an |
| 9 | +# exit code + an optional ::warning:: annotation, which GitHub Actions renders |
| 10 | +# as the job's state.) |
| 11 | +# ============================================================================ |
| 12 | +# GREEN (exit 0, no warning): scan completed and every analyzed vulnerability |
| 13 | +# got full Tier 1 reachability (precise, your-code-aware). Nothing to do. |
| 14 | +# YELLOW (exit 0 + "::warning:: Socket scan completed with Tier 2 fallbacks"): |
| 15 | +# scan completed, but Tier 1 could NOT be computed for some/all |
| 16 | +# vulnerabilities, which fell back to Tier 2 (precomputed) reachability. |
| 17 | +# You still get CVE detection + Tier 2 results, just reduced precision |
| 18 | +# for the affected CVEs. The job is NOT failing. |
| 19 | +# RED (non-zero exit): scan did not complete. Do not assume any part |
| 20 | +# succeeded — could be reachability hard-failing, a missing language |
| 21 | +# toolchain, the runner out of memory, a network/API error, or even the |
| 22 | +# underlying CVE/SBOM detection failing. Check the logs and fix before |
| 23 | +# relying on results. |
| 24 | +# ============================================================================ |
| 25 | + |
| 26 | +name: Socket reachability scan |
| 27 | + |
| 28 | +on: |
| 29 | + schedule: |
| 30 | + - cron: '48 0 * * 0' |
| 31 | + workflow_dispatch: |
| 32 | + |
| 33 | +permissions: |
| 34 | + contents: read |
| 35 | + |
| 36 | +env: |
| 37 | + # Force JS-based GitHub actions (actions/checkout, actions/setup-*, etc.) to |
| 38 | + # use Node 24 instead of the soon-to-be-deprecated Node 20. Safe to remove |
| 39 | + # after 2026-06-16 (when Node 24 becomes the default and this becomes a no-op). |
| 40 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
| 41 | + |
| 42 | +jobs: |
| 43 | + socket-scan: |
| 44 | + runs-on: ubuntu-latest |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 47 | + - uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1 |
| 48 | + with: |
| 49 | + toolchain: "1.86.0" |
| 50 | + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| 51 | + with: |
| 52 | + node-version: "24.18.0" |
| 53 | + - name: Enable Corepack (yarn/pnpm per repo packageManager) |
| 54 | + run: corepack enable |
| 55 | + |
| 56 | + - name: Install Socket CLI |
| 57 | + run: npm install -g socket |
| 58 | + |
| 59 | + - name: Run Socket reachability scan |
| 60 | + env: |
| 61 | + SOCKET_SECURITY_API_TOKEN: ${{ secrets.SOCKET_SECURITY_API_TOKEN }} |
| 62 | + run: | |
| 63 | + # Stream the scan output through tee so the run log captures it AND |
| 64 | + # we can grep it for Tier-2-fallback markers; capture the scan's |
| 65 | + # exit code via ${PIPESTATUS[0]} (tee always exits 0). If the scan |
| 66 | + # succeeded but logged a Tier 2 fallback, emit a ::warning:: |
| 67 | + # annotation that GitHub Actions renders as a yellow run-level |
| 68 | + # warning without failing the job. |
| 69 | + set +e |
| 70 | + socket scan create --reach \ |
| 71 | + --org=stellar \ |
| 72 | + --no-interactive \ |
| 73 | + --reach-continue-on-no-source-files \ |
| 74 | + --reach-continue-on-analysis-errors \ |
| 75 | + --reach-continue-on-install-errors \ |
| 76 | + --reach-continue-on-missing-lock-files \ |
| 77 | + . 2>&1 | tee /tmp/scan.log |
| 78 | + rc=${PIPESTATUS[0]} |
| 79 | + if [ $rc -eq 0 ] && grep -qE "Reachability falls back to Tier 2|fallback to the results from the pre-computed|Reachability falls back to precomputed" /tmp/scan.log; then |
| 80 | + echo "::warning::Socket scan completed with Tier 2 fallbacks - some vulnerabilities used precomputed reachability instead of full Tier 1" |
| 81 | + fi |
| 82 | + exit $rc |
0 commit comments