Skip to content

Commit 4632965

Browse files
committed
fix: address PostgREST PR review feedback (PLAT-499/500/501/502/503)
Move credential handling out of container env vars into postgrest.conf via db-uri. Environment variables are visible to all users on the host via docker inspect and /proc; the config file is restricted to the service user (mode 0600). Move config file generation to PostgRESTServiceConfig.GenerateConf in the database package, where it belongs alongside the type it serializes. PostgRESTConnParams carries the runtime connection details (host, port, credentials) separately from the user-supplied PostgRESTServiceConfig. Fix merge conflict resolution in service_user_role.go: remove the duplicate MCP code block that was left in and drop DBOwner: false to align with the upstream change in main. Implement Update() for PostgREST ServiceUserRole to reconcile DBAnonRole changes at runtime. Queries pg_auth_members for stale role memberships, revokes them, and re-applies the desired grants idempotently. Without this, a DBAnonRole change would leave the authenticator role unable to SET ROLE to the new anon role. Add REVOKE CONNECT ON DATABASE before DROP ROLE in Delete() for PostgREST service users. PostgreSQL refuses to drop a role that holds database privileges, causing the DROP to fail silently. Revoking first ensures clean deletion.
1 parent 069f53b commit 4632965

208 files changed

Lines changed: 13772 additions & 2569 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ commands:
4242
common_setup:
4343
steps:
4444
- go/install:
45-
version: '1.25.5'
45+
version: '1.25.8'
4646
- checkout
4747
- use_mod_cache
4848
- run:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ docs/plans
2121
*-results.xml
2222
dist
2323
control-plane
24+
pgedge-control-plane
2425
!docker/control-plane
2526
e2e/debug

.goreleaser.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: 2
2-
project_name: control-plane
2+
project_name: pgedge-control-plane
33
builds:
44
- main: ./server
5-
binary: control-plane
5+
binary: pgedge-control-plane
66
env:
77
- CGO_ENABLED=0
88
goos:

.trivyignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Docker client SDK v27 — these CVEs are in the Docker daemon, not the
2+
# Go client library. No Docker plugins are used in this project.
3+
CVE-2026-34040
4+
CVE-2026-33997

Makefile

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LOG_LEVEL ?= info
77
DEV_IMAGE_REPO ?= ghcr.io/pgedge
88
CONTROL_PLANE_IMAGE_REPO ?= host.docker.internal:5000/control-plane
99
TEST_RERUN_FAILS ?= 0
10+
TEST_DISABLE_CACHE ?= 0
1011
E2E_FIXTURE ?=
1112
E2E_PARALLEL ?= 8
1213
E2E_RUN ?=
@@ -23,9 +24,10 @@ CLUSTER_TEST_SKIP_CLEANUP ?= 0
2324
CLUSTER_TEST_IMAGE_TAG ?=
2425
CLUSTER_TEST_DATA_DIR ?=
2526

27+
ci_enabled=$(filter true,$(CI))
2628
docker_swarm_state=$(shell docker info --format '{{.Swarm.LocalNodeState}}')
27-
buildx_builder=$(if $(CI),"control-plane-ci","control-plane")
28-
buildx_config=$(if $(CI),"./buildkit.ci.toml","./buildkit.toml")
29+
buildx_builder=$(if $(ci_enabled),"control-plane-ci","control-plane")
30+
buildx_config=$(if $(ci_enabled),"./buildkit.ci.toml","./buildkit.toml")
2931
docker_compose_dev=WORKSPACE_DIR=$(shell pwd) \
3032
DEBUG=$(DEBUG) \
3133
LOG_LEVEL=$(LOG_LEVEL) \
@@ -50,13 +52,16 @@ cluster_test_args=-tags=cluster_test -count=1 -timeout=10m \
5052
$(if $(CLUSTER_TEST_IMAGE_TAG),-image-tag $(CLUSTER_TEST_IMAGE_TAG)) \
5153
$(if $(CLUSTER_TEST_DATA_DIR),-data-dir $(CLUSTER_TEST_DATA_DIR))
5254

55+
test_disable_cache=$(if $(filter 1,$(TEST_DISABLE_CACHE)),-count=1)
56+
workflows_backend_skip=-skip=Test_EtcdBackendE2E/AutoExpiration/StartsWorkflowAndRemoves
57+
5358
# Automatically adds junit output named after the rule, e.g.
5459
# 'test-e2e-results.xml' in CI environment.
5560
gotestsum=$(gobin)/gotestsum \
56-
$(if $(filter true,$(CI)),--junitfile $@-results.xml)
61+
$(if $(ci_enabled),--junitfile $@-results.xml)
5762

5863
golangci-lint=$(gobin)/golangci-lint \
59-
$(if $(filter true,$(CI)),--output.text.path stdout --output.junit-xml.path $@-results.xml)
64+
$(if $(ci_enabled),--output.text.path stdout --output.junit-xml.path $@-results.xml)
6065

6166
.DEFAULT_GOAL := build
6267

@@ -69,7 +74,9 @@ test:
6974
$(gotestsum) \
7075
--format-hide-empty-pkg \
7176
--rerun-fails=$(TEST_RERUN_FAILS) \
72-
--packages='./...'
77+
--packages='./...' \
78+
-- \
79+
$(test_disable_cache)
7380

7481
.PHONY: test-etcd
7582
test-etcd-lifecycle:
@@ -78,16 +85,25 @@ test-etcd-lifecycle:
7885
--rerun-fails=$(TEST_RERUN_FAILS) \
7986
--packages='./server/internal/etcd/...' \
8087
-- \
88+
$(test_disable_cache) \
8189
-tags=etcd_lifecycle_test
8290

91+
# We skip StartsWorkflowAndRemoves because it contains a race condition that's
92+
# much more prevalent now that we're executing workflows more quickly. This test
93+
# uses the "autoexpire" feature to remove workflows that are older than 1
94+
# millisecond. It starts a workflow, waits for the result, and then waits for
95+
# the workflow to be removed. Occasionally, the workflow gets removed while the
96+
# "waiting for result" step is still polling the workflow status.
8397
.PHONY: test-workflows-backend
8498
test-workflows-backend:
8599
$(gotestsum) \
86100
--format-hide-empty-pkg \
87101
--rerun-fails=$(TEST_RERUN_FAILS) \
88102
--packages='./server/internal/workflows/backend/etcd/...' \
89103
-- \
90-
-tags=workflows_backend_test
104+
$(test_disable_cache) \
105+
-tags=workflows_backend_test \
106+
$(workflows_backend_skip)
91107

92108
.PHONY: test-ci
93109
test-ci:
@@ -97,7 +113,9 @@ test-ci:
97113
--rerun-fails=$(TEST_RERUN_FAILS) \
98114
--packages='./...' \
99115
-- \
100-
-tags=workflows_backend_test,etcd_lifecycle_test
116+
-count=1 \
117+
-tags=workflows_backend_test,etcd_lifecycle_test \
118+
$(workflows_backend_skip)
101119

102120
.PHONY: test-e2e
103121
test-e2e:
@@ -257,12 +275,12 @@ control-plane-images:
257275
goreleaser-build:
258276
GORELEASER_CURRENT_TAG=$(CONTROL_PLANE_VERSION) \
259277
$(goreleaser) build --snapshot --clean
260-
tar -C dist/control-plane_linux_amd64_v1 -c -z \
261-
-f dist/control-plane_$(CONTROL_PLANE_VERSION:v%=%)_linux_amd64.tar.gz \
262-
control-plane
263-
tar -C dist/control-plane_linux_arm64_v8.0 -c -z \
264-
-f dist/control-plane_$(CONTROL_PLANE_VERSION:v%=%)_linux_arm64.tar.gz \
265-
control-plane
278+
tar -C dist/pgedge-control-plane_linux_amd64_v1 -c -z \
279+
-f dist/pgedge-control-plane_$(CONTROL_PLANE_VERSION:v%=%)_linux_amd64.tar.gz \
280+
pgedge-control-plane
281+
tar -C dist/pgedge-control-plane_linux_arm64_v8.0 -c -z \
282+
-f dist/pgedge-control-plane_$(CONTROL_PLANE_VERSION:v%=%)_linux_arm64.tar.gz \
283+
pgedge-control-plane
266284

267285
goreleaser-test-release:
268286
GORELEASER_CURRENT_TAG=$(CONTROL_PLANE_VERSION) \
@@ -331,7 +349,7 @@ build: dev-build
331349
dev-build:
332350
GOOS=linux go build \
333351
-gcflags "all=-N -l" \
334-
-o docker/control-plane-dev/control-plane \
352+
-o docker/control-plane-dev/pgedge-control-plane \
335353
$(shell pwd)/server
336354

337355
.PHONY: docker-swarm-init
@@ -396,7 +414,7 @@ api-docs:
396414
ci-compose-build:
397415
GOOS=linux go build \
398416
-gcflags "all=-N -l" \
399-
-o docker/control-plane-ci/control-plane \
417+
-o docker/control-plane-ci/pgedge-control-plane \
400418
$(shell pwd)/server
401419

402420
.PHONY: ci-compose-detached

NOTICE.txt

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
436436
## github.com/containerd/containerd/pkg/userns
437437

438438
* Name: github.com/containerd/containerd/pkg/userns
439-
* Version: v1.7.27
440-
* License: [Apache-2.0](https://github.com/containerd/containerd/blob/v1.7.27/LICENSE)
439+
* Version: v1.7.29
440+
* License: [Apache-2.0](https://github.com/containerd/containerd/blob/v1.7.29/LICENSE)
441441

442442
```
443443

@@ -12557,8 +12557,8 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
1255712557
## go.opentelemetry.io/otel
1255812558

1255912559
* Name: go.opentelemetry.io/otel
12560-
* Version: v1.38.0
12561-
* License: [Apache-2.0](https://github.com/open-telemetry/opentelemetry-go/blob/v1.38.0/LICENSE)
12560+
* Version: v1.40.0
12561+
* License: [Apache-2.0](https://github.com/open-telemetry/opentelemetry-go/blob/v1.40.0/LICENSE)
1256212562

1256312563
```
1256412564
Apache License
@@ -12797,8 +12797,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1279712797
## go.opentelemetry.io/otel
1279812798

1279912799
* Name: go.opentelemetry.io/otel
12800-
* Version: v1.38.0
12801-
* License: [BSD-3-Clause](https://github.com/open-telemetry/opentelemetry-go/blob/v1.38.0/LICENSE)
12800+
* Version: v1.40.0
12801+
* License: [BSD-3-Clause](https://github.com/open-telemetry/opentelemetry-go/blob/v1.40.0/LICENSE)
1280212802

1280312803
```
1280412804
Apache License
@@ -13459,8 +13459,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1345913459
## go.opentelemetry.io/otel/metric
1346013460

1346113461
* Name: go.opentelemetry.io/otel/metric
13462-
* Version: v1.38.0
13463-
* License: [Apache-2.0](https://github.com/open-telemetry/opentelemetry-go/blob/metric/v1.38.0/metric/LICENSE)
13462+
* Version: v1.40.0
13463+
* License: [Apache-2.0](https://github.com/open-telemetry/opentelemetry-go/blob/metric/v1.40.0/metric/LICENSE)
1346413464

1346513465
```
1346613466
Apache License
@@ -13699,8 +13699,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1369913699
## go.opentelemetry.io/otel/metric
1370013700

1370113701
* Name: go.opentelemetry.io/otel/metric
13702-
* Version: v1.38.0
13703-
* License: [BSD-3-Clause](https://github.com/open-telemetry/opentelemetry-go/blob/metric/v1.38.0/metric/LICENSE)
13702+
* Version: v1.40.0
13703+
* License: [BSD-3-Clause](https://github.com/open-telemetry/opentelemetry-go/blob/metric/v1.40.0/metric/LICENSE)
1370413704

1370513705
```
1370613706
Apache License
@@ -13939,8 +13939,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1393913939
## go.opentelemetry.io/otel/sdk
1394013940

1394113941
* Name: go.opentelemetry.io/otel/sdk
13942-
* Version: v1.38.0
13943-
* License: [Apache-2.0](https://github.com/open-telemetry/opentelemetry-go/blob/sdk/v1.38.0/sdk/LICENSE)
13942+
* Version: v1.40.0
13943+
* License: [Apache-2.0](https://github.com/open-telemetry/opentelemetry-go/blob/sdk/v1.40.0/sdk/LICENSE)
1394413944

1394513945
```
1394613946
Apache License
@@ -14179,8 +14179,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1417914179
## go.opentelemetry.io/otel/sdk
1418014180

1418114181
* Name: go.opentelemetry.io/otel/sdk
14182-
* Version: v1.38.0
14183-
* License: [BSD-3-Clause](https://github.com/open-telemetry/opentelemetry-go/blob/sdk/v1.38.0/sdk/LICENSE)
14182+
* Version: v1.40.0
14183+
* License: [BSD-3-Clause](https://github.com/open-telemetry/opentelemetry-go/blob/sdk/v1.40.0/sdk/LICENSE)
1418414184

1418514185
```
1418614186
Apache License
@@ -14419,8 +14419,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1441914419
## go.opentelemetry.io/otel/trace
1442014420

1442114421
* Name: go.opentelemetry.io/otel/trace
14422-
* Version: v1.38.0
14423-
* License: [Apache-2.0](https://github.com/open-telemetry/opentelemetry-go/blob/trace/v1.38.0/trace/LICENSE)
14422+
* Version: v1.40.0
14423+
* License: [Apache-2.0](https://github.com/open-telemetry/opentelemetry-go/blob/trace/v1.40.0/trace/LICENSE)
1442414424

1442514425
```
1442614426
Apache License
@@ -14659,8 +14659,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1465914659
## go.opentelemetry.io/otel/trace
1466014660

1466114661
* Name: go.opentelemetry.io/otel/trace
14662-
* Version: v1.38.0
14663-
* License: [BSD-3-Clause](https://github.com/open-telemetry/opentelemetry-go/blob/trace/v1.38.0/trace/LICENSE)
14662+
* Version: v1.40.0
14663+
* License: [BSD-3-Clause](https://github.com/open-telemetry/opentelemetry-go/blob/trace/v1.40.0/trace/LICENSE)
1466414664

1466514665
```
1466614666
Apache License
@@ -15376,8 +15376,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1537615376
## golang.org/x/sys/unix
1537715377

1537815378
* Name: golang.org/x/sys/unix
15379-
* Version: v0.39.0
15380-
* License: [BSD-3-Clause](https://cs.opensource.google/go/x/sys/+/v0.39.0:LICENSE)
15379+
* Version: v0.40.0
15380+
* License: [BSD-3-Clause](https://cs.opensource.google/go/x/sys/+/v0.40.0:LICENSE)
1538115381

1538215382
```
1538315383
Copyright 2009 The Go Authors.
@@ -15450,8 +15450,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1545015450
## golang.org/x/time/rate
1545115451

1545215452
* Name: golang.org/x/time/rate
15453-
* Version: v0.9.0
15454-
* License: [BSD-3-Clause](https://cs.opensource.google/go/x/time/+/v0.9.0:LICENSE)
15453+
* Version: v0.12.0
15454+
* License: [BSD-3-Clause](https://cs.opensource.google/go/x/time/+/v0.12.0:LICENSE)
1545515455

1545615456
```
1545715457
Copyright 2009 The Go Authors.
@@ -15556,8 +15556,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1555615556
## google.golang.org/genproto/googleapis/api
1555715557

1555815558
* Name: google.golang.org/genproto/googleapis/api
15559-
* Version: v0.0.0-20251022142026-3a174f9686a8
15560-
* License: [Apache-2.0](https://github.com/googleapis/go-genproto/blob/3a174f9686a8/googleapis/api/LICENSE)
15559+
* Version: v0.0.0-20251202230838-ff82c1b0f217
15560+
* License: [Apache-2.0](https://github.com/googleapis/go-genproto/blob/ff82c1b0f217/googleapis/api/LICENSE)
1556115561

1556215562
```
1556315563

@@ -15980,8 +15980,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1598015980
## google.golang.org/grpc
1598115981

1598215982
* Name: google.golang.org/grpc
15983-
* Version: v1.77.0
15984-
* License: [Apache-2.0](https://github.com/grpc/grpc-go/blob/v1.77.0/LICENSE)
15983+
* Version: v1.79.3
15984+
* License: [Apache-2.0](https://github.com/grpc/grpc-go/blob/v1.79.3/LICENSE)
1598515985

1598615986
```
1598715987

api/apiv1/design/database.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,6 @@ var Database = g.Type("Database", func() {
670670
"deleting",
671671
"degraded",
672672
"failed",
673-
"backing_up",
674673
"restoring",
675674
"unknown",
676675
)

api/apiv1/gen/http/openapi.json

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/apiv1/gen/http/openapi.yaml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)