File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6060[tasks ."audit:osv" ]
6161description = ' Generic vulnerability scan across lockfiles'
6262run = '''
63- for i in 1 2 3; do
64- if unirtm exec -- osv-scanner scan . --config .osv-scanner.toml; then
65- exit 0
66- fi
67- echo "⚠️ osv-scanner failed (likely network timeout). Retrying ($i/3)..."
68- sleep 2
69- done
70- exit 1
63+ # Strategy 1: Environment-based routing (Local: Offline, CI: Online)
64+ if [ "$CI" = "true" ] || [ "$GITHUB_ACTIONS" = "true" ]; then
65+ # CI Environment: Call API directly (fast, avoids large DB downloads)
66+ for i in 1 2 3; do
67+ if unirtm exec -- osv-scanner scan . --config .osv-scanner.toml; then
68+ exit 0
69+ fi
70+ echo "⚠️ osv-scanner (Online) failed. Retrying ($i/3)..."
71+ sleep 2
72+ done
73+ exit 1
74+ else
75+ # Local Environment: Use offline DB to prevent network timeouts
76+ for i in 1 2 3; do
77+ if unirtm exec -- osv-scanner scan . --config .osv-scanner.toml --offline-vulnerabilities --download-offline-databases; then
78+ exit 0
79+ fi
80+ echo "⚠️ osv-scanner (Offline) failed. Retrying ($i/3)..."
81+ sleep 2
82+ done
83+ exit 1
84+ fi
7185'''
7286
7387[tasks ."audit:npm" ]
You can’t perform that action at this time.
0 commit comments