Logs client ignores `from` and `take` for checkpoint pagination

Đang mở Phù hợp với người mới
#840 0 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
80/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ệ
ruby
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu trong lib/auth0/logs/client.rb tại Auth0::Logs::Client#list và xem cách các query_params được whitelist (page, per_page, sort, fields, include_fields, include_totals, search) được sao chép ra khỏi **params; thêm from và take theo cùng cách. Kiểm tra xem mã có rẽ nhánh giữa phân trang offset và phân trang checkpoint hay không, và liệu include_totals có xung đột với take hay không. Cập nhật spec/auth0/logs/client_spec.rb với một kỳ vọng request cho from/take, sau đó chạy nó qua rspec; hoàn tất khi query string được phát ra mang cả hai tham số và các bài test phân trang hiện có vẫn pass.

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

Mô tả

bug
Checklist
  • I have looked into the Readme and Examples, and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.
Description

The Auth0 Management API supports checkpoint pagination for tenant logs using the from and take query parameters.

However, Auth0::Logs::Client#list accepts these arguments through **params, but does not add them to the request query parameters. As a result, the arguments are silently ignored.

I expected the following call:

client.logs.list(
  from: checkpoint_log_id,
  take: 100
)

to send a request equivalent to:

GET /api/v2/logs?from=CHECKPOINT_LOG_ID&take=100

Instead, checkpoint pagination is not applied, and the default offset-pagination parameters are used.

Reproduction
  1. Install version 6.7.0 of the auth0 gem.

    gem "auth0", "6.7.0"
    
  2. Create a Management API client using credentials with the read:logs scope.

    client = Auth0::Client.new(
      domain: ENV.fetch("AUTH0_DOMAIN"),
      client_id: ENV.fetch("AUTH0_CLIENT_ID"),
      client_secret: ENV.fetch("AUTH0_CLIENT_SECRET")
    )
    
  3. Obtain an existing tenant log ID and call logs.list using it as the checkpoint.

    logs = client.logs.list(
      from: checkpoint_log_id,
      take: 100
    ).to_a
    
  4. Inspect the outgoing request or lib/auth0/logs/client.rb.

    Auth0::Logs::Client#list accepts from and take through **params, but does not copy them into query_params.

    The implementation only handles the following query parameters:

    • page
    • per_page
    • sort
    • fields
    • include_fields
    • include_totals
    • search

    Therefore, from and take are not included in the request.

This issue is consistently reproducible.

Additional context

The Auth0 documentation describes from and take as the parameters for retrieving logs by checkpoint:

The method documentation also mentions checkpoint pagination, but the corresponding parameters are not handled by the implementation.

ruby-auth0 version

6.7.0

Ruby version

4.0.10

Ngôn ngữ chính
Ruby
Star
205
Fork
144
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
12

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 auth0/ruby-auth0

Tất cả issue của auth0/ruby-auth0

Issue tương tự

Thêm issue về Ruby

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.