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.75%
=======================================
Files ? 608
Lines ? 39158
Branches ? 7846
=======================================
Hits ? 22617
Misses ? 14732
Partials ? 1809 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@IzaakGough , I think the CI results are out. Please let me know if there are any further actions required from me. |
|
I'm going to assign @joehan as a reviewer since he's more familiar with our internal API review process. Could you also add a changelog entry for this? Thanks again for the contribution! |
|
@aalej , I have added the changelog entry as requested. |
joehan
left a comment
There was a problem hiding this comment.
Looks good to me (with some minor suggestions). I'll kick off the internal API review for this - it may take a little while to resolve, but i'll make sure this gets merged in once it is completed.
|
@joehan , Thank you for the review. I have added the suggestions. |
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