Skip to content

feat: add abuse protection with throttler + logging to Postgres#386

Merged
BigBen-7 merged 2 commits into
Lead-Studios:dev-v1from
phertyameen:feat/abuseProtection
Oct 2, 2025
Merged

feat: add abuse protection with throttler + logging to Postgres#386
BigBen-7 merged 2 commits into
Lead-Studios:dev-v1from
phertyameen:feat/abuseProtection

Conversation

@phertyameen
Copy link
Copy Markdown
Contributor

Description

Adds abuse protection to critical APIs using @nestjs/throttler and logs blocked attempts into Postgres for auditing.

Related Issues

Closes issue #351

Changes Made

  • Integrated @nestjs/throttler to protect critical APIs
  • Added AbuseLog entity + service to record abuse attempts into Postgres
  • Implemented custom LoggingThrottlerGuard to auto-log blocked requests

How to Test

  1. Run the app with npm run start:dev.
  2. Hit the login endpoint 6+ times within a minute.
  3. Confirm:
    • The 6th request returns a rate-limit error (HTTP 429).
    • A record is created in the abuse_logs table with endpoint, ip, reason.

Next Steps

  • Apply @Throttle() decorators to future auth, purchase, and transfer modules once they are created.

Screenshots (if applicable)

Checklist

  • My code follows the project's coding style.
  • I have tested these changes locally.
  • Documentation has been updated where necessary.

Additional note for future Contributors

  • Login/Auth, Purchase, and Transfer modules are not yet created.
  • Once these modules are added, apply @Throttle decorators (or rely on global guard) to enforce limits.
  • Abuse logs can be viewed in the abuse_logs table for monitoring suspicious activity.

@BigBen-7 BigBen-7 merged commit e3931d4 into Lead-Studios:dev-v1 Oct 2, 2025
1 of 2 checks passed
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.

2 participants