[Bug]: An immutable gateway accepts and serves deployments from the control plane
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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-apison 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 reachesDEPLOYED, and the gateway'sGET /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 handlesapi.deployedand the other deploy events (pkg/controlplane/client.go:1465onwards) 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
- Start a gateway with SQLite storage and
[immutable_gateway] enabled = true, connected to platform-api. - Create a REST API in the control plane and deploy it to that gateway.
- The deployment shows
DEPLOYED, and the gateway serves the API. - 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.
- Dominant language
- Go
- Stars
- 85
- Forks
- 137
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 247
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from wso2/api-platform
-
Area/DeveloperPortal Aspect/UI Severity/Minor Type/Bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
wso2/api-platform#4369 ·
Maintainers usually reply within 1 day
-
[Bug]: host-rewrite policy documentation lists fewer allowed host characters than the policy acceptsOpenArea/Policies Aspect/Other Severity/Trivial Type/Bug
Difficulty 1/5 Under an hour Newbie friendliness 91/100
wso2/api-platform#4355 ·
Maintainers usually reply within 1 day
-
Area/Gateway Aspect/API Severity/Minor Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
wso2/api-platform#4348 ·
Maintainers usually reply within 1 day
-
Aspect/AI Aspect/API. Severity/Major
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
wso2/api-platform#4343 ·
Maintainers usually reply within 1 day
-
Area/Policies Aspect/Configuration Severity/Minor Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
wso2/api-platform#4330 ·
Maintainers usually reply within 1 day
All issues in wso2/api-platform
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Inconsistency between golang and cue in specPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
security
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Tencent/LoopForge#1087 · 1 comment ·
Maintainers usually reply within 1 day