cloudnative-pg / cloudnative-pg/plugin-barman-cloud

IAM-backed ObjectStores generate wildcard Secret RBAC

Đang mở
#892 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Go
Star
191
Fork
72
Merge trung bình
2 ngày 21 giờ
Pull request đã merge (30 ngày)
21

Mô tả

### Summary

When an `ObjectStore` uses AWS IAM role inheritance (`inheritFromIAMRole: true`) and does not reference any credential Secrets, the generated `-barman-cloud` Role still contains a `secrets` rule with no `resourceNames`.

In Kubernetes RBAC, an omitted or empty `resourceNames` list does not restrict the rule to no objects; it allows the verbs on all resources of that type. As a result, an IAM-backed barman-cloud instance can get/list/watch every Secret in the namespace even though barman-cloud does not need any Secret for the AWS credential chain.

### Why this matters

Deployments using IRSA, pod identity, or IMDS typically set `inheritFromIAMRole: true` so barman-cloud gets credentials from the pod environment. In that mode, barman-cloud returns before reading AWS credential Secret references, so the plugin should not grant Secret access unless a credential Secret is actually needed.

### Expected behavior

If no credential Secret names are collected for the ObjectStores referenced by a cluster, the generated Role should not include a `secrets` rule. For AWS credentials with `inheritFromIAMRole: true`, AWS Secret references should be ignored the same way Azure default/managed identity credentials are ignored today.

### Actual behavior

The Role includes a `secrets` rule with an empty `resourceNames` field, which grants access to all Secrets in the namespace.

### Proposed fix

- Skip AWS credential Secret references when `inheritFromIAMRole` is true.
- Omit the generated `secrets` PolicyRule when the collected Secret name set is empty.
- Keep the existing scoped `secrets` rule when explicit credential Secret refs are present.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu từ các đường dẫn tạo Role và thu thập tham chiếu thông tin xác thực AWS, sau đó so sánh chúng với cách xử lý hiện có đối với danh tính Azure mặc định/quản lý. Xác minh trường hợp kế thừa IAM và trường hợp Secret thông tin xác thực được chỉ rõ, đồng thời thêm hoặc cập nhật các bài kiểm thử để điều kiện hoàn tất là không có quy tắc Secret cho một tập hợp trống và có một quy tắc có phạm vi khi có tên Secret.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
aws, go, kubernetes
Lĩnh vực
authorization, backend, security
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
64/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.