Skip to content

Add request size limit to prevent DOS attacks #16

@volcodes

Description

@volcodes

To mitigate the risk of Denial-of-Service (DoS) attacks, implement a request size limit for the Go application. This will ensure that excessively large payloads are rejected, protecting the application from resource exhaustion.

Acceptance Criteria:

  • Set a maximum request size limit (e.g., 1 MB) for incoming HTTP requests.
  • Update the application to reject requests exceeding the size limit with an appropriate HTTP response (e.g., 413 Payload Too Large).
  • Log rejected requests for monitoring and debugging purposes.
  • Write unit tests to validate the request size limit functionality.
  • Ensure existing workflows are unaffected by the new limit.

Technical Notes:

  • Use the http.MaxBytesReader function or middleware to enforce the request size limit.
  • Consider configuring the limit as an environment variable for flexibility.
  • Follow existing logging conventions for consistency.
  • Ensure the response includes clear information about the size limit for client reference.

Priority: High
Labels: Security, Backend, DoS Mitigation, Go

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions