* Initial plan * Add automated dependency updates and security scanning - Add Dependabot configuration for npm, GitHub Actions, and Docker - Configure daily security updates and weekly regular updates - Group related dependencies (React, testing, blockchain, etc.) - Add CodeQL security analysis workflow - Add dependency review workflow for PRs - Add auto-merge workflow for patch/minor updates - Create comprehensive dependency management documentation - Update README with dependency management section Co-authored-by: onnwee <211922112+onnwee@users.noreply.github.com> * Add monthly dependency audit automation and templates - Add monthly audit issue template - Add automated workflow to create monthly audit issues - Automate dependency audit reminders on first of each month Co-authored-by: onnwee <211922112+onnwee@users.noreply.github.com> * Changes before error encountered Co-authored-by: onnwee <211922112+onnwee@users.noreply.github.com> * Simplify Dependabot auto-merge workflow - Replace complex wait-on-check-action with native GitHub auto-merge - Use pull_request_target trigger for better permissions handling - Simplify workflow to single job with clearer logic - Update documentation to reflect simpler workflow - Remove dependency on third-party action that may be unreliable Co-authored-by: PatrickFanella <61631520+PatrickFanella@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: onnwee <211922112+onnwee@users.noreply.github.com> Co-authored-by: PatrickFanella <61631520+PatrickFanella@users.noreply.github.com>
10 KiB
Dependency Management Guide
This document outlines the automated dependency update process, security scanning procedures, and review guidelines for the Internet-ID project.
Overview
The project uses automated tools to keep dependencies up-to-date and secure:
- Dependabot: Automated dependency updates via pull requests
- CodeQL: Advanced security vulnerability scanning
- Dependency Review: PR-based security checks for new dependencies
- Auto-merge: Automatic merging of safe updates after CI passes
Automated Dependency Updates
Dependabot Configuration
Dependabot is configured to automatically create pull requests for dependency updates. See .github/dependabot.yml for the complete configuration.
Update Schedule
- Security updates: Checked daily at 9:00 AM PST
- High priority, auto-approved for merging after CI passes
- Covers all vulnerability patches regardless of severity
- Regular updates: Checked weekly on Mondays at 9:00 AM PST
- Grouped by category (React, testing tools, linting, etc.)
- Patch and minor updates auto-merge after CI passes
- Major updates require manual review
Update Categories
Dependencies are organized into logical groups to reduce noise:
Root Package (/):
hardhat-and-ethers: Blockchain tooling (Hardhat, Ethers.js, OpenZeppelin)testing-tools: Test frameworks (Chai, Mocha, Sinon, Supertest)prisma: Database ORM and related toolssecurity-tools: Security packages (Sentry, Helmet, rate limiting)linting-and-formatting: ESLint, Prettier, and TypeScript ESLinttypescript: TypeScript and type definitions
Web Package (/web):
react: React and React DOMnextjs: Next.js framework and pluginsauth: NextAuth and authentication adaptersprisma-web: Prisma client for webplaywright: E2E testing frameworkperformance: Lighthouse CI and performance tools
CLI Package (/cli):
cli-tools: Commander, Inquirer, Chalk, Oracli-shared: Axios, Ethers, Dotenv
SDK Package (/sdk/typescript):
sdk: Axios and TypeScript
Infrastructure:
github-actions: GitHub Actions workflow dependenciesdocker: Docker base images
Auto-Merge Policy
Dependabot PRs are automatically merged based on the following rules:
✅ Auto-merged (after CI passes):
- Patch updates (e.g., 1.2.3 → 1.2.4)
- Minor updates (e.g., 1.2.0 → 1.3.0)
- Security patches (any severity)
⚠️ Manual review required:
- Major updates (e.g., 1.0.0 → 2.0.0)
- Breaking changes indicated in PR description
- Failed CI checks
- License changes
The auto-merge workflow:
- Dependabot creates PR with update
- Workflow auto-approves patch/minor updates
- Auto-merge is enabled (waits for CI to pass)
- GitHub merges automatically when all required checks pass
- If update is major → Comment added requesting manual review
Security Scanning
CodeQL Analysis
CodeQL runs advanced security analysis on the codebase:
- Schedule: Weekly on Mondays + on every push/PR to main
- Query Coverage:
security-extendedandsecurity-and-qualitypacks - Languages: JavaScript/TypeScript
- Results: Available in Security tab → Code scanning alerts
Viewing CodeQL Results
- Go to repository → Security tab
- Click Code scanning alerts
- Filter by severity, status, or tool
- Click alert for detailed information and remediation steps
Responding to CodeQL Alerts
Critical/High Severity:
- Create issue immediately
- Assign to security team
- Fix within 1 business day
- Deploy patch as soon as CI passes
Medium Severity:
- Create issue for tracking
- Fix within 1 week
- Include in next regular release
Low/Informational:
- Review for false positives
- Fix during regular maintenance
- May defer if risk is acceptable
Dependency Review
Every pull request is automatically scanned for:
- New vulnerabilities in dependencies
- Problematic licenses (GPL, AGPL, LGPL)
- Supply chain risks
Configuration (.github/workflows/dependency-review.yml):
- Fails PR on moderate+ severity vulnerabilities
- Warns on low severity issues
- Allows: MIT, Apache-2.0, BSD, ISC licenses
- Denies: GPL-3.0, AGPL-3.0, LGPL-3.0
Responding to Dependency Review Failures
If a PR fails dependency review:
- Identify the issue: Check the PR comment for details
- Assess risk: Review CVE details and CVSS score
- Take action:
- Vulnerable dependency: Update to patched version or find alternative
- License issue: Replace with compatible library or get approval
- Supply chain risk: Verify package authenticity, consider alternatives
GitHub Security Alerts
Dependabot Security Alerts notify about vulnerabilities in dependencies:
- Location: Security tab → Dependabot alerts
- Notifications: Enabled for high/critical vulnerabilities
- Auto-fix: Dependabot creates PR with fix automatically
Configuring Notifications
Ensure you're subscribed to security notifications:
- Go to repository settings
- Click Notifications (left sidebar)
- Enable notifications for:
- Dependabot alerts
- Security alerts
- Set notification level to Participating and @mentions or All activity
For high/critical alerts:
- Go to your GitHub profile settings
- Click Notifications
- Enable Email for security alerts
Review Guidelines
Reviewing Dependabot PRs
Before merging a Dependabot PR (especially major updates):
- Read the changelog: Click the release notes link in PR description
- Check for breaking changes: Look for BREAKING CHANGE commits
- Review the diff: Ensure only expected files changed (package.json, lock files)
- Verify CI passes: All checks must be green
- Test locally (major updates only):
gh pr checkout <PR-NUMBER> npm install --legacy-peer-deps npm test npm run lint
Testing Updates Locally
For critical updates or major versions:
# Checkout the Dependabot PR
gh pr checkout 123
# Install dependencies
npm ci --legacy-peer-deps
cd web && npm ci --legacy-peer-deps
# Run tests
npm test
cd web && npm run test:e2e
# Build and verify
npm run build
cd web && npm run build
# Manual testing if needed
npm run start:api # Test API
cd web && npm run dev # Test web app
Rejecting Updates
If an update causes issues:
- Comment on PR with details of the problem
- Close the PR (don't merge)
- Snooze the update in Dependabot settings if needed
- Create an issue to track the problem and resolution
Monthly Dependency Audit
Schedule a monthly review to maintain dependency health:
Audit Checklist
First Monday of each month (1-2 hours):
- Review all open Dependabot PRs
- Merge safe updates
- Close outdated or problematic PRs
- Test and merge blocked major updates
- Check Dependabot security alerts
- Ensure all high/critical alerts are resolved
- Review medium severity alerts
- Document decisions on deferred alerts
- Review dependency health
- Check for deprecated packages:
npm outdated - Look for unmaintained dependencies (no updates in 1+ year)
- Identify duplicate dependencies:
npm dedupe
- Check for deprecated packages:
- Check for consolidation opportunities
- Review if multiple packages solve the same problem
- Consider removing unused dependencies
- Evaluate lightweight alternatives to heavy packages
- Update documentation
- Update dependency count in README if significant changes
- Document any new critical dependencies
- Update this guide if process changes
Running Manual Dependency Checks
# Check for outdated packages
npm outdated
cd web && npm outdated
cd ../cli && npm outdated
cd ../sdk/typescript && npm outdated
# Check for security vulnerabilities
npm audit
cd web && npm audit
cd ../cli && npm audit
cd ../sdk/typescript && npm audit
# Fix vulnerabilities (with caution)
npm audit fix
# Note: Only run `npm audit fix --force` after careful review
# Deduplicate dependencies
npm dedupe
cd web && npm dedupe
Dependency Metrics to Track
Monitor these metrics over time:
- Total number of dependencies (direct + transitive)
- Number of outdated packages
- Security vulnerabilities by severity
- Average age of dependencies
- Number of deprecated packages
Troubleshooting
Dependabot Not Creating PRs
Check:
- Dependabot is enabled in repository settings
.github/dependabot.ymlsyntax is valid- Hit open PR limit (default: 10 per package manager)
- Dependencies are already up-to-date
Solution:
- Go to Insights → Dependency graph → Dependabot
- Check for errors or paused updates
- Manually trigger update: Click "Check for updates"
Auto-merge Not Working
Check:
- CI checks are passing
- PR is from
dependabot[bot]user - Update type is patch or minor (not major)
- Branch protection rules allow auto-merge
Solution:
- Review workflow runs in Actions tab
- Ensure required checks are configured correctly
- Verify repository settings allow auto-merge
CodeQL Analysis Failing
Check:
- Node.js version compatibility
- Dependencies install successfully
- Code compiles without errors
Solution:
- Review workflow logs in Actions tab
- Update Node.js version in workflow if needed
- Ensure dependencies are in sync across packages
False Positive Security Alerts
Process:
- Verify the alert is actually a false positive
- Document why it's a false positive
- Dismiss the alert in GitHub Security tab
- Add reasoning for dismissal
- Consider opening an issue with the security scanner
Resources
Official Documentation
Internal Documentation
Security Resources
Questions?
For questions about dependency management:
- Open a discussion in GitHub Discussions
- Contact the security team at security@subculture.io
- Review existing issues with the
dependencieslabel