Files
Copilot c3a8c11a1d Resolve high-severity npm vulnerabilities and enforce audit in CI (#131)
* Initial plan

* Run npm audit fix to resolve auto-fixable vulnerabilities

Co-authored-by: onnwee <211922112+onnwee@users.noreply.github.com>

* Remove unused ipfs-http-client and enforce audit in CI

- Remove ipfs-http-client dependency (not used, has high-severity vulnerability)
- Add npm audit --audit-level=high to CI workflow
- Update secret-security workflow to enforce high-level audit
- All high-severity vulnerabilities now resolved (0 high)

Co-authored-by: onnwee <211922112+onnwee@users.noreply.github.com>

* Run npm audit fix on web package

- Fixed high-severity vulnerabilities in Next.js and qs
- Web package now has 0 high-severity vulnerabilities

Co-authored-by: onnwee <211922112+onnwee@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>
2026-02-15 21:11:56 -06:00

124 lines
2.9 KiB
YAML

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
jobs:
# Backend: Lint, TypeScript build, Hardhat compile, and tests
backend:
name: Backend (Lint, Build, Test)
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: internetid
POSTGRES_PASSWORD: internetid
POSTGRES_DB: internetid_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql://internetid:internetid@localhost:5432/internetid_test?schema=public
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Security audit (high severity)
run: npm audit --audit-level=high
- name: Run linter (root)
run: npm run lint:root
- name: Check formatting
run: npm run format:check
- name: Validate Prisma schema format
run: npm run db:format:check
- name: Compile Hardhat contracts
run: npm run build
- name: Generate Prisma client
run: npm run db:generate
- name: Run database migrations
run: npx prisma migrate deploy
- name: Run tests
run: npm test
# Web: Lint and TypeScript check
web:
name: Web (Lint, TypeScript, Tests)
runs-on: ubuntu-latest
env:
# Mock environment variables for Next.js build
# The build uses standalone mode and doesn't require real values
DATABASE_URL: postgresql://internetid:internetid@localhost:5432/internetid_test?schema=public
NEXTAUTH_URL: http://localhost:3000
NEXTAUTH_SECRET: ci-test-secret-not-for-production
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: "web/package-lock.json"
- name: Install root dependencies (for Prisma schema)
run: npm ci --legacy-peer-deps
- name: Install web dependencies
working-directory: web
run: npm ci --legacy-peer-deps
- name: Security audit (high severity)
working-directory: web
run: npm audit --audit-level=high
- name: Run linter (web)
working-directory: web
run: npm run lint
- name: Check formatting (web)
working-directory: web
run: npm run format:check
- name: Run component tests (web)
working-directory: web
run: npm test
- name: Build Next.js app
working-directory: web
run: npm run build