feat: add apphosting secrets revokeaccess command#10669
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the apphosting:secrets:revokeaccess command, allowing users to revoke permissions on specified secrets for service accounts, users, or groups. It implements the underlying helper functions revokeSecretAccess and revokeEmailsSecretAccess along with their unit tests. The review feedback suggests robustly handling potential whitespace in comma-separated inputs (secret names and emails) by trimming them, and optimizing performance by parallelizing sequential asynchronous operations (such as secret existence checks and IAM binding revocations) using Promise.all.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10669 +/- ##
=======================================
Coverage ? 57.76%
=======================================
Files ? 608
Lines ? 39154
Branches ? 7845
=======================================
Hits ? 22619
Misses ? 14726
Partials ? 1809 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Description
Adds
apphosting:secrets:revokeaccess, the inverse command forapphosting:secrets:grantaccess.The command supports revoking Secret Manager access from either:
--backend--emailsFor backend revocation, this removes the selected backend service accounts from:
roles/secretmanager.secretAccessorroles/secretmanager.viewer(It intentionally preserves
roles/secretmanager.secretVersionManagerfor the App Hosting service agent because that permission is project/App Hosting service-agent scoped rather than backend-specific.)(However, it may be inaccurate, so It would be great if a reviewer could review this.)
Scenarios Tested
npx mocha src/apphosting/secrets/index.spec.tsnpm run test:compilenpm run lint:changed-filesnode lib/bin/firebase.js apphosting:secrets:revokeaccess ... --debugSample Commands
npx firebase apphosting:secrets:revokeaccess