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

Expo Brownfield Skill 安全审计

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

Framework (OSS). Integrate Expo and React Native into an existing native iOS or Android app. Use when the user mentions brownfield, embedding React Native in a native app, AAR/XCFramework, or adding Expo to an existing Kotlin/Swift project. Covers both the isolated approach and the integrated approach.

第三方安全检查结论

先别安装或运行

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

安装步骤会运行可变的远程包,其中 CocoaPods 安装具有管理员权限

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

项目创建命令使用可随时间变化的 `@latest`,反馈命令使用 `npx --yes ...@latest`,而 CocoaPods 前置条件建议通过 `sudo gem install` 全局安装未固定版本的 Gem。这些命令信任当时注册表返回的包及其依赖。

为什么需要注意

若注册表账号、包或依赖链被攻破,下载的代码可能在开发者权限下执行;通过 sudo 安装的内容还可更改系统级 Ruby 环境。即使没有攻击,未固定版本也可能产生不可复现的行为。

可见安装步骤确实包含三个不同风险:`create-expo-app@latest` 和 `submit-expo-feedback@latest` 会选择当时的最新版,CocoaPods 则通过未固定版本的 `sudo gem install` 获得管理员权限。它们是符合 Expo 集成目的的常规安装,并非恶意证据,但注册表包或依赖变化会影响实际执行代码。用户可要求固定版本、锁定依赖,并避免不必要的管理员级全局安装。

SKILL.md:44来自说明文档打开原文件
The integrated approach additionally requires **CocoaPods** on iOS (`sudo gem install cocoapods`). The isolated approach does **not** require CocoaPods or any RN tooling in the consuming native app.
查看另外 2 个位置
SKILL.md:50来自说明文档打开原文件
```shnpx create-expo-app@latest my-project --template default@sdk-55```
SKILL.md:56来自说明文档打开原文件
## Submitting FeedbackIf you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:```bashnpx --yes submit-expo-feedback@latest --category skills --subject "expo-brownfield" "<actionable feedback>"```Only submit when you have something specific and actionable to report. Include as much relevant context as possible.
会不会泄露文件和密钥?检查是否发送含密码或密钥的文件,以及代码里是否直接写了密钥。发现 1 项风险
中风险

反馈流程可能把项目或错误上下文发送给外部服务

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

Skill 建议运行一个下载的反馈工具,并要求在反馈中加入尽可能多的相关上下文。构建错误上下文常包含本机路径、内部包名、仓库信息、日志或配置;文本没有规定接收方、传输字段或脱敏步骤。

为什么需要注意

若用户把原始日志或项目细节放入反馈,专有代码信息、内部基础设施名称或意外出现在日志中的凭据可能离开本机。

反馈是可选且有明确目的的流程,不会从可见文本中自动收集整个项目;但它要求用户把“尽可能多”的相关上下文作为参数交给一个即时下载的反馈工具。若用户粘贴未经脱敏的日志,可能主动披露本机路径、内部名称、配置或令牌。用户应先确认接收方和字段,并仅提交经过审查、去密的最小内容。

SKILL.md:56来自说明文档打开原文件
## Submitting FeedbackIf you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:```bashnpx --yes submit-expo-feedback@latest --category skills --subject "expo-brownfield" "<actionable feedback>"```Only submit when you have something specific and actionable to report. Include as much relevant context as possible.If an AI agent repeatedly failed or the user had to take over an Expo task, load the expo-skill-feedback skill and follow its eval-candidate flow instead of reusing the command above.
会不会删除文件或一直在后台运行?检查是否大范围删除文件、改写磁盘,或设置自动启动。发现 1 项风险
高风险

“prebuild --clean”可能重建并覆盖现有原生项目

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

集成指南先让用户把现有 Android/iOS 项目放进 Expo 项目的标准原生目录,故障排查随后建议“从头重新生成原生项目”。在 brownfield 场景中,这些目录可能包含并非由 Expo 生成的既有业务代码和工程设置。

为什么需要注意

执行清理式预构建时,android/ 或 ios/ 中的手工原生修改可能被删除或替换,造成代码、签名配置、构建阶段或项目设置丢失。

指南允许把既有原生项目移动到 Expo 的 `android/`、`ios/` 目录,故障排查又对 integrated 项目建议“从头重新生成”并运行 `prebuild --clean`。在这些目录含有手写业务代码或工程设置时,清理式预构建可能替换或删除未由 Expo 配置表达的内容。执行前应要求作者说明保留规则,并限制为已提交或已备份的工作树。

references/brownfield-integrated.md:33来自说明文档打开原文件
## 2) Place native projects under the Expo projectA standard React Native project keeps native code under `android/` and `ios/`. Move the existing native projects in:```shmkdir my-project/androidmv /path/to/your/android-project my-project/android/# repeat for ios/```
查看另外 1 个位置
references/troubleshooting.md:7来自说明文档打开原文件
**Symptom:** Gradle or Xcode build fails after a config change, dependency upgrade, or Expo SDK bump.- **Integrated approach** — regenerate native projects from scratch:  ```sh  npx expo prebuild --clean  ```  Then `cd ios && pod install` and re-open the `.xcworkspace`.- **Isolated approach** — clear the local Maven cache and rebuild the artifact:
会不会绕过安全保护?检查是否跳过网站安全验证、开放过多文件权限,或取消操作前的确认。发现 2 项风险
中风险

指南要求关闭 Xcode 用户脚本沙箱

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

集成流程明确要求把 `ENABLE_USER_SCRIPT_SANDBOXING` 设为 No,并添加会加载 `.xcode.env`、`.xcode.env.local`、`.xcode.env.updates` 以及执行 Node 依赖脚本的构建阶段。关闭沙箱后,这些构建脚本受到的文件访问限制会减少。

为什么需要注意

若项目环境文件、Pods 或 Node 依赖被篡改,恶意脚本可在构建者账户权限下读取或修改更多本机文件;CI 中可访问的签名材料和环境凭据也可能暴露。

这是实现 iOS 集成的主动要求,不是示例警告:用户需关闭 Xcode 用户脚本沙箱,并添加会 `source` 多个环境文件、随后执行从 `node_modules` 解析出的 React Native 脚本的构建阶段。若这些环境文件或依赖被恶意修改,构建时脚本的文件访问约束会更弱。用户可要求解释为何必须全局关闭,并只在受信任、锁定依赖的构建环境中启用。

references/brownfield-integrated.md:350来自说明文档打开原文件
#### 1. Disable user script sandboxingIn Xcode, select your project → app target → **Build Settings**, search for `ENABLE_USER_SCRIPT_SANDBOXING`, and set it to **No**. CocoaPods' Hermes scripts need to switch between debug and release engine binaries at build time, which sandboxing blocks.
查看另外 3 个位置
references/brownfield-integrated.md:358来自说明文档打开原文件
```shif [[ -f "$PODS_ROOT/../.xcode.env" ]]; then  source "$PODS_ROOT/../.xcode.env"fiif [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then  source "$PODS_ROOT/../.xcode.env.local"fi
references/brownfield-integrated.md:381来自说明文档打开原文件
if [[ -f "$PODS_ROOT/../.xcode.env.updates" ]]; then  source "$PODS_ROOT/../.xcode.env.updates"fiif [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then  source "$PODS_ROOT/../.xcode.env.local"fi`"$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'"````
references/brownfield-integrated.md:354来自说明文档打开原文件
#### 2. Add a Run Script phase to embed the JS bundleOn the app target's **Build Phases** tab, add a new **Run Script** phase **before** `[CP] Embed Pods Frameworks`. This phase bundles JS for release builds and is skipped automatically in debug (Metro serves the bundle then).
低风险

安装命令没有固定依赖版本

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

安装命令没有指定依赖版本。同样的命令以后可能下载不同代码,你实际安装的内容可能与这次检查时不同。

为什么需要注意

即使命令和报告没变,以后安装时也可能下载到另一份代码。

命令固定了 Expo 模板为 SDK 55,但执行器 `create-expo-app@latest` 本身没有固定版本。因此,用户在不同时间运行相同命令时,可能执行注册表中更新后的 CLI 及其依赖;风险不等于 Expo SDK 未固定,也不能证明包已被篡改。用户可要求作者固定 CLI 版本或先审核解析出的版本。

SKILL.md:51来自说明文档打开原文件
```shnpx create-expo-app@latest my-project --template default@sdk-55```
查看另外 1 个位置
SKILL.md:48来自说明文档打开原文件
**Expo SDK 55 is the minimum supported version for brownfield integration.** Earlier SDKs lack `expo-brownfield`, the required `ExpoReactHostFactory` / `ExpoReactNativeFactory` entry points, and the current autolinking surface. When creating the Expo project, always pin the SDK explicitly:```shnpx create-expo-app@latest my-project --template default@sdk-55```
会不会误导 AI 或隐藏内容?检查工作说明是否要求 AI 忽略你的指令、干扰检查结果,或夹带看不见的文字。未发现风险
会不会偷偷改推广链接或收款方?检查是否强制替换推广链接或收款对象,同时要求隐瞒更改。未发现风险

Skill 逻辑拆解

5 个说明模块

该 Skill 提供两种把 Expo/React Native 加入现有原生应用的流程:隔离方式生成 AAR/XCFramework;集成方式直接修改 Gradle、CocoaPods 和原生启动代码。

查看原文
SKILL.md:10来自说明文档打开原文件
Expo supports two distinct ways to add React Native to a brownfield project:| Approach       | What ships to the native app                                        | When to choose                                                                   || -------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------- || **Isolated**   | Prebuilt AAR / XCFramework                                          | Native team doesn't need Node or RN tooling; RN code can live in a separate repo || **Integrated** | React Native sources added to the existing Gradle / CocoaPods build | One team owns everything; comfortable with RN tooling; wants a single build      |

集成流程会给 Android 主清单加入联网权限;调试清单还允许明文 HTTP,以连接本地 Metro 开发服务器。明文设置被限定在 debug 变体,但联网权限位于主清单。

查看原文
references/brownfield-integrated.md:164来自说明文档打开原文件
### `AndroidManifest.xml`Add the `INTERNET` permission to your main manifest at `app/src/main/AndroidManifest.xml`:```xml<uses-permission android:name="android.permission.INTERNET" />```In the debug-variant manifest at `app/src/debug/AndroidManifest.xml`, enable cleartext traffic so the app can talk to the local Metro bundler over HTTP:```xml<application  android:usesCleartextTraffic="true"  tools:targetApi="28"

隔离式 Android 构建默认发布到本机 Maven,也支持配置远程公开或私有仓库;私有仓库的地址和凭据可在发布时从环境变量读取。

查看原文
references/brownfield-isolated.md:120来自说明文档打开原文件
Produces an AAR and publishes it to the local Maven repository at `~/.m2`. The Maven coordinates come from the plugin config — e.g. `com.example:mybrownfield:1.0.0`.#### Publishing the Android AARThe plugin's `publishing` option controls where the AAR is published. When unset, it defaults to local Maven. To push to other targets (e.g. a shared CI Maven, an internal Artifactory/Nexus, or a folder pulled into another build), declare the publications explicitly:
references/brownfield-isolated.md:149来自说明文档打开原文件
              },              {                "type": "remotePrivate",                "name": "artifactory",                "url": { "variable": "ARTIFACTORY_URL" },                "username": { "variable": "ARTIFACTORY_USER" },                "password": { "variable": "ARTIFACTORY_TOKEN" }              }            ]          }        }      ]    ]  }}```Supported `type` values: `localMaven`, `localDirectory`, `remotePublic`, `remotePrivate`. For private repos, credentials and URL accept either inline strings or `{ "variable": "ENV_VAR_NAME" }` to read from the environment at publish time.

该 Skill 包含会下载并运行包管理器内容、生成原生项目、构建二进制产物及修改应用构建配置的命令;它不是只读的参考资料。

查看原文
SKILL.md:48来自说明文档打开原文件
**Expo SDK 55 is the minimum supported version for brownfield integration.** Earlier SDKs lack `expo-brownfield`, the required `ExpoReactHostFactory` / `ExpoReactNativeFactory` entry points, and the current autolinking surface. When creating the Expo project, always pin the SDK explicitly:```shnpx create-expo-app@latest my-project --template default@sdk-55```
references/brownfield-isolated.md:112来自说明文档打开原文件
## 2) Build the native libraries### Android```shnpx expo-brownfield build:android```Produces an AAR and publishes it to the local Maven repository at `~/.m2`. The Maven coordinates come from the plugin config — e.g. `com.example:mybrownfield:1.0.0`.
从这里开始 · 工作说明SKILL.md
expo-brownfield
连线表示工作说明包含的模块,不是实际运行顺序。点击模块可查看原文。

文件引用关系图

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

检查范围与遗漏

逐文件查看涉及的内容

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

  • SKILL.md已纳入全文
  • references/brownfield-integrated.md已纳入全文
  • references/brownfield-isolated.md已纳入全文
  • references/comparison.md已纳入全文
  • references/troubleshooting.md已纳入全文
  • agents/openai.yaml已纳入全文

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

  • SKILL.md工作说明
  • agents/openai.yaml配套文件
  • references/brownfield-integrated.md配套文件
  • references/brownfield-isolated.md配套文件
  • references/comparison.md配套文件
  • references/troubleshooting.md配套文件

代码和说明中提到的操作

连接外部网站
SKILL.md:35来自说明文档打开原文件
More information available at https://docs.expo.dev/brownfield/overview/
references/brownfield-integrated.md:65来自说明文档打开原文件
Register the React Native Gradle plugin and Expo autolinking. Reference: [bare-minimum template `settings.gradle`](https://github.com/expo/expo/blob/main/templates/expo-template-bare-minimum/android/settings.gradle).
references/brownfield-integrated.md:123来自说明文档打开原文件
    mavenCentral()    maven { url 'https://www.jitpack.io' }  }
安装其他软件包
SKILL.md:51来自说明文档打开原文件
```shnpx create-expo-app@latest my-project --template default@sdk-55```
SKILL.md:59来自说明文档打开原文件
```bashnpx --yes submit-expo-feedback@latest --category skills --subject "expo-brownfield" "<actionable feedback>"```
references/brownfield-integrated.md:28来自说明文档打开原文件
```shnpx create-expo-app@latest my-project --template default@sdk-55```
运行命令
SKILL.md:58来自说明文档打开原文件
If you encounter errors, misleading or outdated information in this skill, report it so Expo can improve:```bashnpx --yes submit-expo-feedback@latest --category skills --subject "expo-brownfield" "<actionable feedback>"
修改文件
references/brownfield-integrated.md:39来自说明文档打开原文件
mkdir my-project/androidmv /path/to/your/android-project my-project/android/# repeat for ios/
references/troubleshooting.md:16来自说明文档打开原文件
  ```sh  rm -rf ~/.m2/repository/<group>/<libraryName>  npx expo-brownfield build:android
读取文件
references/brownfield-integrated.md:289来自说明文档打开原文件
require 'json'podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
读取密钥或账号配置
references/brownfield-integrated.md:359来自说明文档打开原文件
```shif [[ -f "$PODS_ROOT/../.xcode.env" ]]; then  source "$PODS_ROOT/../.xcode.env"
references/brownfield-integrated.md:360来自说明文档打开原文件
if [[ -f "$PODS_ROOT/../.xcode.env" ]]; then  source "$PODS_ROOT/../.xcode.env"fi
references/brownfield-integrated.md:362来自说明文档打开原文件
fiif [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then  source "$PODS_ROOT/../.xcode.env.local"
读取了多少行
1,200
文件校验值(用于核对版本)
d290920cb769aae047cc8632c572b4ff7d35f9c191cd7692f54c532302839620