List routes answer 500 for a skip or page too large for the database

Đang mở
#1,001 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
postgresql, python
Lĩnh vực
api, backend

Hướng nghiên cứu

Start with the handlers for /api/v1/rollout-schedules/, /api/v1/users/, /api/v1/metrics/errors, /api/v1/feature-flags/, and /api/v1/audit-logs/, then inspect the shared Query validation used for skip and page. Reproduce the failures with the provided curl request, and check the rollout-schedules status error branch for the parameter-name collision. Done means every affected list route returns a 422 response identifying the invalid parameter, including the rollout-schedules error branch, instead of a generic 500.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug post-launch
  • Sent: GET /api/v1/rollout-schedules/?skip=9223372036854775808 (any role). The same for skip on
    GET /api/v1/users/ (superuser), GET /api/v1/metrics/errors and GET /api/v1/feature-flags/, and for page on
    GET /api/v1/audit-logs/ (the offset is (page - 1) * limit).
  • Comes back: 500 with the generic error body. The offset reaches the query, and PostgreSQL stores an offset in a
    64-bit integer, so anything from 2^63 up is refused. skip=9223372036854775807 answers 200.
  • Expected: 422 naming the parameter, for example an upper bound on skip and page (le= on the Query), the
    same on every list route.
  • Also on GET /api/v1/rollout-schedules/: the status filter parameter has the same name as the module the
    route's error branch uses for its status code, so that branch fails too (it still answers 500).
  • Reproduction (VIEWER): curl -H "Authorization: Bearer <VIEWER token>" 'http://localhost:8000/api/v1/rollout-schedules/?skip=9223372036854775808'

Found by API fuzzing (a local run), reproduced by hand.

Ngôn ngữ chính
Python
Star
0
Fork
4
Merge trung bình
6 giờ 5 phút
Pull request đã merge (30 ngày)
453

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Controlvar/controlvar

Tất cả issue của Controlvar/controlvar

Issue tương tự

Thêm issue về Python

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.