跳转到正文
报告库
用途分类 / 其他用途

Firebase App Hosting Basics Skill 安全审计

作者说它能做什么(原文)

>-

第三方安全检查结论

发现安全风险

已检查文件
4
发现的风险
5
会不会运行危险命令?检查是否下载程序后直接运行、让他人远程控制电脑,或藏起要运行的命令。发现 1 项风险
中风险

所有 CLI 操作都通过未固定版本的远程 npm 包执行

原文依据:2 处
发现了什么

命令使用 `npx -y firebase-tools@latest`;`-y` 自动接受安装,而 `latest` 会随发布变化。部署、密钥和模拟器操作因此会执行当时下载的包代码,而不是经过审核并锁定的版本。

为什么需要注意

如果上游包、发布账号或依赖链被入侵,或者新版出现破坏性变化,代码可在用户本机凭当前账户权限运行,并可能接触 Firebase 登录凭据、项目文件和云资源。

该 Skill 主流程明确要求通过 `npx -y firebase-tools@latest` 管理密钥并部署。`-y` 会跳过安装确认,`latest` 不固定版本;用户执行时会下载并运行当时发布的 Firebase CLI 代码。若上游版本发生有害或不兼容变化,可能影响本地项目、Firebase 资源或凭据。用户可要求作者固定并审核具体版本,或限制自动安装及部署权限。

SKILL.md:61来自说明文档打开原文件
   do so.1. If the app needs safe access to sensitive keys, use   `npx -y firebase-tools@latest apphosting:secrets` commands to set and grant   access to secrets.1. Run `npx -y firebase-tools@latest deploy` when you are ready to deploy.
查看另外 1 个位置
references/emulation.md:27来自说明文档打开原文件
To start the App Hosting emulator:```bashnpx -y firebase-tools@latest emulators:start --only apphosting```
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。发现 1 项风险
中风险

示例从项目根目录部署,但忽略列表未排除常见本地密钥文件

原文依据:3 处
发现了什么

示例把 `rootDir` 设为 `/`,忽略项只有依赖、Git 元数据、调试日志和 functions,没有 `.env`、模拟器密钥覆盖文件或其他本地凭据文件。同时,流程随后直接执行部署。

为什么需要注意

如果用户项目根目录中存在未被平台或其他配置排除的敏感文件,它们可能进入部署输入或远程构建上下文,使云端构建系统或有项目访问权的人员能够接触这些数据。

这段证据能说明什么

示例确实使用根目录并仅列出五类忽略项,而模拟器覆盖文件可能含敏感值且未出现在该列表中。但源码没有说明部署命令会上传所有未忽略文件,也没有证明 `rootDir: "/"` 指操作系统根目录或 `.env` 会进入产物。因此存在值得核实的配置风险,但无法仅凭这些行确认密钥会被部署。用户可要求作者说明 Firebase CLI 的默认排除规则,并在部署前展示实际上传清单。

这项判断针对展示的代码和适用条件,不表示风险已经实际发生。
SKILL.md:45来自说明文档打开原文件
   {     "apphosting": {       "backendId": "my-app-id",       "rootDir": "/",       "ignore": [         "node_modules",         ".git",         "firebase-debug.log",         "firebase-debug.*.log",         "functions"       ]     }
查看另外 2 个位置
SKILL.md:64来自说明文档打开原文件
   access to secrets.1. Run `npx -y firebase-tools@latest deploy` when you are ready to deploy.
references/emulation.md:9来自说明文档打开原文件
This optional file overrides `apphosting.yaml` settings specifically for thelocal emulator. Use it to provide local secret values or override resourceconfigs. If it contains sensitive values such as API keys, do not commit it tosource control.
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。未发现风险
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 2 项风险
中风险

密钥授权命令可扩大 App Hosting 服务账号的访问权限

原文依据:3 处
发现了什么

参考命令会向 App Hosting 服务账号授予读取指定 Secret Manager 密钥的权限。文档建议用它处理权限问题,但没有要求在授权前核对后端身份、密钥内容或最小权限范围。

为什么需要注意

若选错 Firebase 项目、后端、服务账号或密钥,部署的应用代码可能读取本不应向该应用开放的 API 密钥或其他凭据。

主流程主动建议用密钥命令设置并授予访问权;参考资料明确说明 `grantaccess` 会让 App Hosting 服务账号读取指定密钥。这是部署所需的正常权限操作,但若选错项目、服务账号或密钥,会扩大错误主体对敏感值的访问。可见说明没有部署前身份核对步骤。用户可要求先显示项目、后端、服务账号和密钥名称,并限定为目标服务账号。

references/cli_commands.md:45来自说明文档打开原文件
### `npx -y firebase-tools@latest apphosting:secrets:set <secret-name>`- **Purpose**: Creates or updates a secret in Cloud Secret Manager and makes it  available to App Hosting.- **Behavior**: Prompts for the secret value (hidden input).### `npx -y firebase-tools@latest apphosting:secrets:grantaccess <secret-name>`- **Purpose**: Grants the App Hosting service account permission to access the  secret.- **Note**: Often handled automatically by `secrets:set`, but useful for  debugging permission issues or granting access to existing secrets.
查看另外 2 个位置
SKILL.md:61来自说明文档打开原文件
   do so.1. If the app needs safe access to sensitive keys, use   `npx -y firebase-tools@latest apphosting:secrets` commands to set and grant   access to secrets.1. Run `npx -y firebase-tools@latest deploy` when you are ready to deploy.
references/cli_commands.md:51来自说明文档打开原文件
### `npx -y firebase-tools@latest apphosting:secrets:grantaccess <secret-name>`- **Purpose**: Grants the App Hosting service account permission to access the  secret.- **Note**: Often handled automatically by `secrets:set`, but useful for  debugging permission issues or granting access to existing secrets.
中风险

命令集中包含删除整个后端及关联资源的操作,但没有确认或恢复保护

原文依据:2 处
发现了什么

参考资料列出 `apphosting:backends:delete`,其明确效果是删除后端及关联资源。可见说明没有要求先展示目标项目和后端、备份配置、确认生产状态或获得用户逐次批准。

为什么需要注意

代理选错项目或后端时,可能造成生产服务中断,并删除依附于该后端的云资源;恢复能力在所给材料中没有说明。

这段证据能说明什么

参考资料确实记录了会删除后端及关联资源的命令,也没有在相邻说明中列出备份或目标确认步骤。不过这只是命令目录中的说明;主部署流程没有要求执行删除,源码也未显示该命令会被自动调用。因此破坏能力存在,但是否会影响用户取决于代理是否在获得具体删除授权后使用它。用户可限制删除权限,并要求执行前显示项目、后端和受影响资源。

这项判断针对展示的代码和适用条件,不表示风险已经实际发生。
references/cli_commands.md:28来自说明文档打开原文件
### `npx -y firebase-tools@latest apphosting:backends:get <backend-id>`- **Purpose**: Shows details for a specific backend.### `npx -y firebase-tools@latest apphosting:backends:delete <backend-id>`- **Purpose**: Deletes a backend and its associated resources.
查看另外 1 个位置
SKILL.md:61来自说明文档打开原文件
   do so.1. If the app needs safe access to sensitive keys, use   `npx -y firebase-tools@latest apphosting:secrets` commands to set and grant   access to secrets.1. Run `npx -y firebase-tools@latest deploy` when you are ready to deploy.
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。发现 1 项风险
中风险

采用该流程需要启用按量计费,并可能按示例扩容到 100 个实例

原文依据:3 处
发现了什么

Skill 要求用户升级到 Blaze 计费方案;配置示例将 `maxInstances` 设为 100,并说明该字段控制最大扩容数量。部署真实服务后,流量、误配置或滥用可能产生费用。

为什么需要注意

用户可能开始承担持续的云服务账单;较高的扩容上限会放大突发流量或攻击造成的费用。

源码明确要求使用 App Hosting 的项目升级为 Blaze 按量计费,并提供直接升级链接。配置示例允许服务扩容到 100 个实例,且文档确认 `maxInstances` 是最大扩容限制。若用户部署该配置并遇到高流量或滥用,可能产生实际云费用;100 是上限而非保证会启动的数量。用户可要求部署前确认预算、告警、区域及更低的实例上限。

SKILL.md:16来自说明文档打开原文件
**Important**: In order to use App Hosting, your Firebase project must be on theBlaze pricing plan. Direct the user tohttps://console.firebase.google.com/project/_/overview?purchaseBillingPlan=meteredto upgrade their plan.
查看另外 2 个位置
references/configuration.md:13来自说明文档打开原文件
# Cloud Run service configurationrunConfig:  cpu: 1  memoryMiB: 512  minInstances: 0  maxInstances: 100  concurrency: 80
references/configuration.md:37来自说明文档打开原文件
- `memoryMiB`: RAM in MiB (128 to 32768).- `minInstances`: Minimum containers to keep warm (default 0). Set to >= 1 to  avoid cold starts.- `maxInstances`: Maximum scaling limit (default 100).- `concurrency`: Max concurrent requests per instance (default 80).

Skill 逻辑拆解

4 个说明模块

该 Skill 用于配置和部署 Firebase App Hosting 的全栈应用,并明确区分其与经典静态 Hosting 的适用场景。

查看原文
SKILL.md:13来自说明文档打开原文件
This skill enables the agent to deploy and manage modern, full-stack webapplications (Next.js, Angular, etc.) using Firebase App Hosting.**Important**: In order to use App Hosting, your Firebase project must be on theBlaze pricing plan. Direct the user tohttps://console.firebase.google.com/project/_/overview?purchaseBillingPlan=meteredto upgrade their plan.
SKILL.md:23来自说明文档打开原文件
**Choose Firebase Hosting if:**- You are deploying a static site (HTML/CSS/JS).- You are deploying a simple SPA (React, Vue, etc. without SSR).- You want full control over the build and deploy process via CLI.**Choose Firebase App Hosting if:**- You are using a supported full-stack framework like Next.js or Angular.- You need Server-Side Rendering (SSR) or ISR.- You want an automated "git push to deploy" workflow with zero configuration.

部署流程会修改项目配置、管理 Cloud Secret Manager 中的密钥,并向 Firebase 执行真实部署。

查看原文
SKILL.md:41来自说明文档打开原文件
1. Configure `firebase.json` with an `apphosting` block.      ```json   {     "apphosting": {       "backendId": "my-app-id",       "rootDir": "/",       "ignore": [         "node_modules",         ".git",         "firebase-debug.log",         "firebase-debug.*.log",         "functions"       ]     }   }   ```1. Create or edit `apphosting.yaml`- see   [Configuration](references/configuration.md) for more information on how to   do so.1. If the app needs safe access to sensitive keys, use   `npx -y firebase-tools@latest apphosting:secrets` commands to set and grant   access to secrets.1. Run `npx -y firebase-tools@latest deploy` when you are ready to deploy.

本地模拟器会运行应用自身的构建脚本,并把配置文件中的环境变量和本地密钥值注入进程;文档提醒不要提交含敏感值的覆盖文件。

查看原文
references/emulation.md:9来自说明文档打开原文件
This optional file overrides `apphosting.yaml` settings specifically for thelocal emulator. Use it to provide local secret values or override resourceconfigs. If it contains sensitive values such as API keys, do not commit it tosource control.
references/emulation.md:41来自说明文档打开原文件
- **Builds your app**: Runs the build command defined in your `package.json` to  generate the serving artifact.- **Serves locally**: Runs the app on `localhost:5004` (default). Configurable
references/emulation.md:58来自说明文档打开原文件
- **Env Var Injection**: Injects variables defined in `apphosting.yaml` and  `apphosting.emulator.yaml` into the process.

命令参考还覆盖后端创建、删除、发布和服务账号选择,因此该 Skill 能影响持续运行的云资源及其身份权限。

查看原文
references/cli_commands.md:32来自说明文档打开原文件
### `npx -y firebase-tools@latest apphosting:backends:delete <backend-id>`- **Purpose**: Deletes a backend and its associated resources.
references/cli_commands.md:73来自说明文档打开原文件
### `npx -y firebase-tools@latest apphosting:backends:create`- **Purpose**: Creates a new App Hosting backend. Use this when setting up  automated deployments via GitHub.- **Options**:  - `--app <webAppId>`: The ID of an existing Firebase web app to associate with    the backend.  - `--backend <backendId>`: The ID of the new backend.  - `--primary-region <location>`: The primary region for the backend.  - `--root-dir <rootDir>`: The root directory for the backend. If omitted,    defaults to the root directory of the project.  - `--service-account <service-account>`: The service account used to run the    server. If omitted, defaults to the default service account.
从这里开始 · 工作说明SKILL.md
firebase-app-hosting-basics
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。

文件引用关系图

3 处引用
哪些文件发起引用引用了什么
连线表示真实的文件引用,不是运行顺序。点击节点可高亮相关连线,并查看具体文件和原文位置。虚线表示还有文件需要定位。
文件与检查记录4 个文件

检查范围与遗漏

逐文件查看涉及的内容

下方列出本次涉及的原文范围;纳入检查不代表已查清所有问题。

  • SKILL.md已纳入全文
  • references/cli_commands.md已纳入全文
  • references/configuration.md已纳入全文
  • references/emulation.md已纳入全文

这份报告只针对上方版本。我们看了拿到的代码和说明文件,没有实际运行 Skill,也没有检查它另外安装的软件包。因此,这不是“保证安全”的承诺;换了版本或使用环境,结果也可能不同。

  • SKILL.md工作说明
  • references/cli_commands.md配套文件
  • references/configuration.md配套文件
  • references/emulation.md配套文件

代码和说明中提到的操作

连接外部网站
SKILL.md:18来自说明文档打开原文件
Blaze pricing plan. Direct the user tohttps://console.firebase.google.com/project/_/overview?purchaseBillingPlan=meteredto upgrade their plan.
references/configuration.md:58来自说明文档打开原文件
  - `BUILD`: Available during the `npm run build` process.  - `RUNTIME`: Available when the app is serving requests.  - Defaults to both if not specified.
安装其他软件包
SKILL.md:62来自说明文档打开原文件
1. If the app needs safe access to sensitive keys, use   `npx -y firebase-tools@latest apphosting:secrets` commands to set and grant   access to secrets.
SKILL.md:64来自说明文档打开原文件
   access to secrets.1. Run `npx -y firebase-tools@latest deploy` when you are ready to deploy.
references/cli_commands.md:9来自说明文档打开原文件
### `npx -y firebase-tools@latest init apphosting`
读取密钥或账号配置
references/configuration.md:27来自说明文档打开原文件
      - RUNTIME  - variable: API_KEY    secret: myApiKeySecret
references/configuration.md:28来自说明文档打开原文件
  - variable: API_KEY    secret: myApiKeySecret```
references/emulation.md:21来自说明文档打开原文件
env:  - variable: API_KEY    value: "local-dev-api-key" # Override secret with local value
运行命令
references/emulation.md:29来自说明文档打开原文件
```bashnpx -y firebase-tools@latest emulators:start --only apphosting
references/emulation.md:35来自说明文档打开原文件
```bashnpx -y firebase-tools@latest emulators:start
读取了多少行
284
文件校验值(用于核对版本)
ffd81564c0edf948c4199979052938e0b32f43529f2a2316fbb0c8ceb29ab58a