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

Aperta Adatta ai principianti
#840 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
80/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
ruby
Ambito
api

Direzione di ricerca

Inizia in lib/auth0/logs/client.rb presso Auth0::Logs::Client#list e osserva come i query_params in whitelist (page, per_page, sort, fields, include_fields, include_totals, search) vengono copiati fuori da **params; aggiungi from e take allo stesso modo. Controlla se il codice si dirama tra paginazione offset e checkpoint e se include_totals entra in conflitto con take. Aggiorna spec/auth0/logs/client_spec.rb con un'aspettativa di richiesta per from/take, poi eseguila tramite rspec; fatto quando la query string emessa contiene entrambi i parametri e i test di paginazione esistenti continuano a passare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Ruby
Stelle
205
Fork
144
Merge medio
1g 6h
PR unite (30g)
12

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di auth0/ruby-auth0

Tutte le issue di auth0/ruby-auth0

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.