[GH-ISSUE #3321] [Bug] Trailing app-bundle separators select JavaScript analysis #1191

Closed
opened 2026-10-15 18:31:52 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @coygeek on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/3321

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

CLI

Observed behavior

analyze changes its workflow when a native macOS app-bundle path ends in / or /.. The command returns successful JavaScript application Evidence for the same bundle that otherwise enters native analysis. A directory path produced by shell completion can therefore omit the requested native overview without reporting failure.

With the deliberately unknown standing provider REA_ANALYSIS_PROVIDER=missing-provider, analyze sample.app --json exits 1 and reports capability_unavailable. Both analyze sample.app/ --json and analyze sample.app/. --json exit 0 and report operation: analyze_javascript_application.

The successful trailing-form results describe the bundle directory rather than the native executable. The fixture contains no JavaScript sources, so the JavaScript results contain zero parsed JavaScript files. This is a workflow change rather than a native overview with partial provider facts. The public CLI comparison was reproduced locally; source inspection separately locates the routing decision.

Reproduction

  1. Start from a clean checkout of https://github.com/morluto/rea at revision 8dde6370d0809ad04cda3342d4e6f290f48aa063. From its repository root, install the locked dependencies and build the runtime:
npm ci
npm run build:cached
  1. Run the following commands from the repository root. They create the complete synthetic app-bundle input and an isolated configuration home. The intentionally unknown standing provider keeps the native control from launching an analysis engine:
REA_ENTRYPOINT="$PWD/scripts/rea.mjs"
mkdir rea-app-path-repro
cd rea-app-path-repro
mkdir home
python3 - <<'PYFIXTURE'
from pathlib import Path
import struct
app = Path("sample.app")
(app / "Contents/MacOS").mkdir(parents=True)
(app / "Contents/Info.plist").write_text('<?xml version="1.0"?><plist version="1.0"><dict><key>CFBundleExecutable</key><string>sample</string></dict></plist>')
executable = app / "Contents/MacOS/sample"
executable.write_bytes(struct.pack("<8I", 0xfeedfacf, 0x0100000c, 0, 2, 0, 0, 0, 0))
executable.chmod(0o755)
PYFIXTURE
HOME="$PWD/home" REA_ANALYSIS_PROVIDER=missing-provider node "$REA_ENTRYPOINT" analyze sample.app --json > plain.json
printf 'plain exit: %s\n' "$?"
HOME="$PWD/home" REA_ANALYSIS_PROVIDER=missing-provider node "$REA_ENTRYPOINT" analyze sample.app/ --json > slash.json
printf 'slash exit: %s\n' "$?"
HOME="$PWD/home" REA_ANALYSIS_PROVIDER=missing-provider node "$REA_ENTRYPOINT" analyze sample.app/. --json > dot.json
printf 'dot exit: %s\n' "$?"
python3 - <<'PYRESULT'
import json
for name in ["plain", "slash", "dot"]:
    value = json.load(open(name + ".json"))
    print(name, value.get("code"), value.get("operation"))
PYRESULT
  1. Compare the exit statuses and projected JSON fields. The plain spelling enters native provider selection and rejects the unknown provider; the two trailing spellings return successful JavaScript application Evidence.

Expected behavior

All three path spellings select the same app bundle and enter native analysis. Under the supplied standing provider preference, all three should reject the unknown provider with the same selection error. A trailing directory separator must not turn the bundle into a different analysis target class.

docs/cli.md:111 places directly supplied macOS .app bundles in native overview analysis, and docs/cli.md:142 documents the standing provider preference. The CLI help for analyze accepts an app path without restricting equivalent directory-path spellings.

Impact and scope

Impact level: P2, supported. Valid alternate spellings of a macOS app path change the analysis workflow and return successful Evidence that omits the native overview. Both trailing forms reproduced; broader path variants were not tested.

Workaround status: available. Remove the final / or /. before invoking analyze. The plain spelling was verified to enter native provider selection with the same fixture and environment.

REA version

6.4.0 (main at 8dde6370d0)

Runtime and platform

Node.js v26.10.0; macOS 27.0.1 arm64; built source-checkout CLI runtime.

Target and artifact context

A synthetic thin arm64 Mach-O header inside a local macOS app bundle, with Contents/Info.plist selecting Contents/MacOS/sample. The bundle contains no JavaScript sources. The standing provider is deliberately unknown, so no external analysis engine is needed for the reproduced comparison.

Interface

CLI

Earliest failure stage

Request parsing or validation

Relevant output or evidence

The executed CLI calls and projection command produced:

plain exit: 1
slash exit: 0
dot exit: 0
plain capability_unavailable None
slash None analyze_javascript_application
dot None analyze_javascript_application

Typed outcome or recovery expected

Repeat the fixture commands. All three path spellings must select native analysis and report the unknown standing provider with exit 1. With a usable explicitly configured native provider, all three should produce a native overview of the same executable. Preserve the documented JavaScript route for ordinary extracted application directories when no binary-analysis option is supplied.

Analysis or suspected cause

Source-derived reasoning: src/cli/coreBinaryCommands.ts:82 dispatches the selected lane, and src/cli/coreBinaryCommands.ts:235 tests the unnormalized path suffix before using the directory result. The .app suffix check excludes the plain bundle spelling from JavaScript analysis, while the trailing / and /. spellings fall through to the directory check. This is consistent with the independently observed operation and exit-status differences for equivalent paths.

Additional context

Related completed report #720 concerns misleading doctor/open_binary diagnostics for a supported JavaScript directory; this report concerns native app bundles incorrectly selecting JavaScript analysis based on their path spelling.

Related completed report #765 concerns whitespace lost from CFBundleExecutable during executable resolution; this report changes the analysis lane before that resolution.

Related completed report #1486 concerns case policy in Apple bundle anatomy projection; this report concerns trailing separators in local CLI app-bundle paths.

Related open report #3307 concerns empty URL path segments selecting the wrong ESM/HTML dependency file inside JavaScript analysis; this report concerns selecting JavaScript analysis for a native bundle.

Originally created by @coygeek on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/3321 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area CLI ### Observed behavior `analyze` changes its workflow when a native macOS app-bundle path ends in `/` or `/.`. The command returns successful JavaScript application Evidence for the same bundle that otherwise enters native analysis. A directory path produced by shell completion can therefore omit the requested native overview without reporting failure. With the deliberately unknown standing provider `REA_ANALYSIS_PROVIDER=missing-provider`, `analyze sample.app --json` exits 1 and reports `capability_unavailable`. Both `analyze sample.app/ --json` and `analyze sample.app/. --json` exit 0 and report `operation: analyze_javascript_application`. The successful trailing-form results describe the bundle directory rather than the native executable. The fixture contains no JavaScript sources, so the JavaScript results contain zero parsed JavaScript files. This is a workflow change rather than a native overview with partial provider facts. The public CLI comparison was reproduced locally; source inspection separately locates the routing decision. ### Reproduction 1. Start from a clean checkout of `https://github.com/morluto/rea` at revision `8dde6370d0809ad04cda3342d4e6f290f48aa063`. From its repository root, install the locked dependencies and build the runtime: ```sh npm ci npm run build:cached ``` 2. Run the following commands from the repository root. They create the complete synthetic app-bundle input and an isolated configuration home. The intentionally unknown standing provider keeps the native control from launching an analysis engine: ```sh REA_ENTRYPOINT="$PWD/scripts/rea.mjs" mkdir rea-app-path-repro cd rea-app-path-repro mkdir home python3 - <<'PYFIXTURE' from pathlib import Path import struct app = Path("sample.app") (app / "Contents/MacOS").mkdir(parents=True) (app / "Contents/Info.plist").write_text('<?xml version="1.0"?><plist version="1.0"><dict><key>CFBundleExecutable</key><string>sample</string></dict></plist>') executable = app / "Contents/MacOS/sample" executable.write_bytes(struct.pack("<8I", 0xfeedfacf, 0x0100000c, 0, 2, 0, 0, 0, 0)) executable.chmod(0o755) PYFIXTURE HOME="$PWD/home" REA_ANALYSIS_PROVIDER=missing-provider node "$REA_ENTRYPOINT" analyze sample.app --json > plain.json printf 'plain exit: %s\n' "$?" HOME="$PWD/home" REA_ANALYSIS_PROVIDER=missing-provider node "$REA_ENTRYPOINT" analyze sample.app/ --json > slash.json printf 'slash exit: %s\n' "$?" HOME="$PWD/home" REA_ANALYSIS_PROVIDER=missing-provider node "$REA_ENTRYPOINT" analyze sample.app/. --json > dot.json printf 'dot exit: %s\n' "$?" python3 - <<'PYRESULT' import json for name in ["plain", "slash", "dot"]: value = json.load(open(name + ".json")) print(name, value.get("code"), value.get("operation")) PYRESULT ``` 3. Compare the exit statuses and projected JSON fields. The plain spelling enters native provider selection and rejects the unknown provider; the two trailing spellings return successful JavaScript application Evidence. ### Expected behavior All three path spellings select the same app bundle and enter native analysis. Under the supplied standing provider preference, all three should reject the unknown provider with the same selection error. A trailing directory separator must not turn the bundle into a different analysis target class. `docs/cli.md:111` places directly supplied macOS `.app` bundles in native overview analysis, and `docs/cli.md:142` documents the standing provider preference. The CLI help for `analyze` accepts an app path without restricting equivalent directory-path spellings. ### Impact and scope Impact level: P2, supported. Valid alternate spellings of a macOS app path change the analysis workflow and return successful Evidence that omits the native overview. Both trailing forms reproduced; broader path variants were not tested. Workaround status: available. Remove the final `/` or `/.` before invoking `analyze`. The plain spelling was verified to enter native provider selection with the same fixture and environment. ### REA version 6.4.0 (main at 8dde6370d0809ad04cda3342d4e6f290f48aa063) ### Runtime and platform Node.js v26.10.0; macOS 27.0.1 arm64; built source-checkout CLI runtime. ### Target and artifact context A synthetic thin arm64 Mach-O header inside a local macOS app bundle, with `Contents/Info.plist` selecting `Contents/MacOS/sample`. The bundle contains no JavaScript sources. The standing provider is deliberately unknown, so no external analysis engine is needed for the reproduced comparison. ### Interface CLI ### Earliest failure stage Request parsing or validation ### Relevant output or evidence The executed CLI calls and projection command produced: ```text plain exit: 1 slash exit: 0 dot exit: 0 plain capability_unavailable None slash None analyze_javascript_application dot None analyze_javascript_application ``` ### Typed outcome or recovery expected Repeat the fixture commands. All three path spellings must select native analysis and report the unknown standing provider with exit 1. With a usable explicitly configured native provider, all three should produce a native overview of the same executable. Preserve the documented JavaScript route for ordinary extracted application directories when no binary-analysis option is supplied. ### Analysis or suspected cause Source-derived reasoning: `src/cli/coreBinaryCommands.ts:82` dispatches the selected lane, and `src/cli/coreBinaryCommands.ts:235` tests the unnormalized path suffix before using the directory result. The `.app` suffix check excludes the plain bundle spelling from JavaScript analysis, while the trailing `/` and `/.` spellings fall through to the directory check. This is consistent with the independently observed operation and exit-status differences for equivalent paths. ### Additional context Related completed report [#720](https://github.com/morluto/rea/issues/720) concerns misleading doctor/open_binary diagnostics for a supported JavaScript directory; this report concerns native app bundles incorrectly selecting JavaScript analysis based on their path spelling. Related completed report [#765](https://github.com/morluto/rea/issues/765) concerns whitespace lost from `CFBundleExecutable` during executable resolution; this report changes the analysis lane before that resolution. Related completed report [#1486](https://github.com/morluto/rea/issues/1486) concerns case policy in Apple bundle anatomy projection; this report concerns trailing separators in local CLI app-bundle paths. Related open report [#3307](https://github.com/morluto/rea/issues/3307) concerns empty URL path segments selecting the wrong ESM/HTML dependency file inside JavaScript analysis; this report concerns selecting JavaScript analysis for a native bundle.
Author
Owner

@Sriram-PR commented on GitHub (Oct 14, 2026):

I'll take this one, PR shortly.

<!-- gh-comment-id:6169618179 --> @Sriram-PR commented on GitHub (Oct 14, 2026): I'll take this one, PR shortly.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#1191
No description provided.