Skip to content

Conversation

@corypride
Copy link
Contributor

@corypride corypride commented Oct 27, 2025

feat: add frontend security vulnerability scanning

Description of Change

Added comprehensive frontend dependency security scanning to prevent vulnerable packages from being merged into the codebase. Implemented a dedicated GitHub Actions workflow that scans for high and critical severity vulnerabilities and blocks PR merges when security issues are detected.

Implementation Details

  • ✅ Created dedicated .github/workflows/security-frontend.yml workflow
  • ✅ Scans for high and critical severity vulnerabilities (stricter than moderate)
  • ✅ Blocks PR merges when vulnerabilities are detected
  • ✅ Sends Slack notifications to #unlockedv2-chat for security alerts
  • ✅ Updated vulnerable dependencies to secure versions
  • ✅ Fixed pre-commit hook security failures
  • ✅ Added manual testing capability with workflow_dispatch
  • ✅ Configured audit report artifacts (30-day retention)

Security Vulnerabilities Fixed

Current Security Status

  • 0 vulnerabilities found - All security issues resolved
  • Pre-commit hooks passing - Local security validation working
  • CI security check passing - GitHub Actions workflow verified
  • PR protection active - Future vulnerabilities will block merges

Workflow Features

  • Dedicated Security Workflow: Separate from build process for clarity
  • Slack Notifications: Real-time alerts for vulnerability detections
  • PR Blocking: Prevents merging of vulnerable dependencies
  • Audit Reports: Detailed vulnerability reports stored as artifacts
  • Manual Testing: Can be triggered manually for debugging
  • Performance Optimized: Uses Node.js and yarn caching

Security Gate Behavior

  • Blocks: High, Critical vulnerabilities (strict security policy)
  • Allows: Low, Moderate, Info vulnerabilities
  • Triggers: Pull requests modifying frontend files or dependencies
  • Artifacts: Security reports stored for 30 days
  • Notifications: Slack alerts when vulnerabilities detected

Testing

  • ✅ Security workflow verified (passes with current clean dependencies)
  • ✅ Slack notification configuration tested
  • ✅ Vulnerability detection logic verified
  • ✅ PR blocking mechanism confirmed working
  • ✅ Pre-commit hooks functioning correctly
  • ✅ Manual workflow dispatch tested

Testing Instructions for Reviewers

Local Testing

# Navigate to frontend directory
cd frontend

# Test current security status (should pass)
yarn audit --level=high

# Test with broader scope (should show moderate/low vulns)
yarn audit --level=moderate

GitHub Actions Workflow Testing

Automated Testing

  1. Trigger workflow: Create a PR that modifies any frontend file
  2. Monitor Actions tab:
    • Navigate to the "Actions" tab in the GitHub repository
    • Look for "PR Security Check - Frontend Vulnerabilities Scan" workflow
    • Verify the workflow passes (should pass with current fixes)

Manual Testing

  1. Manual trigger: Go to Actions → "PR Security Check - Frontend Vulnerabilities Scan"
  2. Click "Run workflow": Test manually to verify functionality
  3. Check results: Verify scan completes and shows "No vulnerabilities found"

Security Gate Verification

  1. Expected behavior: Workflow should pass with current dependencies
  2. Future scenario: If new vulnerabilities are introduced, workflow will fail and block PR
  3. Artifact verification: Download audit reports to confirm vulnerability details

Impact on Development Workflow

  • Pull Requests: Security scan runs automatically on frontend changes
  • Early Detection: Vulnerabilities caught during PR review, not after deployment
  • Slack Integration: Team notified immediately when security issues found
  • Audit Trail: Security reports available for compliance and tracking
  • Pre-commit Protection: Local development also validated for security

Configuration Options

  • Current Threshold: --level=high (blocks high+ vulnerabilities)
  • Alternative Thresholds:
    • --level=critical: Most permissive (blocks critical only)
    • --level=moderate: Stricter (blocks moderate+)
  • To modify: Update .github/workflows/security-frontend.yml

Files Changed

  • .github/workflows/security-frontend.yml (new dedicated security workflow)
  • frontend/package.json (updated vulnerable dependencies)
  • frontend/yarn.lock (regenerated with secure versions)
  • .claude/context/pr_desc.md (updated this file)

Additional Context

This implementation addresses a critical security gap by ensuring frontend dependencies are continuously validated against the latest vulnerability database. The system now prevents vulnerable packages from being merged into the codebase and provides real-time notifications when security issues are detected.

The workflow is currently passing with 0 vulnerabilities, demonstrating that all security issues have been resolved and the system is working correctly.

@corypride corypride requested a review from a team as a code owner October 27, 2025 05:16
@corypride corypride requested review from calisio and removed request for a team October 27, 2025 05:16
@corypride corypride requested review from carddev81 and removed request for calisio October 27, 2025 05:16
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 27, 2025
@corypride corypride changed the title feat: add govulncheck to scan for security issues on PR Add npm Audit and Security Gates for Frontend Builds Oct 27, 2025
@github-actions
Copy link

🔒 Go Security Scan Results

Status: ✅ Passed

Total Vulnerabilities: 0
High/Critical: 0

Module Results

  • Backend: 0 vulnerabilities (0 high/critical)
  • Provider-Middleware: 0 vulnerabilities (0 high/critical)

Safe to merge - No high/critical vulnerabilities detected

Scan Details: View full results

@corypride corypride self-assigned this Oct 27, 2025
@github-actions
Copy link

🔒 Go Security Scan Results

Status: ✅ Passed

Total Vulnerabilities: 0
High/Critical: 0

Module Results

  • Backend: 0 vulnerabilities (0 high/critical)
  • Provider-Middleware: 0 vulnerabilities (0 high/critical)

Safe to merge - No high/critical vulnerabilities detected

Scan Details: View full results

@github-actions
Copy link

🔒 Go Security Scan Results

Status: ✅ Passed

Total Vulnerabilities: 0
High/Critical: 0

Module Results

  • Backend: 0 vulnerabilities (0 high/critical)
  • Provider-Middleware: 0 vulnerabilities (0 high/critical)

Safe to merge - No high/critical vulnerabilities detected

Scan Details: View full results

@corypride corypride force-pushed the cpride/ticketId_489_frontend_security_gates branch 9 times, most recently from b1c0a14 to 06afd3c Compare October 28, 2025 04:08
@github-actions
Copy link

🔒 Go Security Scan Results

Status: ✅ Passed

Total Vulnerabilities: 0
High/Critical: 0

Module Results

  • Backend: 0 vulnerabilities (0 high/critical)
  • Provider-Middleware: 0 vulnerabilities (0 high/critical)

Safe to merge - No high/critical vulnerabilities detected

Scan Details: View full results

@github-actions
Copy link

🔒 Go Security Scan Results

Status: ✅ Passed

Total Vulnerabilities: 0
High/Critical: 0

Module Results

  • Backend: 0 vulnerabilities (0 high/critical)
  • Provider-Middleware: 0 vulnerabilities (0 high/critical)

Safe to merge - No high/critical vulnerabilities detected

Scan Details: View full results

@github-actions
Copy link

🔒 Go Security Scan Results

Status: ✅ Passed

Total Vulnerabilities: 0
High/Critical: 0

Module Results

  • Backend: 0 vulnerabilities (0 high/critical)
  • Provider-Middleware: 0 vulnerabilities (0 high/critical)

Safe to merge - No high/critical vulnerabilities detected

Scan Details: View full results

@github-actions
Copy link

🔒 Go Security Scan Results

Status: ✅ Passed

Total Vulnerabilities: 0
High/Critical: 0

Module Results

  • Backend: 0 vulnerabilities (0 high/critical)
  • Provider-Middleware: 0 vulnerabilities (0 high/critical)

Safe to merge - No high/critical vulnerabilities detected

Scan Details: View full results

@github-actions
Copy link

🔒 Go Security Scan Results

Status: ✅ Passed

Total Vulnerabilities: 0
High/Critical: 0

Module Results

  • Backend: 0 vulnerabilities (0 high/critical)
  • Provider-Middleware: 0 vulnerabilities (0 high/critical)

Safe to merge - No high/critical vulnerabilities detected

Scan Details: View full results

@corypride corypride force-pushed the cpride/ticketId_489_frontend_security_gates branch from 7926cb2 to 882cc5f Compare October 28, 2025 05:18
@github-actions
Copy link

🔒 Go Security Scan Results

Status: ✅ Passed

Total Vulnerabilities: 0
High/Critical: 0

Module Results

  • Backend: 0 vulnerabilities (0 high/critical)
  • Provider-Middleware: 0 vulnerabilities (0 high/critical)

Safe to merge - No high/critical vulnerabilities detected

Scan Details: View full results

@corypride corypride changed the title Add npm Audit and Security Gates for Frontend Builds feat: add frontend security vulnerability scanning Oct 28, 2025
@corypride corypride force-pushed the cpride/ticketId_489_frontend_security_gates branch from 882cc5f to 6db206e Compare October 28, 2025 16:05
Copy link
Contributor

@carddev81 carddev81 left a comment

Choose a reason for hiding this comment

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

Need some git file and commit history cleanup.

yarn && \
yarn lint-staged && \
yarn build
yarn build No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

@corypride Can you remove this commit from the history since nothing changed here?

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed from the commit history too, this file has been changed already to the appropriate values

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed from the commit history too, this file has been changed already to the appropriate values

Copy link
Contributor

Choose a reason for hiding this comment

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

the node modules needs to be removed from this commit. You should be able to rebase and force push this out of here.

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed from the commit history too, this file has been changed already to the appropriate values

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed from the commit history too, this file has been changed already to the appropriate values

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed from the commit history too, this file has been changed already to the appropriate values

yarn.lock Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

This file can be deleted, there isn't anything in it?

@carddev81 carddev81 requested a review from calisio October 30, 2025 15:34
@corypride corypride force-pushed the cpride/ticketId_489_frontend_security_gates branch from 6db206e to 275a9fa Compare November 3, 2025 06:04
@corypride corypride force-pushed the cpride/ticketId_489_frontend_security_gates branch 2 times, most recently from 404ac9c to 05c18cc Compare November 3, 2025 14:54
@corypride corypride force-pushed the cpride/ticketId_489_frontend_security_gates branch from 05c18cc to 93432c8 Compare November 3, 2025 15:09
@corypride corypride requested a review from carddev81 November 4, 2025 21:21
Copy link
Contributor

@carddev81 carddev81 left a comment

Choose a reason for hiding this comment

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

Looks good. I left a comment in there for you.

--max-time 10 \
--silent \
--fail \
--data "{\"channel\":\"#unlockedv2-chat\",\"username\":\"Security Bot\",\"icon_emoji\":\":warning:\",\"text\":\"$SLACK_MESSAGE\"}" \
Copy link
Contributor

Choose a reason for hiding this comment

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

change unlockedv2-chat to 'unlockedv2-alerts', i moved the notifications to go here

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you just change it and push right now and then I will also approve so we can get this through?

@calisio calisio merged commit 72ec733 into main Nov 11, 2025
9 checks passed
@calisio calisio deleted the cpride/ticketId_489_frontend_security_gates branch November 11, 2025 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend CI-Actions documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants