[GH-ISSUE #5229] [Bug] One unreadable entry fails directory analysis, and inventory omissions leave the application graph complete #3200

Open
opened 2026-10-31 00:37:46 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @rodricksz4h5 on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/5229

Before submitting

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

Area

Evidence, artifacts, or reconstruction

Observed behavior

rea analyze <directory> (and MCP analyze_javascript_application) fails the whole analysis with artifact_operation_failed / reason io when any one entry in the application directory is unreadable by the current user: a file (Could not open entry ... EACCES) or a subdirectory (Could not open directory ... EACCES). Nothing is returned for the readable files.

Separately, entries that inventory already omits (FIFOs, sockets, devices: inventory coverage unknown with Artifact traversal omitted fifo at "lib/pipe".) do not reach the application graph, which reports coverage complete.

Reproduction

  1. An app directory: package.json ("main": "lib/a.js"), lib/a.js, lib/key.pem, secret/key.
  2. chmod 000 lib/key.pem secret (as an ordinary user, not root).
  3. rea analyze <dir> --format json.

For the second case: the same app with mkfifo lib/pipe instead of step 2.

Expected behavior

As the filesystem snapshot (#2545) and reference imports (#4013) already do for unreadable entries: the readable files are analyzed, an unreadable file is an occurrence with hash_status: "unavailable", an unreadable subdirectory is a traversal omission, and coverage is not complete. An unreadable root still fails.

Impact and scope

Any application directory with one entry the user cannot read (a 0600 file owned by another user, a root-owned cache or lock directory inside an installed app) cannot be analyzed at all. The graph's complete coverage for inventory-omitted special files is a false completeness claim.

REA version

main 39275420

Runtime and platform

Node 24.18.0, Linux (node:24.18.0-bookworm, non-root user), REA built from source

Target and artifact context

Generated CommonJS application directories

Interface

CLI

Earliest failure stage

Artifact acquisition or inventory

Relevant output or evidence

main 39275420:

error artifact_operation_failed io Could not open entry at /tmp/e2e/app/lib/key.pem (EACCES): EACCES: permission denied, open '/tmp/e2e/app/lib/key.pem'

FIFO app: graph coverage {"status":"complete","truncated":false,"omitted_count":0,"limits":[]}, no mention of lib/pipe.

Analysis or suspected cause

Source-derived: DirectoryArtifactReader throws directoryIoFailure for any opendir/open error, and scanReader tolerates an open failure only for an unavailable unpacked ASAR entry, so one EACCES ends the inventory. readJavaScriptArtifactFiles walks the directory again with the same reader. graphCoverage in JavaScriptArtifactGraphBuilder.ts never reads snapshot.coverage, so inventory omissions are dropped.

Additional context

Searched issues and PRs (open and closed) for unreadable / EACCES / permission denied / traversal omitted; checked the files of all 579 open PRs: #5207, #5127, #5048, #4941 and others change the same files for other reasons, and none handles access-denied entries or inventory coverage in the application graph.

Originally created by @rodricksz4h5 on GitHub (Oct 19, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5229 ### 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 Evidence, artifacts, or reconstruction ### Observed behavior `rea analyze <directory>` (and MCP `analyze_javascript_application`) fails the whole analysis with `artifact_operation_failed` / reason `io` when any one entry in the application directory is unreadable by the current user: a file (`Could not open entry ... EACCES`) or a subdirectory (`Could not open directory ... EACCES`). Nothing is returned for the readable files. Separately, entries that inventory already omits (FIFOs, sockets, devices: inventory coverage `unknown` with `Artifact traversal omitted fifo at "lib/pipe".`) do not reach the application graph, which reports coverage `complete`. ### Reproduction 1. An app directory: `package.json` (`"main": "lib/a.js"`), `lib/a.js`, `lib/key.pem`, `secret/key`. 2. `chmod 000 lib/key.pem secret` (as an ordinary user, not root). 3. `rea analyze <dir> --format json`. For the second case: the same app with `mkfifo lib/pipe` instead of step 2. ### Expected behavior As the filesystem snapshot (#2545) and reference imports (#4013) already do for unreadable entries: the readable files are analyzed, an unreadable file is an occurrence with `hash_status: "unavailable"`, an unreadable subdirectory is a traversal omission, and coverage is not `complete`. An unreadable root still fails. ### Impact and scope Any application directory with one entry the user cannot read (a `0600` file owned by another user, a root-owned cache or lock directory inside an installed app) cannot be analyzed at all. The graph's `complete` coverage for inventory-omitted special files is a false completeness claim. ### REA version main 39275420 ### Runtime and platform Node 24.18.0, Linux (`node:24.18.0-bookworm`, non-root user), REA built from source ### Target and artifact context Generated CommonJS application directories ### Interface CLI ### Earliest failure stage Artifact acquisition or inventory ### Relevant output or evidence main 39275420: ``` error artifact_operation_failed io Could not open entry at /tmp/e2e/app/lib/key.pem (EACCES): EACCES: permission denied, open '/tmp/e2e/app/lib/key.pem' ``` FIFO app: graph coverage `{"status":"complete","truncated":false,"omitted_count":0,"limits":[]}`, no mention of `lib/pipe`. ### Analysis or suspected cause Source-derived: `DirectoryArtifactReader` throws `directoryIoFailure` for any `opendir`/`open` error, and `scanReader` tolerates an `open` failure only for an unavailable unpacked ASAR entry, so one EACCES ends the inventory. `readJavaScriptArtifactFiles` walks the directory again with the same reader. `graphCoverage` in `JavaScriptArtifactGraphBuilder.ts` never reads `snapshot.coverage`, so inventory omissions are dropped. ### Additional context Searched issues and PRs (open and closed) for unreadable / EACCES / permission denied / traversal omitted; checked the files of all 579 open PRs: #5207, #5127, #5048, #4941 and others change the same files for other reasons, and none handles access-denied entries or inventory coverage in the application graph.
Author
Owner

@x1mm4nu3l commented on GitHub (Oct 20, 2026):

Confirmed on main 2538214e2, Linux/Node 24.18.0, as UID 1000: unreadable child files and directories abort analyze with EACCES, while an unreadable root correctly returns access_denied. The FIFO case also reproduces through stdio MCP: raw inventory reports unknown coverage and names lib/pipe, but application analysis reports complete coverage and omits that limitation. The readable control succeeds.

<!-- gh-comment-id:6286501977 --> @x1mm4nu3l commented on GitHub (Oct 20, 2026): Confirmed on main 2538214e2, Linux/Node 24.18.0, as UID 1000: unreadable child files and directories abort `analyze` with EACCES, while an unreadable root correctly returns `access_denied`. The FIFO case also reproduces through stdio MCP: raw inventory reports unknown coverage and names lib/pipe, but application analysis reports complete coverage and omits that limitation. The readable control succeeds.
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#3200
No description provided.