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

IAM-backed ObjectStores generate wildcard Secret RBAC

オープン
#892 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
Go
スター
191
フォーク
72
平均マージ
2日 21時間
マージ済み PR(30日)
21

説明

### 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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Role の生成パスと AWS credential-reference の収集パスから始め、それらを既存の Azure のデフォルト ID/マネージド ID の処理と比較します。IAM 継承のケースと明示的な credential Secret のケースを検証し、空のコレクションに対しては Secret ルールがなく、Secret 名が存在する場合はスコープ付きルールがあることを完了条件とするよう、テストを追加または更新します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
aws, go, kubernetes
領域
authorization, backend, security
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
64/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。