Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Backend CI

on:
pull_request:
paths:
- 'backend/**'

jobs:
backend-check:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install backend dependencies
run: npm install
working-directory: backend

- name: Start backend briefly
run: |
node backend/server.js &
sleep 5
kill $! || true

- name: Run security audit
run: npm audit || true
Comment on lines +31 to +32
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Security audit is ineffective and runs in wrong directory.

Two issues:

  1. || true means this step always passes, even with critical vulnerabilities—defeating the purpose of CI security checks.
  2. Like npm install, this runs in the repo root instead of backend/.
🐛 Proposed fix
       - name: Run security audit
-        run: npm audit || true
+        run: npm audit --audit-level=high
+        working-directory: backend

Using --audit-level=high will fail only on high/critical vulnerabilities while allowing moderate/low ones to pass. Adjust to --audit-level=critical if you want even less strict enforcement.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Run security audit
run: npm audit || true
- name: Run security audit
run: npm audit --audit-level=high
working-directory: backend
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/backend.yml around lines 30 - 31, The "Run security audit"
step currently uses "npm audit || true" in the repo root which both silences
failures and runs in the wrong directory; update the step so it runs in the
backend directory (set working-directory to backend) and remove the "|| true" so
the job fails on vulnerabilities, and add an audit level flag such as
"--audit-level=high" (or "--audit-level=critical" if preferred) to the npm audit
command to only fail on high/critical issues.

Binary file added backend/data/brocode.sqlite
Binary file not shown.
Binary file added backend/data/brocode.sqlite-shm
Binary file not shown.
Binary file added backend/data/brocode.sqlite-wal
Binary file not shown.
Loading