跳转到正文
报告库
用途分类 / 数据分析

Firebase Auth Basics Skill 安全审计

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

Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.

第三方安全检查结论

先别安装或运行

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

未固定版本的 `npx -y` 会自动下载并执行最新 CLI

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

多个步骤使用 `npx -y firebase-tools@latest`。`-y` 跳过安装确认,`@latest` 不固定经过审查的版本,因此未来发布的包内容会直接在本机执行,并继承终端和已登录 Firebase CLI 可访问的权限。

为什么需要注意

包被攻陷、错误发布或发生不兼容更新时,可能影响本地文件、CLI 凭据或 Firebase 项目;每次执行得到的代码也可能不同。

这些是可执行的安装/运行命令。`@latest` 每次可能解析到不同且未经用户审查的版本,`-y` 会跳过 npx 的安装确认;命令随后可使用当前终端和已登录 Firebase CLI 的权限创建项目、初始化或部署配置。这是常见的便捷用法,不表示包有恶意,但确实扩大了供应链和版本漂移风险。用户可限制为明确版本,并在运行前核验包来源和目标项目。

SKILL.md:3来自说明文档打开原文件
name: firebase-auth-basicsdescription: Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.compatibility: This skill is best used with the Firebase CLI, but does not require it. Firebase CLI can be accessed through `npx -y firebase-tools@latest`.metadata:
查看另外 5 个位置
SKILL.md:11来自说明文档打开原文件
- **Firebase Project**: Created via  `npx -y firebase-tools@latest projects:create` (see `firebase-basics`).- **Firebase CLI**: Installed and logged in (see `firebase-basics`).
references/client_sdk_android.md:8来自说明文档打开原文件
Before adding dependencies in your app, make sure you enable the Auth service inyour Firebase Project using the Firebase CLI:```bashnpx -y firebase-tools@latest init auth```
SKILL.md:4来自说明文档打开原文件
description: Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.compatibility: This skill is best used with the Firebase CLI, but does not require it. Firebase CLI can be accessed through `npx -y firebase-tools@latest`.metadata:
SKILL.md:95来自说明文档打开原文件
```bashnpx -y firebase-tools@latest deploy --only auth```
references/client_sdk_android.md:11来自说明文档打开原文件
```bashnpx -y firebase-tools@latest init auth```
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。发现 1 项风险
中风险

邮箱地址被持久保存在可由页面脚本读取的 localStorage 中

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

无密码登录示例把用户邮箱写入 `window.localStorage`,并只在成功完成登录后删除。localStorage 会跨页面和浏览器重启保留,同源脚本均可读取;失败或用户放弃流程时,示例没有清理它。

为什么需要注意

共享设备上的后续使用者,或站点发生 XSS、加载受侵害的同源脚本时,可能取得该邮箱地址,造成隐私泄露或用于定向钓鱼。

示例会把邮箱持久写入当前站点源的 localStorage。后续代码仅在登录成功的 `.then` 分支删除;发送失败、链接未完成或登录失败时没有清理。因而邮箱可能跨页面或浏览器重启保留,并可被同源页面脚本读取,造成隐私暴露(尤其在共享设备或同源脚本被攻破时)。用户可要求采用更短生命周期的存储、失败/取消清理和适当的内容安全限制。

references/client_sdk_web.md:234来自说明文档打开原文件
sendSignInLinkToEmail(auth, email, actionCodeSettings)  .then(() => {    // Save the email locally so you don't need to ask the user for it again    window.localStorage.setItem('emailForSignIn', email);  })  .catch((error) => {    // Error  });```
查看另外 1 个位置
references/client_sdk_web.md:251来自说明文档打开原文件
if (isSignInWithEmailLink(auth, window.location.href)) {  let email = window.localStorage.getItem('emailForSignIn');  if (!email) {    email = window.prompt('Please provide your email for confirmation');  }  signInWithEmailLink(auth, email, window.location.href)    .then((result) => {      window.localStorage.removeItem('emailForSignIn');      // You can check result.user    })    .catch((error) => {      // Error    });}
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。未发现风险
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 2 项风险
高风险

示例规则可能让任何已登录者读写整个匹配范围

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

规则 `request.auth != null` 只检查是否存在登录身份,不检查记录所有权、角色或权限。该 Skill 的配置还启用了匿名登录,因此陌生人可能自行取得一个满足此检查的身份。

为什么需要注意

如果用户把此规则放在包含私人或关键数据的宽泛路径上,任何注册用户,甚至匿名用户,都可能读取、篡改或删除该范围内的数据。

风险在特定采用方式下成立:示例认证配置启用匿名登录,而“仅检查已登录”的规则会让匿名用户也满足条件。如果该规则被用于宽泛的匹配范围,任何能登录(包括匿名登录)的人都可能读写该范围。文档随后提供了所有权校验,因此这不是所有示例规则的共同问题;用户应确认实际规则按 UID、角色或资源所有者进一步限制访问。

SKILL.md:70来自说明文档打开原文件
  "authorizedDomains": ["localhost"],    "providers": {      "anonymous": true,      "emailPassword": true,      "googleSignIn": {        "oAuthBrandDisplayName": "Your Brand Name",
查看另外 3 个位置
references/security_rules.md:12来自说明文档打开原文件
### Check if user is signed in```allow read, write: if request.auth != null;```
SKILL.md:68来自说明文档打开原文件
{  "auth": {  "authorizedDomains": ["localhost"],    "providers": {      "anonymous": true,      "emailPassword": true,      "googleSignIn": {        "oAuthBrandDisplayName": "Your Brand Name",
references/security_rules.md:18来自说明文档打开原文件
### Check if user owns the dataAccess data only if the document ID matches the user's UID.```allow read, write: if request.auth != null && request.auth.uid == userId;```
中风险

强制部署步骤可能更改错误的 Firebase 项目

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

指南用“必须”要求直接执行认证部署,但没有在命令前要求核对当前项目、环境或配置差异。部署会把本地 `firebase.json` 的提供商和授权域设置写入当前选中的 Firebase 后端,并可能生成 OAuth 客户端。

为什么需要注意

如果 CLI 当前指向生产项目或其他项目,登录方式、授权域及 OAuth 配置可能被意外改变,导致用户无法登录或扩大可接受的登录来源。

这是实际的后端变更指令,不只是说明性示例。Skill 要求已登录 CLI,并强调必须运行部署命令,却没有在所示步骤中要求确认当前选中的 Firebase 项目或先审查配置。若终端指向错误项目,认证提供商、授权域及相关 OAuth 配置可能被部署到错误环境。用户可要求在执行前显示并确认项目 ID、目标别名和配置差异。

SKILL.md:64来自说明文档打开原文件
Configure Firebase Authentication in `firebase.json` by adding an 'auth' block:```{  "auth": {  "authorizedDomains": ["localhost"],    "providers": {      "anonymous": true,      "emailPassword": true,      "googleSignIn": {        "oAuthBrandDisplayName": "Your Brand Name",        "supportEmail": "support@example.com"      }    }  }}```
查看另外 2 个位置
SKILL.md:90来自说明文档打开原文件
**CRITICAL**: After configuring `firebase.json`, you MUST deploy the authconfiguration to the Firebase backend for the changes to take effect. This isessential for auth providers like Google Sign-In, email/password, etc. toauto-generate the necessary OAuth clients for your app platforms. Run:```bashnpx -y firebase-tools@latest deploy --only auth```
SKILL.md:11来自说明文档打开原文件
- **Firebase Project**: Created via  `npx -y firebase-tools@latest projects:create` (see `firebase-basics`).- **Firebase CLI**: Installed and logged in (see `firebase-basics`).
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

3 个说明模块

该 Skill 是 Firebase Authentication 的配置与客户端集成指南,覆盖 Web、Flutter、Android 和 iOS,并建议用 Firebase CLI 创建项目、启用身份提供商和部署认证配置。

查看原文
SKILL.md:2来自说明文档打开原文件
---name: firebase-auth-basicsdescription: Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.compatibility: This skill is best used with the Firebase CLI, but does not require it. Firebase CLI can be accessed through `npx -y firebase-tools@latest`.metadata:
SKILL.md:90来自说明文档打开原文件
**CRITICAL**: After configuring `firebase.json`, you MUST deploy the authconfiguration to the Firebase backend for the changes to take effect. This isessential for auth providers like Google Sign-In, email/password, etc. toauto-generate the necessary OAuth clients for your app platforms. Run:```bashnpx -y firebase-tools@latest deploy --only auth```

Web 示例包括邮箱密码、匿名登录和多个第三方弹窗登录;第三方登录结果中会取得提供商访问令牌,但所示代码没有发送或持久化这些令牌。

查看原文
references/client_sdk_web.md:57来自说明文档打开原文件
signInWithPopup(auth, provider)  .then((result) => {    // This gives you a Google Access Token. You can use it to access the Google API.    const credential = GoogleAuthProvider.credentialFromResult(result);    const token = credential.accessToken;    // The signed-in user info.    const user = result.user;    // ...  })
references/client_sdk_web.md:204来自说明文档打开原文件
## Sign In Anonymously```javascriptimport { getAuth, signInAnonymously } from "firebase/auth";const auth = getAuth();signInAnonymously(auth)  .then(() => {    // Signed in..  })  .catch((error) => {    const errorCode = error.code;    const errorMessage = error.message;  });```

安全规则参考同时展示了“任何已登录用户”和“仅资源所有者”两种访问模式;实际保护强度取决于用户采用哪一种规则。

查看原文
references/security_rules.md:12来自说明文档打开原文件
### Check if user is signed in```allow read, write: if request.auth != null;```
references/security_rules.md:18来自说明文档打开原文件
### Check if user owns the dataAccess data only if the document ID matches the user's UID.```allow read, write: if request.auth != null && request.auth.uid == userId;```(Where `userId` is a path variable, e.g., `match /users/{userId}`)

提供的内容未显示上传凭据、隐藏收款变更、删除文件或绕过审核的指令;可见的外部操作主要是 Firebase CLI、Firebase 控制台和身份提供商登录。

查看原文
SKILL.md:99来自说明文档打开原文件
#### Option 2. Enabling Authentication in ConsoleEnable other providers in the Firebase Console.1. Go to the   https://console.firebase.google.com/project/_/authentication/providers1. Select your project.1. Enable the desired Sign-in providers (e.g., Email/Password, Google).
从这里开始 · 工作说明SKILL.md
firebase-auth-basics
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。

文件引用关系图

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

检查范围与遗漏

逐文件查看涉及的内容

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

  • SKILL.md已纳入全文
  • references/client_sdk_android.md已纳入全文
  • references/client_sdk_web.md已纳入全文
  • references/flutter_setup.md已纳入全文
  • references/security_rules.md已纳入全文
  • references/ios_setup.md已纳入全文

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

  • SKILL.md工作说明
  • references/client_sdk_android.md配套文件
  • references/client_sdk_web.md配套文件
  • references/flutter_setup.md配套文件
  • references/ios_setup.md配套文件
  • references/security_rules.md配套文件

代码和说明中提到的操作

安装其他软件包
SKILL.md:4来自说明文档打开原文件
description: Guide for setting up and using Firebase Authentication. Use this skill when the user's app requires user sign-in, user management, or secure data access using auth rules.compatibility: This skill is best used with the Firebase CLI, but does not require it. Firebase CLI can be accessed through `npx -y firebase-tools@latest`.metadata:
SKILL.md:12来自说明文档打开原文件
- **Firebase Project**: Created via  `npx -y firebase-tools@latest projects:create` (see `firebase-basics`).- **Firebase CLI**: Installed and logged in (see `firebase-basics`).
SKILL.md:96来自说明文档打开原文件
```bashnpx -y firebase-tools@latest deploy --only auth```
连接外部网站
SKILL.md:88来自说明文档打开原文件
> protocol or port number in the Authorized Domains list (e.g., use `localhost`,> NOT `http://localhost:9090`).
SKILL.md:104来自说明文档打开原文件
1. Go to the   https://console.firebase.google.com/project/_/authentication/providers1. Select your project.
references/client_sdk_android.md:24来自说明文档打开原文件
dependencies {    // [AGENT] Fetch the latest available BoM version from https://firebase.google.com/support/release-notes/android before adding this    implementation(platform("com.google.firebase:firebase-bom:<latest_bom_version>"))
运行命令
SKILL.md:95来自说明文档打开原文件
```bashnpx -y firebase-tools@latest deploy --only auth
references/client_sdk_android.md:11来自说明文档打开原文件
```bashnpx -y firebase-tools@latest init auth
读取了多少行
872
文件校验值(用于核对版本)
e463737e70eb185cbfc60871e16e65c4503a323f58f19fc6b40ad3509b95c71f