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

Abierto Apto para principiantes
#4,330 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
74/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, yaml
Área
api, backend

Línea de trabajo

Encuentra el esquema de la política content-length-guardrail y compara sus parámetros de respuesta con el parámetro de cadena documentado streamingJsonPath y el ejemplo word-count-guardrail. Revisa la suite de integración mencionada en wso2/gateway-controllers#415 para entender el comportamiento actual al crear APIs. El trabajo estará completo cuando la creación de APIs rechace un valor de streamingJsonPath que no sea una cadena con HTTP 400, de forma coherente con jsonPath.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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)
Lenguaje dominante
Go
Estrellas
85
Forks
137
Merge medio
1 d 12 h
PR fusionados (30 d)
247

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de wso2/api-platform

Todos los issues de wso2/api-platform

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.