akctba / akctba/secret-santa-go-api

Add rate limiting and request size limits

Đang mở
#28 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement Security
Ngôn ngữ chính
Go
Star
0
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Problem

The API has no rate limiting or request body size restrictions. This exposes it to:

- **Brute-force attacks** on `/user/signin` (OWASP A07: Identification and Authentication Failures)
- **DoS via large payloads** — a client can send arbitrarily large request bodies
- **Enumeration attacks** on user/group endpoints

## Expected Behavior

- Requests to sensitive endpoints (especially `/user/signin`) should be rate-limited per IP.
- Request body sizes should be capped at a reasonable limit.

## Suggested Fix

1. Add a rate-limiting middleware using a package like `golang.org/x/time/rate` or `github.com/ulule/limiter`.
2. Wrap the router handler with `http.MaxBytesReader` to cap request body size (e.g., 1MB).

## Affected Files
- `main.go`
- `controllers/middleware.go`

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.