Skip to content

feat(audit): check no wildcard CORS origin in production (closes #74) - #162

Open
MehulSehgal wants to merge 12 commits into
sidd190:mainfrom
MehulSehgal:feat/audit-check-cors-origin
Open

MehulSehgal wants to merge 12 commits into
sidd190:mainfrom
MehulSehgal:feat/audit-check-cors-origin

Conversation

@MehulSehgal

Copy link
Copy Markdown

Summary

Closes #74

Adds the security audit rule checkCorsOrigin to auth.audit(). It detects wildcard (*), missing, or insecure HTTP CORS origins when running in production.

Key Changes

  1. checkCorsOrigin Rule (backend/audit/checks/corsOrigin.js):

    • Flags wildcard (*) CORS origins. Wildcard origins combined with credentials allow credential theft.
    • Flags missing corsOrigin configuration in production.
    • Flags insecure HTTP origins (http://...) in production environments.
    • Warns if localhost/127.0.0.1 is included in production configurations.
  2. Integration & Test Coverage:

    • Registered checkCorsOrigin in the core audit() checks runner.
    • Unit tests covering wildcard, missing, insecure HTTP, and clean HTTPS configurations (__tests__/auditCorsOrigin.test.js).
    • Documentation updates in README.md and SECURITY.md.

Verification

  • npm test: 7 test suites passed, 54 tests passed.
  • npm run lint: Clean (0 errors, 0 warnings).

@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1af0b19f-ff73-45a7-bb35-da9d8b67d2d4
Commits

Reviewing files that changed from the base of the PR and between 805e9f4 and dc2f0a0.

Files selected for processing: 11

  • CONTRIBUTING.md
  • README.md
  • SECURITY.md
  • __tests__/auditCorsOrigin.test.js
  • __tests__/auditJwtSecrets.test.js
  • backend/audit/checks/corsOrigin.js
  • backend/audit/checks/jwtSecrets.js
  • backend/audit/index.js
  • backend/index.js
  • index.js
  • package.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

audit check: no wildcard CORS origin in production

1 participant