chore(deps): add npm audit CI gate and dependency update policy
ai-news-writer-ci / test (pull_request) Failing after 28s

- Add npm audit --audit-level=high step to test.yml CI workflow
- Create docs/dependency-update-policy.md with update cadence,
  security scanning procedure, and documented major-version holdbacks
  (openai 4→6, eslint 8→10, c8 9→11, dotenv 16→17)

Addresses BIT-14769 acceptance criteria:
  * Dependency scanning integrated into CI pipeline
  * Update policy documented in docs/
  * All packages >2 major versions behind have documented reasons

Paperclip-Issue: BIT-14769
Paperclip-Run: f8099c2b-26da-4c95-b001-a8b57a6d9f6f
This commit is contained in:
Patrícia Santos committed 2026-04-27 22:47:13 +00:00
1 parent 06bc5c5c4e
commit e868644f6f
2 files changed
+66

No files matched your search

+3
View File
@@ -51,6 +51,9 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Security audit
run: npm audit --audit-level=high
- name: Lint
run: npm run lint
+63
View File
@@ -0,0 +1,63 @@
# Dependency Update Policy
**Project:** ai-news-writer
**Last updated:** 2026-04-27
**Tracking issue:** BIT-14769
## Update Cadence
| Update type | Policy |
|-------------|--------|
| **Patch** (x.y.Z) | Apply immediately; merge without review |
| **Minor** (x.Y.z) | Apply within 2 weeks; squash merge on main |
| **Major** (X.y.z) | Review before upgrading; document breaking changes; test in staging first |
## Security Scanning
`npm audit --audit-level=high` runs on every push and pull request in CI (`.gitea/workflows/test.yml`). Builds fail on high or critical CVEs.
For any high/critical finding:
1. Check for an available fix via `npm audit fix`
2. If no auto-fix: pin the safe version explicitly and open a tracking issue
3. Resolve within 72 hours for critical, 1 week for high
## Current State (2026-04-27)
`npm audit` reports **0 vulnerabilities** across 282 packages.
### Packages with known major version gap
These packages are at or approaching the 2-major-version holdback limit. Each requires a documented reason to hold.
| Package | Installed | Latest | Gap | Type | Reason to hold |
|---------|-----------|--------|-----|------|----------------|
| `openai` | ^4.86.2 | 6.x | +2 major | prod | v5 changed streaming and error APIs; v6 restructured the client. Migration requires code changes in `src/writer/ai.js`. Upgrade as a dedicated task. |
| `eslint` | ^8.56.0 | 10.x | +2 major | dev | v9 replaced `.eslintrc.*` with flat config (`eslint.config.js`). Migration requires config rewrite. Hold until planned. |
| `c8` | ^9.1.0 | 11.x | +2 major | dev | Coverage tooling only; no prod impact. Upgrade when convenient alongside a test run to verify no flag regressions. |
| `dotenv` | ^16.4.7 | 17.x | +1 major | prod | Intentional range pin at v16. Review v17 changelog before upgrading. |
### Packages up to date
| Package | Installed | Latest | Status |
|---------|-----------|--------|--------|
| `prettier` | 3.8.3 | 3.8.3 | current |
| `slugify` | 1.6.9 | 1.6.9 | current |
| `axios` | ^1.7.9 | — | within range |
| `cheerio` | ^1.0.0 | — | within range |
| `pg` | ^8.11.3 | — | within range |
| `node-cron` | ^4.2.1 | — | within range |
| `winston` | ^3.17.0 | — | within range |
| `nodemon` | ^3.1.9 | — | within range |
## Automation
Gitea does not support Dependabot natively. Automated scanning is provided by:
- **CI audit gate:** `npm audit --audit-level=high` on every push/PR
- **Manual quarterly sweep:** run `npm outdated` and review against this policy
When a self-hosted Renovate or Dependabot equivalent is available, configure auto-merge for patch/minor PRs and require review for major bumps.
## No Package >2 Major Versions Behind
All packages with a 2-major-version gap are documented above with explicit holdback reasons. Any future package crossing this threshold must either be upgraded or documented here before merging.