Skip to content

Commit e045a7d

Browse files
jhuleattbkendall
andauthored
fix(init hosting:github): add authAdmin role to service account (#2736)
* Add authAdmin role * changelog Co-authored-by: Bryan Kendall <[email protected]>
1 parent 5f5460b commit e045a7d

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
- Fixes issue when running in a Node 8 environment where `URL` was not defined. (#2817)
22
- Sets `FIREBASE_AUTH_EMULATOR_HOST` in `emulators:exec`.
3+
- Updates roles for Firebase Hosting's channels GitHub action to allow the action to update authorized domains.

src/gcp/resourceManager.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import { Binding, getServiceAccount, Policy } from "./iam";
44

55
const API_VERSION = "v1";
66

7+
// Roles listed at https://firebase.google.com/docs/projects/iam/roles-predefined-product
78
export const firebaseRoles = {
8-
hostingAdmin: "roles/firebasehosting.admin",
99
apiKeysViewer: "roles/serviceusage.apiKeysViewer",
10+
authAdmin: "roles/firebaseauth.admin",
11+
hostingAdmin: "roles/firebasehosting.admin",
1012
runViewer: "roles/run.viewer",
1113
};
1214

src/init/features/hosting/github.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,11 +543,19 @@ async function createServiceAccountAndKey(
543543
}
544544
}
545545

546-
// The roles for the service account.
547-
// https://firebase.google.com/docs/projects/iam/roles-predefined-product#hosting
546+
// Service account roles
548547
const requiredRoles = [
549-
firebaseRoles.hostingAdmin,
548+
// Required to add preview URLs to Auth authorized domains
549+
// https://github.com/firebase/firebase-tools/issues/2732
550+
firebaseRoles.authAdmin,
551+
552+
// Required for CLI deploys
550553
firebaseRoles.apiKeysViewer,
554+
555+
// Required to deploy preview channels
556+
firebaseRoles.hostingAdmin,
557+
558+
// Required for projects that use Hosting rewrites to Cloud Run
551559
firebaseRoles.runViewer,
552560
];
553561
await addServiceAccountToRoles(options.projectId, accountId, requiredRoles);

0 commit comments

Comments
 (0)