[Bug]: content-length-guardrail policy accepts a non-string streamingJsonPath at API creation

Aperta Adatta ai principianti
#4,330 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
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, yaml
Ambito
api, backend

Direzione di ricerca

Trova lo schema della policy content-length-guardrail e confronta i suoi parametri di risposta con il parametro stringa documentato streamingJsonPath e l’esempio word-count-guardrail. Esamina la suite di integrazione citata in wso2/gateway-controllers#415 per comprendere il comportamento esistente durante la creazione delle API. Il lavoro è completato quando la creazione di un’API rifiuta un valore di streamingJsonPath che non è una stringa con HTTP 400, in modo coerente con jsonPath.

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

Descrizione

Area/Policies Aspect/Configuration Severity/Minor Type/Bug
Please select the area the issue is related to

Gateway

Please select the aspect the issue is related to

Aspect/Configuration (Config files, settings, env vars, defaults)

Description

The content-length-guardrail documentation lists streamingJsonPath as a string parameter of the response configuration. The policy reads it and refuses a value that is not a string. Its schema does not declare the parameter, so a wrong value passes API creation and fails at runtime instead.

The API is created, and every request to the operation then gets HTTP 500. A typo in this parameter breaks the operation instead of failing the deployment. jsonPath is declared as a string, and a non-string jsonPath is rejected at creation as expected.

The other seven policies in the repository that read streamingJsonPath all declare it in their schema, for example word-count-guardrail:

streamingJsonPath:
  type: string

The integration suite in wso2/gateway-controllers#415 asserts the current behaviour.

Steps to Reproduce
  1. Create a REST API with an operation that attaches the policy with a non-string streamingJsonPath:
    {"name":"content-length-guardrail","version":"v1","params":{"response":{"enabled":true,"min":1,"max":10,"streamingJsonPath":5}}}
    
  2. The API is created.
  3. Every request to that operation gets HTTP 500. An operation on the same API with a valid configuration still works.
  4. Repeat with "jsonPath": 5. API creation fails with HTTP 400, as expected.
Severity Level of the Issue

Severity/Minor (Non-critical functionality. Can be fixed in future releases)

Environment Details (with versions)
  • Policy: content-length-guardrail v1.1.0, wso2/gateway-controllers main (4f1520a8)
  • Gateway versions: 1.1.0 (patched), 1.2.0 and latest (main-59dcd51)
Lingua principale
Go
Stelle
85
Fork
137
Merge medio
1g 12h
PR unite (30g)
247

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

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 wso2/api-platform

Tutte le issue di wso2/api-platform

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.