-
Notifications
You must be signed in to change notification settings - Fork 778
feat: add confidential space #1435
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
feat: add confidential space #1435
Conversation
* Adds Confidential Space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @renato-rudnicki - I'll defer to others on the intended functionality.
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces support for Google Cloud Confidential Space by adding a new Terraform module and updating existing configurations across various stages of the infrastructure deployment. The changes are comprehensive, covering IAM, networking, project setup, and integration tests. My review highlights several opportunities to enhance security by adhering more closely to the principle of least privilege, particularly by reducing overly permissive IAM roles such as roles/storage.admin
and roles/artifactregistry.admin
. Additionally, I've identified areas to improve the robustness and maintainability of the Terraform code by addressing fragile logic, redundant retries, and dependency management. Minor corrections in documentation and scripts are also suggested.
locals { | ||
repo_names = ["bu1-example-app"] | ||
repo_names = ["bu1-example-app"] | ||
cmd_prompt = "gcloud builds submit . --tag ${local.confidential_space_image_tag} --project=${local.cloudbuild_project_id} --service-account=projects/${local.cloudbuild_project_id}/serviceAccounts/tf-cb-builder-sa@${local.cloudbuild_project_id}.iam.gserviceaccount.com --gcs-log-dir=gs://${module.infra_pipelines[0].log_buckets["bu1-example-app"]} --worker-pool=${local.cloud_build_private_worker_pool_id} || ( sleep 46 && gcloud builds submit . --tag ${local.confidential_space_image_tag} --project=${local.cloudbuild_project_id} --service-account=projects/${local.cloudbuild_project_id}/serviceAccounts/tf-cb-builder-sa@${local.cloudbuild_project_id}.iam.gserviceaccount.com --gcs-log-dir=gs://${module.infra_pipelines[0].log_buckets["bu1-example-app"]} --worker-pool=${local.cloud_build_private_worker_pool_id})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
|
||
create_cmd_entrypoint = "bash" | ||
create_cmd_body = "${local.cmd_prompt} || ( sleep 45 && ${local.cmd_prompt})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"roles/iam.serviceAccountUser", | ||
"roles/confidentialcomputing.workloadUser", | ||
"roles/iam.workloadIdentityPoolAdmin", | ||
"roles/storage.admin", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The iam_roles
list for the workload service account includes roles/storage.admin
. This is a highly permissive role. Please consider if a more scoped-down role like roles/storage.objectAdmin
or more granular roles (objectCreator
, objectViewer
) would be sufficient to adhere to the principle of least privilege.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @renato-rudnicki!
This PR adds a new module for confidential space workspace. The module creates a single project with an instance using a confidential image to run into the confidential space.