[Bug]: An immutable gateway accepts and serves deployments from the control plane

Abierto
#4,160 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
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, sqlite
Área
api, backend

Línea de trabajo

Read gateway/gateway-controller/pkg/immutable/loader.go and the control-plane handling around pkg/controlplane/client.go:532 and :1465. Trace how immutable mode affects deployment events and startup sync, then check the relevant deployment tests. Done means control-plane deployments are rejected with a clear failure reason and are not restored or served after a restart.

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

Descripción

Area/Gateway Area/Platform-API Aspect/Configuration Severity/Major Type/Bug
Please select the area the issue is related to

Gateway, Platform API

Please select the aspect the issue is related to

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

Description

An immutable gateway ([immutable_gateway] enabled = true) is meant to serve only the artifacts in its files, and it refuses changes through its REST API with 405. But a deployment made from the control plane is applied, served and reported back as a success. It is also restored on every restart, because the startup sync re-applies the control plane's deployments after the artifacts are loaded from files.

Observed

  • POST /rest-apis on the gateway: 405 {"status":"error","message":"Gateway is in immutable mode. Mutating operations are not allowed."}
  • A REST API created in the control plane and deployed to this gateway (POST /api/v0.9/rest-apis/{id}/deployments): the deployment reaches DEPLOYED, and the gateway's GET /rest-apis/{id} answers 200.
  • After restarting gateway-controller (which wipes its SQLite database), GET /rest-apis/{id} answers 200 again.

Expected
The immutable gateway rejects a deployment from the control plane, and the control plane shows the deployment as failed with a clear reason. The gateway serves only what its artifact files define.

Cause

  • Immutable mode is enforced only by the REST middleware (gateway/gateway-controller/pkg/immutable/loader.go:256). The control-plane client handles api.deployed and the other deploy events (pkg/controlplane/client.go:1465 onwards) without checking immutable mode.
  • The startup sync (pkg/controlplane/client.go:532, syncDeployments) doesn't check it either, so the control plane's deployments come back after every restart.
  • Platform-api has no notion of an immutable gateway, so it can't refuse the deployment itself.
Steps to Reproduce
  1. Start a gateway with SQLite storage and [immutable_gateway] enabled = true, connected to platform-api.
  2. Create a REST API in the control plane and deploy it to that gateway.
  3. The deployment shows DEPLOYED, and the gateway serves the API.
  4. Restart gateway-controller: the API is served again.
Severity Level of the Issue

Severity/Major (Important functionality is broken. Should be prioritized. Doesn't need immediate attention)

Environment Details (with versions)

Current main (0ee943ff4). Platform-api and gateway built from source and run by the IT suite (tests/framework), with the gateway on SQLite, on macOS with Rancher Desktop.

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.