|
| 1 | +name: bughunt yarn-classic probe |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: ['bughunt/yarn-classic/**'] |
| 5 | +permissions: |
| 6 | + contents: read |
| 7 | +jobs: |
| 8 | + probe: |
| 9 | + runs-on: ${{ matrix.runner }} |
| 10 | + timeout-minutes: 30 |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + runner: ['ubuntu-latest', 'ubuntu-24.04-arm'] |
| 15 | + image: ['node:22-alpine', 'node:18-alpine', 'node:22-bookworm-slim'] |
| 16 | + yarn: ['1.7.0', '1.22.22'] |
| 17 | + steps: |
| 18 | + - name: PR 976 wrapper under yarn ${{ matrix.yarn }} on ${{ matrix.image }} (${{ matrix.runner }}) |
| 19 | + run: | |
| 20 | + curl -fsSL -o wrapper.js https://raw.githubusercontent.com/SocketDev/socket-patch/162befeef53037a1fbb8fb7d48c7025b9bcad8ad/npm/socket-patch/bin/socket-patch |
| 21 | + head -3 wrapper.js |
| 22 | + cat > probe.sh <<'PROBEEOF' |
| 23 | + set -u |
| 24 | + V="$1" |
| 25 | + echo "arch $(uname -m) libc: $(ldd --version 2>&1 | head -1)"; node --version |
| 26 | + npm install --prefix /y --no-audit --no-fund "yarn@$V" > /dev/null 2>&1 |
| 27 | + Y="node /y/node_modules/yarn/bin/yarn.js"; $Y --version |
| 28 | + mkdir -p /p && cd /p && echo '{"name":"p","version":"1.0.0","private":true}' > package.json |
| 29 | + $Y add -D @socketsecurity/socket-patch@4.0.0 --no-progress > /tmp/i.log 2>&1; echo "local install exit $?" |
| 30 | + echo "local platform packages: $(ls node_modules/@socketsecurity | tr '\n' ' ')" |
| 31 | + W=node_modules/@socketsecurity/socket-patch/bin/socket-patch |
| 32 | + node $W --version > /tmp/o.txt 2> /tmp/e.txt; rc0=$? |
| 33 | + echo "OLD wrapper exit $rc0 out=[$(cat /tmp/o.txt)] err=[$(cat /tmp/e.txt)]" |
| 34 | + cp /wrapper.js $W |
| 35 | + node $W --version > /tmp/o.txt 2> /tmp/e.txt; rc1=$? |
| 36 | + echo "NEW wrapper exit $rc1 out=[$(cat /tmp/o.txt)] err=[$(cat /tmp/e.txt)]" |
| 37 | + $Y socket-patch --version > /tmp/o2.txt 2>&1; rc2=$?; echo "NEW via yarn run exit $rc2 out=[$(tr '\n' ' ' < /tmp/o2.txt | cut -c1-200)]" |
| 38 | + node $W scan --json --cwd /p --offline > /tmp/o3.txt 2>&1; rc3=$?; echo "NEW scan exit $rc3 out=[$(tr '\n' ' ' < /tmp/o3.txt | cut -c1-300)]" |
| 39 | + # exit-code passthrough: an unknown subcommand should give the CLI's own usage exit (2) |
| 40 | + node $W definitely-not-a-command > /dev/null 2>&1; rc4=$?; echo "NEW usage exit $rc4" |
| 41 | + # global install |
| 42 | + $Y global add @socketsecurity/socket-patch@4.0.0 --prefix /g --no-progress > /tmp/g.log 2>&1; echo "global install exit $?" |
| 43 | + GD=$($Y global dir 2>/dev/null | tail -1); echo "global dir $GD" |
| 44 | + GW="$GD/node_modules/@socketsecurity/socket-patch/bin/socket-patch" |
| 45 | + /g/bin/socket-patch --version > /tmp/o.txt 2>&1; rg0=$?; echo "OLD global bin exit $rg0 out=[$(cat /tmp/o.txt)]" |
| 46 | + cp /wrapper.js "$GW" |
| 47 | + /g/bin/socket-patch --version > /tmp/o.txt 2>&1; rg1=$?; echo "NEW global bin exit $rg1 out=[$(cat /tmp/o.txt)]" |
| 48 | + echo "RESULT yarn=$V $(grep ^ID= /etc/os-release) arch=$(uname -m) old=$rc0 new=$rc1 yarnrun=$rc2 scan=$rc3 usage=$rc4 global_old=$rg0 global_new=$rg1" |
| 49 | + PROBEEOF |
| 50 | + docker run --rm -v "$PWD/probe.sh:/probe.sh:ro" -v "$PWD/wrapper.js:/wrapper.js:ro" ${{ matrix.image }} sh /probe.sh '${{ matrix.yarn }}' |
0 commit comments