diff --git a/.github/workflows/malware-scan.yml b/.github/workflows/malware-scan.yml index 5dcc2eb1..c5ef41ea 100644 --- a/.github/workflows/malware-scan.yml +++ b/.github/workflows/malware-scan.yml @@ -22,6 +22,7 @@ jobs: env: BASE: ${{ github.base_ref }} run: | + set -uo pipefail git fetch origin "$BASE" FINDINGS="" @@ -35,12 +36,12 @@ jobs: done < <(git diff "origin/$BASE"...HEAD -- \ '*.config.js' '*.config.ts' '*.config.cjs' '*.config.mjs' \ 'package.json' '.vscode/*.json' \ - | grep '^+[^+]') + | grep '^+[^+]' || true) # 2. eval() or spawn() in config files — should never appear there HITS=$(git diff "origin/$BASE"...HEAD -- \ '*.config.js' '*.config.ts' '*.config.cjs' '*.config.mjs' \ - | grep '^+[^+]' | grep -E 'eval\s*\(|spawn\s*\(' || true) + | grep '^+[^+]' | grep -E 'eval\s*\(|spawn\s*\(' || true) if [[ -n "$HITS" ]]; then FINDINGS="${FINDINGS}- \`eval()\` or \`spawn()\` found in a config file " @@ -109,10 +110,9 @@ jobs: fi # 10. Known PolinRider marker strings - MARKERS=$(git diff "origin/$BASE"...HEAD | grep '^+[^+]' \ - | grep -F 'rmcej%otb%' || \ - git diff "origin/$BASE"...HEAD | grep '^+[^+]' | grep -F 'Cot%3T=sthP' || \ - git diff "origin/$BASE"...HEAD | grep '^+[^+]' | grep -F '_$__1e42' || true) + DIFF_ADDED=$(git diff "origin/$BASE"...HEAD | grep '^+[^+]' || true) + MARKERS=$(printf '%s\n' "$DIFF_ADDED" \ + | grep -F -e 'rmcej%otb%' -e 'Cot%3T=sthP' -e '_$__1e42' || true) if [[ -n "$MARKERS" ]]; then FINDINGS="${FINDINGS}- Known PolinRider marker string detected (\`rmcej%otb%\`, \`Cot%3T=sthP\`, or \`_\$__1e42\`) " @@ -155,8 +155,7 @@ jobs: '2. Scan your machine for malware immediately', '3. Rotate your GitHub token and all other credentials stored on that machine', '4. Recreate your branch from the latest default branch and re-apply only your own changes', - ].join(' -') + ].join('\n') }); - name: Fail if malware detected diff --git a/src/components/common/KeyBuybackModal.tsx b/src/components/common/KeyBuybackModal.tsx index b41318ec..72d4832a 100644 --- a/src/components/common/KeyBuybackModal.tsx +++ b/src/components/common/KeyBuybackModal.tsx @@ -186,7 +186,10 @@ export default function KeyBuybackModal({