Check open Dependabot alerts on kubeopencode/kubeopencode and fix them by adding or updating pnpm overrides for vulnerable transitive dependencies.
- CronTask: Daily at 6:00 UTC (
deploy/crontasks/crontask-fix-vulnerabilities.yaml) - Manual:
fix vulnerabilities,check dependabot alerts
-
Navigate to the cloned
kubeopencodedirectory -
Query open Dependabot alerts:
gh api repos/kubeopencode/kubeopencode/dependabot/alerts \ --jq '.[] | select(.state=="open") | {number, severity: .security_vulnerability.severity, package: .security_vulnerability.package.name, ecosystem: .security_vulnerability.package.ecosystem, patched: .security_vulnerability.first_patched_version.identifier, vulnerable_range: .security_vulnerability.vulnerable_range, summary: .security_advisory.summary}' -
If no open alerts, exit successfully with "No open Dependabot vulnerabilities found."
-
Group alerts by ecosystem:
- npm packages: fix via pnpm overrides in
ui/package.jsonand/orwebsite/package.json - go packages: fix via
go getandgo mod tidy - other: report but skip
- npm packages: fix via pnpm overrides in
Memory optimization: ui and website are independent projects. Process them serially and clean up node_modules between projects to avoid keeping two dependency trees in memory.
Set memory cap for Node.js before running any pnpm command:
export NODE_OPTIONS="--max-old-space-size=3072"-
Check if the package exists in this subproject:
cd ui # or cd website pnpm why <package-name> 2>&1
If not found, skip this project.
-
Add the pnpm override in this project's
package.json:"pnpm": { "overrides": { "<package-name>": ">=<patched-version>" } }
If multiple packages are vulnerable, add all overrides at once before running install (avoids repeated lockfile rewrites).
-
Run install with reduced concurrency:
pnpm install --no-frozen-lockfile --child-concurrency 2
-
Verify the fix:
pnpm why <package-name>
-
Clean up before switching to the next project:
rm -rf node_modules cd ..
For each Go vulnerability:
- Run
go get <module>@<patched-version> - Run
go mod tidy - Run
go mod vendoronly if avendor/directory already exists and the module is in the vendor tree:Skip vendor update if the fix is purely for an unused transitive dependency — CI will catch it.if [ -d vendor ] && grep -q "<module>" vendor/modules.txt 2>/dev/null; then go mod vendor fi
git add -A
git commit -s -m "fix(deps): resolve Dependabot vulnerabilities
<list each fixed package and CVE>"
git push -u origin <branch-name>Create a pull request:
gh pr create --title "fix(deps): resolve Dependabot vulnerabilities" \
--body "<list each fixed package and patched version>"- Only fix vulnerabilities that have a patched version available
- Do NOT modify code logic — only dependency versions and lockfiles
- Batch npm overrides: collect all npm vulnerabilities first, add ALL overrides to
package.jsonin one edit, then runpnpm installonce. Avoid rewriting the lockfile multiple times. - Process projects serially: finish
uicompletely (includingrm -rf node_modules) before touchingwebsite - Verify each fix with
pnpm whyorgo list -mbefore committing - If a fix breaks
pnpm installorgo mod tidy, revert that specific change and skip it