Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infra/gcp/main: give tf bucket owners buckets.list #2005

Merged
merged 1 commit into from
May 6, 2021

Conversation

spiffxp
Copy link
Member

@spiffxp spiffxp commented May 6, 2021

This addresses #1974 (comment)

So apparently the only off-the-shelf roles that grant storage.buckets.list are:

  • roles/storage.admin
  • roles/owner
  • roles/editor
  • roles/viewer

We're trying to follow the principle of least-privilege for the k8s-infra-tf-* buckets. Unfortunately none of the basic roles like roles/viewer can be applied directly to a bucket.

This leaves us with either:

  • roles/viewer on the project hosting the buckets
  • roles/storage.admin directly on the buckets

The latter would grant the following addition permissions compared to the existing set of roles/storage.legacyBucketOwner + roles/storage.objectAdmin:

  • storage.buckets.create - doesn't matter for a single bucket
  • storage.buckets.delete - this might be concerning for some buckets
  • storage.buckets.list - this is what we want

The reason delete might be concerning is if someone accidentally deleted a very public, very hardcoded bucket (e.g. the k8s.gcr.io GCS buckets) just long enough for another project to create a bucket with the now-available name, thus stealing ownership of a very critical asset. (ref: https://cloud.google.com/storage/docs/naming-buckets#considerations)

So as much as I would like to default to roles/storage.admin on specific buckets instead of a combination of legacy roles on buckets and projects, I'm not yet prepared to make that call for all of our GCS buckets.

Thus, we're left with assigning roles/viewer on the project hosting the bucket.

So apparently the only off-the-shelf roles that grant
`storage.buckets.list` are:

- `roles/storage.admin`
- `roles/owner`
- `roles/editor`
- `roles/viewer`

We're trying to follow the principle of least-privilege for the
`k8s-infra-tf-*` buckets. Unfortunately none of the basic roles
like `roles/viewer` can be applied directly to a bucket.

This leaves us with either:
- `roles/viewer` on the project hosting the buckets
- `roles/storage.admin` directly on the buckets

The latter would grant the following addition permissions compared to
the existing set of `roles/storage.legacyBucketOwner` +
`roles/storage.objectAdmin`:

- `storage.buckets.create` - doesn't matter for a single bucket
- `storage.buckets.delete` - this might be concerning for some buckets
- `storage.buckets.list` - this is what we want

The reason delete might be concerning is if someone accidentally deleted
a very public, very hardcoded bucket (e.g. the k8s.gcr.io GCS buckets)
just long enough for another project to create a bucket with the
now-available name, thus stealing ownership of a very critical asset.

ref: https://cloud.google.com/storage/docs/naming-buckets#considerations

So as much as I would like to default to `roles/storage.admin` on
specific buckets instead of a combination of legacy roles on buckets
and projects, I'm not yet prepared to make that call for all of our
GCS buckets.

Thus, we're left with assigning `roles/viewer` on the project hosting
the bucket.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 6, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: spiffxp

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested review from nikhita and thockin May 6, 2021 00:15
@k8s-ci-robot k8s-ci-robot added wg/k8s-infra size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels May 6, 2021
@spiffxp
Copy link
Member Author

spiffxp commented May 6, 2021

/cc @ameukam

@spiffxp
Copy link
Member Author

spiffxp commented May 6, 2021

Opened #2007 as followup to research if there's a better alternative

@ameukam
Copy link
Member

ameukam commented May 6, 2021

/lgtm
/hold
hold cancel when you are to deploy.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 6, 2021
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 6, 2021
@spiffxp
Copy link
Member Author

spiffxp commented May 6, 2021

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 6, 2021
@k8s-ci-robot k8s-ci-robot merged commit 7290595 into kubernetes:main May 6, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.22 milestone May 6, 2021
@spiffxp spiffxp deleted the viewer-tf-buckets branch May 6, 2021 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants