feat(sa-key-rotator): add automated service account key rotation tool and playbook - #189
Merged
Conversation
- Add rotate_sa_keys.sh for in-memory SA key generation, Secret Manager upload, secret version destruction, and IAM key pruning - Add deploy.sh for single-command end-to-end Cloud Run Job and Cloud Scheduler deployment - Add Dockerfile container image definition - Add playbook documentation in README.md and key_rotation_playbook.md
…at copyable clips
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces an automated Service Account key rotation system for GCSFuse integration tests, including a Dockerfile, a deployment script, a playbook, and the core rotation script. The review feedback identifies two critical issues in the rotation script: a potential security vulnerability where the private key could be leaked to logs if key generation or parsing fails, and a safety concern where an empty active key ID could lead to the accidental deletion of all user-managed keys. Both comments are highly actionable and should be addressed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces the Service Account Key Rotator tool under
sa-key-rotator/for automating monthly IAM Service Account key rotation and Secret Manager synchronization for GCSFuse integration tests.Because IAM service account keys have a strict 90-day expiration lifetime, this tool automatically generates new keys in-memory on the 1st of every month, updates Secret Manager with the latest version, destroys older Secret Manager versions to avoid sprawl, and deletes older IAM keys to prevent quota exhaustion.
Key Features & Components
rotate_sa_keys.sh:SECRET_CONFIGSenv var with strict upfront validation.DRY_RUNmode (default) and auto-formatted summary tables using standardcolumnutility.deploy.sh:Dockerfile:google/cloud-sdk:alpinewithjqandutil-linux.README.md:Verification
rotate_sa_keys.shin dry-run mode acrossgcs-fuse-testandgcs-fuse-test-mltargets.deploy.sh.