Skip to content

feat(audit): check distinct access and refresh JWT secrets (closes #73) - #161

Open
MehulSehgal wants to merge 8 commits into
sidd190:mainfrom
MehulSehgal:feat/audit-check-jwt-secrets
Open

MehulSehgal wants to merge 8 commits into
sidd190:mainfrom
MehulSehgal:feat/audit-check-jwt-secrets

Conversation

@MehulSehgal

Copy link
Copy Markdown

Summary

Closes #73

Implements the security audit check checkJwtSecrets and the core auth.audit() runner. It audits that jwtSecret (access tokens) and jwtRefreshSecret (refresh tokens) are distinct, configured, and not left as known default placeholders.

Key Changes

  1. checkJwtSecrets Rule (backend/audit/checks/jwtSecrets.js):

    • Flags when jwtSecret or jwtRefreshSecret is missing.
    • Flags when either secret matches known default placeholders (your-secret-key-change-in-production, etc.).
    • Flags when jwtSecret === jwtRefreshSecret (reused secret across access and refresh tokens).
    • Automatically escalates findings to error severity in production environments while keeping them as warn in development.
  2. Core Audit Engine (backend/audit/index.js):

    • Introduced audit(input, options) runner accepting an Express app instance or configuration object.
    • Aggregates findings, computes pass/fail status, and tallies error/warn/info counts.
  3. Exports & Tests:

    • Exported audit from dimsee/backend and root dimsee.
    • Comprehensive unit test suite (__tests__/auditJwtSecrets.test.js).
    • Documentation updates in README.md, SECURITY.md, and CONTRIBUTING.md.

Verification

  • npm test: 6 test suites passed, 49 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 12 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: 2f1bd1e5-5a13-4ce0-80d4-b4333f096537
Commits

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

Files selected for processing: 9

  • CONTRIBUTING.md
  • README.md
  • SECURITY.md
  • __tests__/auditJwtSecrets.test.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: distinct access and refresh JWT secrets

1 participant