Skip to content

fix(recommendations): make reads safe and limit explicit refreshes - #377

Merged
VarshithReddy2006 merged 1 commit into
VarshithReddy2006:mainfrom
divyanshAgarwal123:codex/devtrack-358-safe-recommendations
Nov 16, 2026
Merged

VarshithReddy2006 merged 1 commit into
VarshithReddy2006:mainfrom
divyanshAgarwal123:codex/devtrack-358-safe-recommendations

Conversation

@divyanshAgarwal123

@divyanshAgarwal123 divyanshAgarwal123 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Make the authenticated recommendation GET a read-only query over saved findings, with the existing ownership checks shared by both routes.
  • Add an explicit POST refresh command with an atomic Redis sliding window of five regenerations per hour per user. A missing identity or unavailable limiter cannot bypass the budget.
  • Add Refresh insights controls to both resume views and document the API behavior.
  • Extend authorization and persistence tests; add HTTP limiter coverage.

Closes #358

Verification

  • Backend build: npm run build passed.
  • Recommendation authorization and limiter tests: 12 passed, including repeated GET without document changes, 401/404 ownership cases, 429, expiry, and Redis failure.
  • Redis Lua script: checked against a temporary real Redis server; five accepted, sixth blocked, recovered after the rolling hour.
  • Frontend build passed; full frontend suite on Node 22: 211 passed.

The full backend unit suite was interrupted after unrelated failures in mission-rewards.test.ts and project-deletion.test.ts; the focused recommendation tests and builds above passed. CI will provide an independent run.

Signed-off-by: Divyansh agarwal <85987665+divyanshAgarwal123@users.noreply.github.com>
@VarshithReddy2006 VarshithReddy2006 added bug Something isn't working help wanted Extra attention is needed nsoc26 level3 10 points - core logic, database changes, and complex features. security Security-related improvements labels Nov 16, 2026

@VarshithReddy2006 VarshithReddy2006 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM! Verified hardening recommendations API with mandatory JWT auth, elimination of unauthenticated GET mutations, and rate limiting with all CI tests passing.

@VarshithReddy2006
VarshithReddy2006 merged commit ce63530 into VarshithReddy2006:main Nov 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working help wanted Extra attention is needed level3 10 points - core logic, database changes, and complex features. nsoc26 security Security-related improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(security,m10): harden recommendations API with mandatory JWT auth and eliminate unauthenticated GET mutations

2 participants