firebase-tools-with-isolate 15.25.1 → 15.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ailogic/templates.js +124 -0
- package/lib/api.js +6 -2
- package/lib/appcheck/api.js +52 -0
- package/lib/appcheck/providers.js +240 -0
- package/lib/appcheck/services.js +135 -0
- package/lib/auth.js +33 -15
- package/lib/checkValidTargetFilters.js +1 -0
- package/lib/command.js +4 -1
- package/lib/commands/ailogic-templates-delete.js +53 -0
- package/lib/commands/ailogic-templates-get.js +33 -0
- package/lib/commands/ailogic-templates-list.js +49 -0
- package/lib/commands/ailogic-templates-lock.js +30 -0
- package/lib/commands/ailogic-templates-unlock.js +30 -0
- package/lib/commands/appcheck-apps-list.js +78 -0
- package/lib/commands/appcheck-debugtokens-create.js +2 -2
- package/lib/commands/appcheck-debugtokens-delete.js +2 -2
- package/lib/commands/appcheck-debugtokens-list.js +2 -2
- package/lib/commands/appcheck-prompts.js +55 -0
- package/lib/commands/appcheck-providers-get.js +73 -0
- package/lib/commands/appcheck-providers-list.js +67 -0
- package/lib/commands/appcheck-providers-set.js +96 -0
- package/lib/commands/appcheck-services-get.js +40 -0
- package/lib/commands/appcheck-services-list.js +52 -0
- package/lib/commands/appcheck-services-set.js +90 -0
- package/lib/commands/crashlytics-onboard-web.js +56 -0
- package/lib/commands/deploy.js +3 -0
- package/lib/commands/ext-export.js +75 -3
- package/lib/commands/firestore-locations.js +3 -1
- package/lib/commands/functions-kits-install.js +294 -0
- package/lib/commands/index.js +24 -0
- package/lib/commands/login.js +53 -6
- package/lib/config.js +1 -0
- package/lib/crashlytics/filters.js +12 -4
- package/lib/crashlytics/firebasetelemetry.js +36 -0
- package/lib/crashlytics/onboarding.js +41 -0
- package/lib/crashlytics/reports.js +2 -0
- package/lib/crashlytics/sourcemap.js +102 -12
- package/lib/crashlytics/types.js +8 -1
- package/lib/deploy/ailogic/index.js +19 -0
- package/lib/deploy/ailogic/prepare.js +78 -0
- package/lib/deploy/ailogic/release.js +60 -0
- package/lib/deploy/functions/backend.js +11 -1
- package/lib/deploy/functions/build.js +1 -1
- package/lib/deploy/functions/params.js +5 -1
- package/lib/deploy/functions/prepare.js +26 -13
- package/lib/deploy/functions/prompts.js +1 -1
- package/lib/deploy/functions/release/lifecycle.js +11 -0
- package/lib/deploy/functions/release/planner.js +5 -2
- package/lib/deploy/index.js +9 -0
- package/lib/emulator/controller.js +1 -0
- package/lib/emulator/downloadableEmulatorInfo.json +24 -24
- package/lib/emulator/functionsEmulator.js +3 -1
- package/lib/experiments.js +13 -0
- package/lib/extensions/checkProjectBilling.js +3 -73
- package/lib/extensions/export.js +47 -0
- package/lib/functions/env.js +20 -7
- package/lib/functions/projectConfig.js +19 -11
- package/lib/functions/python.js +1 -1
- package/lib/gcp/ailogic.js +70 -1
- package/lib/gcp/cloudbilling.js +74 -0
- package/lib/gcp/cloudlogging.js +54 -0
- package/lib/gcp/runv2.js +1 -0
- package/lib/management/apps.js +1 -2
- package/lib/mcp/onemcp/index.js +2 -1
- package/lib/mcp/onemcp/onemcp_server.js +38 -11
- package/lib/mcp/prompts/crashlytics/connect.js +1 -1
- package/lib/mcp/resources/guides/crashlytics_issues.js +3 -3
- package/lib/mcp/resources/guides/crashlytics_reports.js +32 -11
- package/lib/mcp/tool.js +5 -0
- package/lib/mcp/tools/crashlytics/notes.js +3 -3
- package/lib/mcp/tools/crashlytics/reports.js +2 -0
- package/lib/mcp/util/crashlytics/availability.js +54 -1
- package/lib/prompt.js +10 -1
- package/lib/requirePermissions.js +1 -1
- package/lib/serve/functions.js +1 -1
- package/lib/tsconfig.publish.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/schema/firebase-config.json +42 -3
- package/templates/init/functions/typescript/index-kit-migration.ts +49 -0
- package/templates/init/functions/typescript/index-kit.ts +35 -0
- package/lib/appcheck/prompts.js +0 -41
package/lib/command.js
CHANGED
|
@@ -20,6 +20,7 @@ const requireAuth_1 = require("./requireAuth");
|
|
|
20
20
|
const env_1 = require("./env");
|
|
21
21
|
const experiments = require("./experiments");
|
|
22
22
|
const warnings_1 = require("./extensions/warnings");
|
|
23
|
+
const prompt_1 = require("./prompt");
|
|
23
24
|
function isCommandModule(value) {
|
|
24
25
|
return typeof value === "function" && typeof value.load === "function";
|
|
25
26
|
}
|
|
@@ -160,12 +161,14 @@ class Command {
|
|
|
160
161
|
options.project = (0, utils_1.getInheritedOption)(options, "project");
|
|
161
162
|
if (!process.stdin.isTTY ||
|
|
162
163
|
(0, utils_1.getInheritedOption)(options, "nonInteractive") ||
|
|
163
|
-
(0, utils_1.getInheritedOption)(options, "json")
|
|
164
|
+
(0, utils_1.getInheritedOption)(options, "json") ||
|
|
165
|
+
(0, env_1.detectAIAgent)() !== "unknown") {
|
|
164
166
|
options.nonInteractive = true;
|
|
165
167
|
}
|
|
166
168
|
if ((0, utils_1.getInheritedOption)(options, "interactive")) {
|
|
167
169
|
options.nonInteractive = false;
|
|
168
170
|
}
|
|
171
|
+
(0, prompt_1.setNonInteractive)(!!options.nonInteractive);
|
|
169
172
|
if ((0, utils_1.getInheritedOption)(options, "debug")) {
|
|
170
173
|
options.debug = true;
|
|
171
174
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
6
|
+
const projectUtils_1 = require("../projectUtils");
|
|
7
|
+
const ailogic = require("../gcp/ailogic");
|
|
8
|
+
const clc = require("colorette");
|
|
9
|
+
const utils = require("../utils");
|
|
10
|
+
const prompt_1 = require("../prompt");
|
|
11
|
+
const error_1 = require("../error");
|
|
12
|
+
exports.command = new command_1.Command("ailogic:templates:delete <templateId>")
|
|
13
|
+
.description("delete a template")
|
|
14
|
+
.help(`deletes one deployed server prompt template after confirmation (skippable with --force).
|
|
15
|
+
|
|
16
|
+
<templateId> is the template's id, as shown in \`ailogic:templates:list\`. A locked template cannot be deleted; unlock it first with \`ailogic:templates:unlock\` (--force does not override a lock).
|
|
17
|
+
|
|
18
|
+
For example:
|
|
19
|
+
|
|
20
|
+
\`firebase ailogic:templates:delete my-template --force\``)
|
|
21
|
+
.option("-f, --force", "bypass confirmation prompt")
|
|
22
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
23
|
+
"firebasevertexai.templates.delete",
|
|
24
|
+
"serviceusage.services.get",
|
|
25
|
+
])
|
|
26
|
+
.action(async (templateId, options) => {
|
|
27
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
28
|
+
ailogic.assertValidTemplateId(templateId);
|
|
29
|
+
await ailogic.ensureAILogicApiEnabled(projectId, options);
|
|
30
|
+
const template = await ailogic.withTemplate404(templateId, () => ailogic.getTemplate(projectId, templateId));
|
|
31
|
+
if (template.locked) {
|
|
32
|
+
throw new error_1.FirebaseError(`The following templates are locked and cannot be deleted:\n\n ${templateId}\n\nUnlock them by running:\n\n firebase ailogic:templates:unlock <templateId>`);
|
|
33
|
+
}
|
|
34
|
+
const confirmed = await (0, prompt_1.confirm)({
|
|
35
|
+
message: `Are you sure you want to delete template ${clc.bold(templateId)}?`,
|
|
36
|
+
force: options.force,
|
|
37
|
+
nonInteractive: options.nonInteractive,
|
|
38
|
+
});
|
|
39
|
+
if (!confirmed) {
|
|
40
|
+
throw new error_1.FirebaseError("Command aborted.", { exit: 1 });
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
await ailogic.withTemplate404(templateId, () => ailogic.deleteTemplate(projectId, templateId, template.etag));
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
if ((0, error_1.getErrStatus)(err) === 409) {
|
|
47
|
+
throw new error_1.FirebaseError(`Template ${clc.bold(templateId)} was modified while awaiting confirmation. Re-run the command to delete its latest version.`);
|
|
48
|
+
}
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
utils.logSuccess(`Deleted template: ${clc.bold(templateId)}`);
|
|
52
|
+
return template;
|
|
53
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
6
|
+
const projectUtils_1 = require("../projectUtils");
|
|
7
|
+
const ailogic = require("../gcp/ailogic");
|
|
8
|
+
const templates_1 = require("../ailogic/templates");
|
|
9
|
+
const logger_1 = require("../logger");
|
|
10
|
+
exports.command = new command_1.Command("ailogic:templates:get <templateId>")
|
|
11
|
+
.description("print one template")
|
|
12
|
+
.help(`prints the full content of one deployed server prompt template.
|
|
13
|
+
|
|
14
|
+
<templateId> is the template's id, as shown in the first column of \`ailogic:templates:list\` (for templates deployed from files, the file path without the ${templates_1.PROMPT_FILE_EXT} extension, with '/' as '.').
|
|
15
|
+
|
|
16
|
+
For example:
|
|
17
|
+
|
|
18
|
+
\`firebase ailogic:templates:get my-template\``)
|
|
19
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
20
|
+
"firebasevertexai.templates.get",
|
|
21
|
+
"serviceusage.services.get",
|
|
22
|
+
])
|
|
23
|
+
.action(async (templateId, options) => {
|
|
24
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
25
|
+
ailogic.assertValidTemplateId(templateId);
|
|
26
|
+
if (!(await ailogic.isAILogicApiEnabled(projectId))) {
|
|
27
|
+
logger_1.logger.info("Firebase AI Logic is not enabled on this project.");
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const template = await ailogic.withTemplate404(templateId, () => ailogic.getTemplate(projectId, templateId));
|
|
31
|
+
logger_1.logger.info(template.templateString);
|
|
32
|
+
return template;
|
|
33
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
6
|
+
const projectUtils_1 = require("../projectUtils");
|
|
7
|
+
const ailogic = require("../gcp/ailogic");
|
|
8
|
+
const clc = require("colorette");
|
|
9
|
+
const logger_1 = require("../logger");
|
|
10
|
+
const Table = require("cli-table3");
|
|
11
|
+
const PREVIEW_LENGTH = 60;
|
|
12
|
+
const ELLIPSIS = "...";
|
|
13
|
+
exports.command = new command_1.Command("ailogic:templates:list")
|
|
14
|
+
.description("list deployed templates")
|
|
15
|
+
.help(`lists every deployed server prompt template with its id, display name, lock state, and a preview of its content. Use \`ailogic:templates:get <templateId>\` to print a template in full.`)
|
|
16
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
17
|
+
"firebasevertexai.templates.get",
|
|
18
|
+
"serviceusage.services.get",
|
|
19
|
+
])
|
|
20
|
+
.action(async (options) => {
|
|
21
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
22
|
+
if (!(await ailogic.isAILogicApiEnabled(projectId))) {
|
|
23
|
+
logger_1.logger.info("Firebase AI Logic is not enabled on this project.");
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
const templates = await ailogic.listTemplates(projectId);
|
|
27
|
+
if (templates.length === 0) {
|
|
28
|
+
logger_1.logger.info(clc.bold("No deployed templates found."));
|
|
29
|
+
return templates;
|
|
30
|
+
}
|
|
31
|
+
const table = new Table({
|
|
32
|
+
head: ["Template ID", "Display Name", "Locked", "Template Preview"],
|
|
33
|
+
style: { head: ["green"] },
|
|
34
|
+
});
|
|
35
|
+
for (const t of templates) {
|
|
36
|
+
const templateString = t.templateString ?? "";
|
|
37
|
+
const preview = templateString.length > PREVIEW_LENGTH
|
|
38
|
+
? templateString.substring(0, PREVIEW_LENGTH - ELLIPSIS.length) + ELLIPSIS
|
|
39
|
+
: templateString;
|
|
40
|
+
table.push([
|
|
41
|
+
clc.bold(ailogic.templateIdFromName(t.name)),
|
|
42
|
+
t.displayName || "",
|
|
43
|
+
t.locked ? "Yes" : "No",
|
|
44
|
+
preview.replace(/\r?\n/g, " "),
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
logger_1.logger.info(table.toString());
|
|
48
|
+
return templates;
|
|
49
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
6
|
+
const projectUtils_1 = require("../projectUtils");
|
|
7
|
+
const ailogic = require("../gcp/ailogic");
|
|
8
|
+
const clc = require("colorette");
|
|
9
|
+
const utils = require("../utils");
|
|
10
|
+
exports.command = new command_1.Command("ailogic:templates:lock <templateId>")
|
|
11
|
+
.description("lock a template")
|
|
12
|
+
.help(`locks one deployed server prompt template. A locked template cannot be updated or deleted (including by \`firebase deploy\`) until it is unlocked with \`ailogic:templates:unlock\`.
|
|
13
|
+
|
|
14
|
+
<templateId> is the template's id, as shown in \`ailogic:templates:list\`.
|
|
15
|
+
|
|
16
|
+
For example:
|
|
17
|
+
|
|
18
|
+
\`firebase ailogic:templates:lock my-template\``)
|
|
19
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
20
|
+
"firebasevertexai.templates.update",
|
|
21
|
+
"serviceusage.services.get",
|
|
22
|
+
])
|
|
23
|
+
.action(async (templateId, options) => {
|
|
24
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
25
|
+
ailogic.assertValidTemplateId(templateId);
|
|
26
|
+
await ailogic.ensureAILogicApiEnabled(projectId, options);
|
|
27
|
+
await ailogic.withTemplate404(templateId, () => ailogic.setTemplateLocked(projectId, templateId, true));
|
|
28
|
+
utils.logSuccess(`Locked template: ${clc.bold(templateId)}`);
|
|
29
|
+
return { templateId, locked: true };
|
|
30
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
6
|
+
const projectUtils_1 = require("../projectUtils");
|
|
7
|
+
const ailogic = require("../gcp/ailogic");
|
|
8
|
+
const clc = require("colorette");
|
|
9
|
+
const utils = require("../utils");
|
|
10
|
+
exports.command = new command_1.Command("ailogic:templates:unlock <templateId>")
|
|
11
|
+
.description("unlock a template")
|
|
12
|
+
.help(`unlocks one deployed server prompt template so it can be updated or deleted again.
|
|
13
|
+
|
|
14
|
+
<templateId> is the template's id, as shown in \`ailogic:templates:list\`.
|
|
15
|
+
|
|
16
|
+
For example:
|
|
17
|
+
|
|
18
|
+
\`firebase ailogic:templates:unlock my-template\``)
|
|
19
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
20
|
+
"firebasevertexai.templates.update",
|
|
21
|
+
"serviceusage.services.get",
|
|
22
|
+
])
|
|
23
|
+
.action(async (templateId, options) => {
|
|
24
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
25
|
+
ailogic.assertValidTemplateId(templateId);
|
|
26
|
+
await ailogic.ensureAILogicApiEnabled(projectId, options);
|
|
27
|
+
await ailogic.withTemplate404(templateId, () => ailogic.setTemplateLocked(projectId, templateId, false));
|
|
28
|
+
utils.logSuccess(`Unlocked template: ${clc.bold(templateId)}`);
|
|
29
|
+
return { templateId, locked: false };
|
|
30
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("colorette");
|
|
5
|
+
const Table = require("cli-table3");
|
|
6
|
+
const command_1 = require("../command");
|
|
7
|
+
const projectUtils_1 = require("../projectUtils");
|
|
8
|
+
const requireAuth_1 = require("../requireAuth");
|
|
9
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
10
|
+
const logger_1 = require("../logger");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
const apps_1 = require("../management/apps");
|
|
13
|
+
const api_1 = require("../appcheck/api");
|
|
14
|
+
const providers_1 = require("../appcheck/providers");
|
|
15
|
+
function appIdFromConfigName(name) {
|
|
16
|
+
return name?.split("/apps/")[1]?.split("/")[0] ?? "";
|
|
17
|
+
}
|
|
18
|
+
exports.command = new command_1.Command("appcheck:apps:list")
|
|
19
|
+
.description("list apps with their App Check attestation providers")
|
|
20
|
+
.help(`shows every app in the project with the App Check providers that are set up for it.
|
|
21
|
+
|
|
22
|
+
Use this to see which apps are ready before turning enforcement on with \`appcheck:services:set\`.
|
|
23
|
+
|
|
24
|
+
App Attest and Play Integrity are left out of the Providers column: they have no key or secret to register, so the API cannot say whether an app really uses them. Use \`appcheck:providers:list --app <appId>\` to see their settings.`)
|
|
25
|
+
.before(requireAuth_1.requireAuth)
|
|
26
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
27
|
+
"firebaseappcheck.appAttestConfig.get",
|
|
28
|
+
"firebaseappcheck.deviceCheckConfig.get",
|
|
29
|
+
"firebaseappcheck.playIntegrityConfig.get",
|
|
30
|
+
"firebaseappcheck.recaptchaEnterpriseConfig.get",
|
|
31
|
+
"firebaseappcheck.recaptchaV3Config.get",
|
|
32
|
+
])
|
|
33
|
+
.action(async (options) => {
|
|
34
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
35
|
+
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
36
|
+
const { apps, configsByProvider } = await (0, utils_1.promiseWithSpinner)(async () => {
|
|
37
|
+
const [appList, ...configLists] = await Promise.all([
|
|
38
|
+
(0, apps_1.listFirebaseApps)(projectId, apps_1.AppPlatform.ANY),
|
|
39
|
+
...providers_1.ATTESTATION_PROVIDERS.map((p) => (0, api_1.batchGetProviderConfigs)(projectNumber, p)),
|
|
40
|
+
]);
|
|
41
|
+
return {
|
|
42
|
+
apps: appList,
|
|
43
|
+
configsByProvider: new Map(providers_1.ATTESTATION_PROVIDERS.map((p, i) => [p, configLists[i]])),
|
|
44
|
+
};
|
|
45
|
+
}, "Reading apps and App Check providers");
|
|
46
|
+
const rows = apps.map((app) => {
|
|
47
|
+
const providers = (0, providers_1.providersForPlatform)(app.platform).filter((provider) => {
|
|
48
|
+
const config = configsByProvider
|
|
49
|
+
.get(provider)
|
|
50
|
+
?.find((c) => appIdFromConfigName(c.name) === app.appId);
|
|
51
|
+
return Boolean(config && (0, providers_1.isConfigured)(provider, config));
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
appId: app.appId,
|
|
55
|
+
platform: app.platform,
|
|
56
|
+
displayName: app.displayName ?? "",
|
|
57
|
+
providers,
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
if (rows.length === 0) {
|
|
61
|
+
logger_1.logger.info(clc.bold(`No apps found in project ${projectId}.`));
|
|
62
|
+
return rows;
|
|
63
|
+
}
|
|
64
|
+
const table = new Table({
|
|
65
|
+
head: ["App ID", "Platform", "Display Name", "Providers"],
|
|
66
|
+
style: { head: ["green"] },
|
|
67
|
+
});
|
|
68
|
+
for (const row of rows) {
|
|
69
|
+
table.push([
|
|
70
|
+
clc.bold(row.appId),
|
|
71
|
+
row.platform,
|
|
72
|
+
row.displayName,
|
|
73
|
+
row.providers.length ? row.providers.join(", ") : "not configured",
|
|
74
|
+
]);
|
|
75
|
+
}
|
|
76
|
+
logger_1.logger.info(table.toString());
|
|
77
|
+
return rows;
|
|
78
|
+
});
|
|
@@ -7,7 +7,7 @@ const os = require("os");
|
|
|
7
7
|
const command_1 = require("../command");
|
|
8
8
|
const projectUtils_1 = require("../projectUtils");
|
|
9
9
|
const api_1 = require("../appcheck/api");
|
|
10
|
-
const
|
|
10
|
+
const appcheck_prompts_1 = require("./appcheck-prompts");
|
|
11
11
|
const requireAuth_1 = require("../requireAuth");
|
|
12
12
|
const utils_1 = require("../utils");
|
|
13
13
|
const error_1 = require("../error");
|
|
@@ -20,7 +20,7 @@ exports.command = new command_1.Command("appcheck:debugtokens:create [debugToken
|
|
|
20
20
|
.option("--force", "overwrite existing debug token if it has the same display name without prompting")
|
|
21
21
|
.before(requireAuth_1.requireAuth)
|
|
22
22
|
.action(async (debugToken, options) => {
|
|
23
|
-
const { appId } = await (0,
|
|
23
|
+
const { appId } = await (0, appcheck_prompts_1.getOrPromptProjectAndAppId)(options);
|
|
24
24
|
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
25
25
|
let token = debugToken;
|
|
26
26
|
if (!token) {
|
|
@@ -5,7 +5,7 @@ const clc = require("colorette");
|
|
|
5
5
|
const command_1 = require("../command");
|
|
6
6
|
const projectUtils_1 = require("../projectUtils");
|
|
7
7
|
const api_1 = require("../appcheck/api");
|
|
8
|
-
const
|
|
8
|
+
const appcheck_prompts_1 = require("./appcheck-prompts");
|
|
9
9
|
const requireAuth_1 = require("../requireAuth");
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
11
|
const prompt_1 = require("../prompt");
|
|
@@ -16,7 +16,7 @@ exports.command = new command_1.Command("appcheck:debugtokens:delete <debugToken
|
|
|
16
16
|
.option("--force", "attempt to delete debug token without prompting for confirmation")
|
|
17
17
|
.before(requireAuth_1.requireAuth)
|
|
18
18
|
.action(async (debugTokenId, options) => {
|
|
19
|
-
const { appId } = await (0,
|
|
19
|
+
const { appId } = await (0, appcheck_prompts_1.getOrPromptProjectAndAppId)(options, "Select the app to delete a debug token from:");
|
|
20
20
|
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
21
21
|
let debugTokenName = debugTokenId;
|
|
22
22
|
if (!debugTokenName.startsWith("projects/")) {
|
|
@@ -6,7 +6,7 @@ const Table = require("cli-table3");
|
|
|
6
6
|
const command_1 = require("../command");
|
|
7
7
|
const projectUtils_1 = require("../projectUtils");
|
|
8
8
|
const api_1 = require("../appcheck/api");
|
|
9
|
-
const
|
|
9
|
+
const appcheck_prompts_1 = require("./appcheck-prompts");
|
|
10
10
|
const requireAuth_1 = require("../requireAuth");
|
|
11
11
|
const logger_1 = require("../logger");
|
|
12
12
|
const utils_1 = require("../utils");
|
|
@@ -27,7 +27,7 @@ exports.command = new command_1.Command("appcheck:debugtokens:list")
|
|
|
27
27
|
.option("--app <appId>", "the app id of your Firebase app")
|
|
28
28
|
.before(requireAuth_1.requireAuth)
|
|
29
29
|
.action(async (options) => {
|
|
30
|
-
const { appId } = await (0,
|
|
30
|
+
const { appId } = await (0, appcheck_prompts_1.getOrPromptProjectAndAppId)(options, "Select the app to list debug tokens for:");
|
|
31
31
|
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
32
32
|
const debugTokens = await (0, utils_1.promiseWithSpinner)(async () => await (0, api_1.listDebugTokens)(projectNumber, appId), `Listing App Check debug tokens for app ${clc.bold(appId)}`);
|
|
33
33
|
logDebugTokensList(debugTokens);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOrPromptProjectAndAppId = void 0;
|
|
4
|
+
exports.getOrPromptAppId = getOrPromptAppId;
|
|
5
|
+
exports.getOrPromptApp = getOrPromptApp;
|
|
6
|
+
const apps_1 = require("../management/apps");
|
|
7
|
+
const projectUtils_1 = require("../projectUtils");
|
|
8
|
+
const appUtils_1 = require("../appUtils");
|
|
9
|
+
const error_1 = require("../error");
|
|
10
|
+
const logger_1 = require("../logger");
|
|
11
|
+
const clc = require("colorette");
|
|
12
|
+
async function chooseApp(projectId, apps, options, message) {
|
|
13
|
+
const localApps = await (0, appUtils_1.detectApps)(options.cwd || process.cwd());
|
|
14
|
+
const localAppIds = localApps.map((a) => a.appId).filter(Boolean);
|
|
15
|
+
const local = localAppIds.length ? apps.filter((app) => localAppIds.includes(app.appId)) : [];
|
|
16
|
+
const choices = local.length ? local : apps;
|
|
17
|
+
if (choices.length === 1) {
|
|
18
|
+
return choices[0];
|
|
19
|
+
}
|
|
20
|
+
if (options.nonInteractive) {
|
|
21
|
+
throw new error_1.FirebaseError(`Project ${projectId} has multiple apps, must specify an app id.`);
|
|
22
|
+
}
|
|
23
|
+
return (0, apps_1.selectAppInteractively)(choices, apps_1.AppPlatform.ANY, { message });
|
|
24
|
+
}
|
|
25
|
+
async function listAppsOrThrow(projectId) {
|
|
26
|
+
const apps = await (0, apps_1.listFirebaseApps)(projectId, apps_1.AppPlatform.ANY);
|
|
27
|
+
if (!apps.length) {
|
|
28
|
+
throw new error_1.FirebaseError(`There are no apps associated with project ${projectId}.`);
|
|
29
|
+
}
|
|
30
|
+
return apps;
|
|
31
|
+
}
|
|
32
|
+
async function getOrPromptAppId(options, message = "Select the app to register a debug token for:") {
|
|
33
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
34
|
+
logger_1.logger.info(`Active Project: ${clc.bold(projectId)}`);
|
|
35
|
+
if (options.app) {
|
|
36
|
+
return { projectId, appId: options.app };
|
|
37
|
+
}
|
|
38
|
+
const app = await chooseApp(projectId, await listAppsOrThrow(projectId), options, message);
|
|
39
|
+
return { projectId, appId: app.appId };
|
|
40
|
+
}
|
|
41
|
+
exports.getOrPromptProjectAndAppId = getOrPromptAppId;
|
|
42
|
+
async function getOrPromptApp(options, message) {
|
|
43
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
44
|
+
logger_1.logger.info(`Active Project: ${clc.bold(projectId)}`);
|
|
45
|
+
const apps = await listAppsOrThrow(projectId);
|
|
46
|
+
if (options.app) {
|
|
47
|
+
const app = apps.find((a) => a.appId === options.app);
|
|
48
|
+
if (!app) {
|
|
49
|
+
throw new error_1.FirebaseError(`App ${options.app} was not found in project ${projectId}.`);
|
|
50
|
+
}
|
|
51
|
+
return { projectId, appId: app.appId, platform: app.platform };
|
|
52
|
+
}
|
|
53
|
+
const app = await chooseApp(projectId, apps, options, message);
|
|
54
|
+
return { projectId, appId: app.appId, platform: app.platform };
|
|
55
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("colorette");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const projectUtils_1 = require("../projectUtils");
|
|
7
|
+
const requireAuth_1 = require("../requireAuth");
|
|
8
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
9
|
+
const logger_1 = require("../logger");
|
|
10
|
+
const api_1 = require("../appcheck/api");
|
|
11
|
+
const providers_1 = require("../appcheck/providers");
|
|
12
|
+
const appcheck_prompts_1 = require("./appcheck-prompts");
|
|
13
|
+
function detailLines(provider, config) {
|
|
14
|
+
switch (provider) {
|
|
15
|
+
case "device-check":
|
|
16
|
+
return [
|
|
17
|
+
`Key id: ${config.keyId ?? "not set"}`,
|
|
18
|
+
`Private key: ${config.privateKeySet ? "set" : "not set"}`,
|
|
19
|
+
];
|
|
20
|
+
case "recaptcha-enterprise":
|
|
21
|
+
return [
|
|
22
|
+
`Site key: ${config.siteKey ?? "not set"}`,
|
|
23
|
+
`Min score: ${config.riskAnalysis?.minValidScore ?? "default"}`,
|
|
24
|
+
];
|
|
25
|
+
case "recaptcha-v3":
|
|
26
|
+
return [
|
|
27
|
+
`Site secret: ${config.siteSecretSet ? "set" : "not set"}`,
|
|
28
|
+
`Min score: ${config.minValidScore ?? "default"}`,
|
|
29
|
+
];
|
|
30
|
+
case "play-integrity":
|
|
31
|
+
return [
|
|
32
|
+
`Min device: ${config.deviceIntegrity?.minDeviceRecognitionLevel ?? "default"}`,
|
|
33
|
+
`Licensed: ${config.accountDetails?.requireLicensed ? "required" : "not required"}`,
|
|
34
|
+
`Unrecognized: ${config.appIntegrity?.allowUnrecognizedVersion ? "allowed" : "not allowed"}`,
|
|
35
|
+
];
|
|
36
|
+
default:
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.command = new command_1.Command("appcheck:providers:get <provider>")
|
|
41
|
+
.description("show one App Check attestation provider for an app")
|
|
42
|
+
.help(`shows the App Check settings for one attestation provider on one app.
|
|
43
|
+
|
|
44
|
+
<provider> is one of:
|
|
45
|
+
|
|
46
|
+
${(0, providers_1.providerHelp)()}
|
|
47
|
+
|
|
48
|
+
For example:
|
|
49
|
+
|
|
50
|
+
\`firebase appcheck:providers:get recaptcha-enterprise --app 1:1234567890:web:abc123\``)
|
|
51
|
+
.option("--app <appId>", "the app id of your Firebase app")
|
|
52
|
+
.before(requireAuth_1.requireAuth)
|
|
53
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
54
|
+
"firebaseappcheck.appAttestConfig.get",
|
|
55
|
+
"firebaseappcheck.deviceCheckConfig.get",
|
|
56
|
+
"firebaseappcheck.playIntegrityConfig.get",
|
|
57
|
+
"firebaseappcheck.recaptchaEnterpriseConfig.get",
|
|
58
|
+
"firebaseappcheck.recaptchaV3Config.get",
|
|
59
|
+
])
|
|
60
|
+
.action(async (provider, options) => {
|
|
61
|
+
const providerType = (0, providers_1.parseProviderType)(provider);
|
|
62
|
+
const { appId, platform } = await (0, appcheck_prompts_1.getOrPromptApp)(options, `Select the app to read ${providerType} settings for:`);
|
|
63
|
+
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
64
|
+
(0, providers_1.assertProviderSupportsPlatform)(providerType, platform, appId);
|
|
65
|
+
const config = await (0, api_1.getProviderConfig)(projectNumber, appId, providerType);
|
|
66
|
+
logger_1.logger.info(`Provider: ${clc.bold(providerType)}`);
|
|
67
|
+
logger_1.logger.info(`App: ${appId} (${platform})`);
|
|
68
|
+
for (const line of detailLines(providerType, config)) {
|
|
69
|
+
logger_1.logger.info(line);
|
|
70
|
+
}
|
|
71
|
+
logger_1.logger.info(`Token TTL: ${(0, providers_1.formatTokenTtl)(config.tokenTtl)}`);
|
|
72
|
+
return { ...config, provider: providerType, configured: (0, providers_1.isConfigured)(providerType, config) };
|
|
73
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("colorette");
|
|
5
|
+
const Table = require("cli-table3");
|
|
6
|
+
const command_1 = require("../command");
|
|
7
|
+
const projectUtils_1 = require("../projectUtils");
|
|
8
|
+
const requireAuth_1 = require("../requireAuth");
|
|
9
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
10
|
+
const logger_1 = require("../logger");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
const api_1 = require("../appcheck/api");
|
|
13
|
+
const providers_1 = require("../appcheck/providers");
|
|
14
|
+
const appcheck_prompts_1 = require("./appcheck-prompts");
|
|
15
|
+
function formatConfigured(configured) {
|
|
16
|
+
if (configured === null) {
|
|
17
|
+
return "n/a";
|
|
18
|
+
}
|
|
19
|
+
return configured ? "Yes" : "No";
|
|
20
|
+
}
|
|
21
|
+
exports.command = new command_1.Command("appcheck:providers:list")
|
|
22
|
+
.description("list App Check attestation providers for an app")
|
|
23
|
+
.help(`shows how one app can prove it is real, and which providers are set up.
|
|
24
|
+
|
|
25
|
+
Only the providers that work on the app's platform are shown:
|
|
26
|
+
|
|
27
|
+
${(0, providers_1.providerHelp)()}
|
|
28
|
+
|
|
29
|
+
App Attest and Play Integrity have no key or secret to register, so the API cannot say whether an app really uses them. Those show as "n/a" in the Configured column.
|
|
30
|
+
|
|
31
|
+
reCAPTCHA now works on iOS and Android as well as web, through the reCAPTCHA attestation provider added to the mobile SDKs in June 2026. It uses the same reCAPTCHA Enterprise settings as the web provider, so configure it with \`recaptcha-enterprise\`. That provider is in public preview on mobile.`)
|
|
32
|
+
.option("--app <appId>", "the app id of your Firebase app")
|
|
33
|
+
.before(requireAuth_1.requireAuth)
|
|
34
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
35
|
+
"firebaseappcheck.appAttestConfig.get",
|
|
36
|
+
"firebaseappcheck.deviceCheckConfig.get",
|
|
37
|
+
"firebaseappcheck.playIntegrityConfig.get",
|
|
38
|
+
"firebaseappcheck.recaptchaEnterpriseConfig.get",
|
|
39
|
+
"firebaseappcheck.recaptchaV3Config.get",
|
|
40
|
+
])
|
|
41
|
+
.action(async (options) => {
|
|
42
|
+
const { appId, platform } = await (0, appcheck_prompts_1.getOrPromptApp)(options, "Select the app to list App Check providers for:");
|
|
43
|
+
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
44
|
+
const providers = (0, providers_1.providersForPlatform)(platform);
|
|
45
|
+
const configs = await (0, utils_1.promiseWithSpinner)(() => Promise.all(providers.map((p) => (0, api_1.getProviderConfig)(projectNumber, appId, p))), `Reading App Check providers for app ${clc.bold(appId)}`);
|
|
46
|
+
const rows = providers.map((provider, i) => ({
|
|
47
|
+
provider,
|
|
48
|
+
configured: (0, providers_1.isConfigured)(provider, configs[i]),
|
|
49
|
+
tokenTtl: (0, providers_1.formatTokenTtl)(configs[i].tokenTtl),
|
|
50
|
+
settings: (0, providers_1.summarizeConfig)(provider, configs[i]),
|
|
51
|
+
}));
|
|
52
|
+
logger_1.logger.info(`App: ${clc.bold(appId)} (${platform})`);
|
|
53
|
+
const table = new Table({
|
|
54
|
+
head: ["Provider", "Configured", "Token TTL", "Settings"],
|
|
55
|
+
style: { head: ["green"] },
|
|
56
|
+
});
|
|
57
|
+
for (const row of rows) {
|
|
58
|
+
table.push([
|
|
59
|
+
clc.bold(row.provider),
|
|
60
|
+
formatConfigured(row.configured),
|
|
61
|
+
row.tokenTtl,
|
|
62
|
+
row.settings,
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
logger_1.logger.info(table.toString());
|
|
66
|
+
return rows;
|
|
67
|
+
});
|