Use privileged service account for exportData - #314
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the exportData Cloud Function to run under the privileged service account, aligning it with other admin/owner operations that require elevated permissions in this codebase and addressing recent export failures.
Changes:
- Import
privilegedServiceAccountintoexportData. - Pass
serviceAccount: privilegedServiceAccounttovalidatedOnCalloptions forexportData.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
functions/src/functions/exportData.ts (1)
63-65: Document why this function must run as privileged.Please add a short inline comment here explaining the required permission/capability for
exportDataso this doesn’t get unintentionally reverted again.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@functions/src/functions/exportData.ts` around lines 63 - 65, Add an inline comment above the serviceAccount assignment explaining that exportData must run with privilegedServiceAccount because exportData performs cross-project/storage/admin operations (reads/writes and creates export buckets or service logs) that require elevated IAM roles (e.g., storage.admin or bigquery.admin) and cannot run under the default least-privilege runtime; reference exportData and privilegedServiceAccount so future reviewers understand this intent and avoid reverting to a non-privileged account.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@functions/src/functions/exportData.ts`:
- Around line 63-65: Add an inline comment above the serviceAccount assignment
explaining that exportData must run with privilegedServiceAccount because
exportData performs cross-project/storage/admin operations (reads/writes and
creates export buckets or service logs) that require elevated IAM roles (e.g.,
storage.admin or bigquery.admin) and cannot run under the default
least-privilege runtime; reference exportData and privilegedServiceAccount so
future reviewers understand this intent and avoid reverting to a non-privileged
account.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4c3702f7-073a-45b1-86a2-2535c4328e6e
📒 Files selected for processing (1)
functions/src/functions/exportData.ts
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #314 +/- ##
=======================================
Coverage 82.72% 82.72%
=======================================
Files 93 93
Lines 3836 3836
Branches 976 979 +3
=======================================
Hits 3173 3173
Misses 656 656
Partials 7 7
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Use privileged service account for exportData
♻️ Current situation & Problem
The exportData function is still failing and apparently used the privileged service account even before. No idea why it was moved down then... It should hopefully resolve the remaining issue.
Code of Conduct & Contributing Guidelines
By creating and submitting this pull request, you agree to follow our Code of Conduct and Contributing Guidelines: