Skip to content

fix(apple): derive dyld environment findings from each traced slice - #2733

Merged
morluto merged 1 commit into
mainfrom
fix/issue-2661
Oct 13, 2026
Merged

morluto merged 1 commit into
mainfrom
fix/issue-2661

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

Fixes #2661.

Problem

deriveFindings (src/domain/apple/dylibResolutionFindings.ts) builds dyld-environment-present findings by looking up each traced root's slice again by architecture name:

facts.slices.find((candidate) => candidate.architecture === architecture)

A universal executable with arm64e and arm64e.x1 slices reports both as arm64e, so both roots resolved to the first slice:

  • If only the second slice has LC_DYLD_ENVIRONMENT, there is no finding at all.
  • If both slices have different settings, the first slice's command is reported twice and the second slice's command is missing.

The per-slice images[].slices[].dyld_environment arrays were already correct, so only the derived findings were wrong.

Fix

traceDylibLoading already has the exact slice when it records each root. It now passes { image, slice } pairs to deriveFindings instead of having the findings code re-derive the slice from its name. The unused images lookup parameter is removed.

The public roots ({ image, architecture }) and findings shapes are unchanged, so no schema or catalog change is needed.

Validation

  • New CLI boundary test, dylibResolutionCli.test.ts > reports each same-named slice's own embedded dyld environment. It runs rea trace-dylib-resolution on a FAT executable with arm64e and arm64e.x1 slices, in two cases: a setting on the second slice only, and distinct settings on both slices. It asserts one dyld-environment-present finding per slice carrying that slice's own setting. It fails on main and passes here.
  • All dylib-resolution suites pass (5 files, 146 tests). npm run check:fast and format:check pass.

🤖 Generated with Claude Code

deriveFindings looked up each traced root's slice again by architecture
name. A universal executable with arm64e and arm64e.x1 slices reports
both as "arm64e", so both roots resolved to the first slice: a later
slice's LC_DYLD_ENVIRONMENT produced no finding, or the first slice's
command was reported twice. The per-slice dyld_environment arrays were
already correct.

traceDylibLoading already has the exact slice when it records a root, so
pass it to deriveFindings instead of re-deriving it from the name. The
public roots and findings shapes are unchanged.

Fixes #2661

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T09:31:53.375311Z 173fde4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable defects were found.

Summary

The PR fixes missing or duplicated dyld-environment-present findings by passing each root's exact traced slice to deriveFindings.

  • Each dyld environment finding now comes from its own traced slice.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["Selected parsed slice"] --> B["traceProcess"]
  A --> C["rootSlices: image + exact slice"]
  A --> D["Public roots: image + architecture"]
  C --> E["deriveFindings"]
  B --> F["Edges"]
  F --> E
  E --> G["Findings with each slice's own environment"]
Loading

Reviews (1) · Last reviewed commit: "fix(apple): derive dyld environment find..." · Reviewed by Greptile

@morluto
morluto merged commit 52d4ce6 into main Oct 13, 2026
31 of 33 checks passed
@morluto
morluto deleted the fix/issue-2661 branch October 13, 2026 09:42
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@morluto morluto added the bug Something isn't working label Oct 14, 2026
@morluto morluto added the area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior label Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(apple): retain later same-named slice settings in dylib findings

2 participants