Skip to content

Add per-user rate limiting to proof submission — max 5 uploads per hour #129

Description

@shakurJJ

Summary

POST /shipments/:id/milestones/:index/proof accepts file uploads but has no rate limit. A malicious or buggy client could flood the IPFS node with repeated uploads. Throttling proof submissions to 5 per hour per user protects IPFS storage costs and prevents abuse.

Location

src/modules/milestones/milestones.controller.ts — add @Throttle decorator to the proof upload route

Expected Behaviour

  1. Add @Throttle({ default: { limit: 5, ttl: 60 * 60 * 1000 } }) to the proof submission handler, matching the export endpoint pattern already used in ShipmentsController.
  2. Ensure the ThrottlerGuard is configured to use userId from the JWT as the throttle key for authenticated routes (not IP address).
  3. Return HTTP 429 with a Retry-After header when the limit is exceeded.
  4. Log rate limit violations at WARN level with the user's stellarAddress.

Acceptance Criteria

  • The 6th proof upload within one hour returns 429
  • The Retry-After header indicates when the limit resets
  • Rate limit resets after the TTL window
  • The throttle key is per-user, not per-IP

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions