feat: bundle NaïveProxy client (no external plugin required)#23
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughNaïveProxy is converted from an external plugin to a bundled native library. A new build script downloads ABI-specific APKs from GitHub releases and extracts ChangesNaïveProxy Native Bundling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Extract the official klzgrad/naiveproxy client binary from the upstream plugin APKs and bundle it as app/executableSo/<abi>/libnaive.so for all 4 ABIs, so NaïveProxy profiles work without installing the separate moe.matsuri.exe.naive plugin. - buildScript/lib/naive.sh: download the naiveproxy plugin APKs (v149.0.7827.114-1) and extract libnaive.so per ABI (./run lib naive). - PluginManager.initNativeInternal: resolve naive-plugin -> libnaive.so from nativeLibraryDir, mirroring the bundled Mieru/Hysteria mechanism, falling back to the external APK plugin when the bundled binary is absent. - CI: build + cache the naive binary and verify it across the 4 workflows. - libnaive.so is already in Executable.EXECUTABLES, and BoxInstance already launches naive-plugin as a sidecar, so no launch changes are needed. There is no native sing-box Naïve outbound (sing-box only implements a Naïve inbound), and the real client is Cronet/C++; bundling the official binary is the native-without-plugin path, consistent with the other bundled sidecars.
718c006 to
aa56f53
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/build.yml:
- Around line 49-55: Pin the actions/cache action to immutable commit SHAs
instead of mutable version tags across all five cache steps in the workflow (at
lines 28, 51, 84, 93, and 109). For each occurrence of uses: actions/cache@v5,
replace it with uses: actions/cache@<full-commit-sha>, optionally adding a
comment with the version tag (e.g., # v5) for maintainability. This applies to
all cache step instances including the Sidecars Cache step, to eliminate
supply-chain security vulnerabilities from mutable action references.
In @.github/workflows/ci.yml:
- Around line 54-60: The Sidecars Cache step and other cache steps in the
workflow are vulnerable to cache poisoning on pull_request events because they
use actions/cache in write-capable mode by default. Split the cache step into
two separate steps: use actions/cache/restore to read the cache (which should
run on all events), and use actions/cache/save to write the cache (which should
only run on push events by adding a conditional `if: github.event_name ==
'push'`). Additionally, pin both the restore and save actions to specific commit
SHAs instead of using the `@v5` version tag for supply chain security. Apply this
pattern to all four cache steps mentioned: LibCore Cache at 31-37, Sidecars
Cache at 54-60, LibCore Cache at 93-98, and the cache step at 101-107.
In @.github/workflows/release.yml:
- Around line 51-57: All instances of actions/cache in the release workflow are
using mutable version references (e.g., `@v5`) which violates security hardening
policies. Replace every occurrence of actions/cache@v5 with the full-length
commit SHA for that version, and include the version tag in a comment for
readability (format: actions/cache@<commit-sha> # v5). This needs to be done at
all five locations where actions/cache appears in the workflow file: the
instances at the Sidecars Cache step, and the other four locations mentioned in
the comment at lines 30, 86, 95, and 111.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f1a3ea73-eaf7-4c71-8ad8-871ca0db7a1b
📒 Files selected for processing (7)
.github/workflows/build.yml.github/workflows/ci.yml.github/workflows/preview.yml.github/workflows/release.ymlREADME.mdapp/src/main/java/io/nekohasekai/sagernet/plugin/PluginManager.ktbuildScript/lib/naive.sh
✅ Files skipped from review due to trivial changes (1)
- README.md
🚧 Files skipped from review as they are similar to previous changes (3)
- app/src/main/java/io/nekohasekai/sagernet/plugin/PluginManager.kt
- .github/workflows/preview.yml
- buildScript/lib/naive.sh
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
Bundle the official NaïveProxy client binary so NaïveProxy profiles work without
installing the separate external plugin (
moe.matsuri.exe.naive) — the same"native / bundled sidecar" approach already used for Mieru and Hysteria.
Why not a sing-box native outbound?
sing-box has no native NaïveProxy outbound — it only implements a Naïve
inbound (server). The real NaïveProxy client is Cronet (Chromium's C++ network
stack), so there is no pure-Go outbound to enable. Bundling the official client
binary is the correct "native, no separate plugin" path, consistent with the
other bundled sidecars.
Changes
buildScript/lib/naive.sh: download theklzgrad/naiveproxyplugin APKs(pinned
v149.0.7827.114-1) and extractlibnaive.sofor all 4 ABIs(
./run lib naive).PluginManager.initNativeInternal: resolvenaive-plugin→ bundledlibnaive.sofromnativeLibraryDir, falling back to the external APK pluginwhen the bundled binary is absent.
NAIVE_VERSION, build + cache the naivebinary, and verify
libnaive.soacross all 4 ABIs.libnaive.sois already inExecutable.EXECUTABLES, andBoxInstancealreadylaunches
naive-pluginas a sidecar, so no launch-path changes were needed.Verification
./run lib naiveextractslibnaive.sofor arm64-v8a / armeabi-v7a / x86 / x86_64.libnaive.sois bundled in theAPK and runs (
naive 149.0.7827.114).