Skip to content

fix(javascript): preserve nested array iterator dependencies - #12558

Merged
morluto merged 4 commits into
mainfrom
audit/second-native-array-read-order
Nov 19, 2026
Merged

morluto merged 4 commits into
mainfrom
audit/second-native-array-read-order

Conversation

@morluto

@morluto morluto commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Follow-up in #12563. Static controls confirmed that the merged head can still lose the effect of a prototype alias stored through an array spread. The follow-up corrects the ambient source lookup and verifies the regression on current main.

Problem

A direct nested array pattern can lose an exact dependency even after the semantic graph proves which native array supplied the outer slot. This continues #7716 and follows #12551. The initial PR let an override through a reflected array prototype alias bypass the native iterator guard.

Change

Reuse the outer slot proof, check the inner iterator at acquisition, and end the proof at its close. Record writes through reflected array prototype aliases in the existing ambient effect log and seed the iterator guard from those facts before selecting slots. This keeps uncertain or deeper patterns as candidates and applies the existing conservative prototype policy to reflected aliases.

Validation

  • The original change recovered six intended dependencies with stable IDs and preserved eight paired controls. All 770 focused source tests passed before the follow-up.
  • On the first PR head, four added regression cases failed. The follow-up passed all 729 source tests across 13 suites, the compiled CLI regression, and check:fast. Paired CLI output changed the overridden case from resolved to candidate and removed it from the default trace. Independent checks covered Object and Reflect aliases, early calls, harmless writes, and shadowed globals.
  • Validation used static source analysis of authored inputs.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T22:48:28.271640Z dfd3e22 New commits
ℹ️ 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 Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] No newly reportable issue was found in the changes since the previous review.

Summary

Preserves exact dependencies for one native array nested inside another. Records writes through reflected array prototype aliases and uses those facts before proving native iteration.

  • Nested array patterns can keep exact paths to their inner values.
  • Reflected writes to array prototypes can make later iteration uncertain.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["Reflected array prototype alias"] --> B["Record shared prototype write"]
  B --> C["Set arrayIterationUnknown"]
  C --> D{"Native iteration still proved?"}
  D -->|Yes| E["Preserve nested slot dependency"]
  D -->|No| F["Keep dependency as candidate"]
Loading

Reviews (4) · Last reviewed commit: "test(javascript): keep array prototype a..." · Reviewed by Greptile

@morluto
morluto enabled auto-merge (squash) November 19, 2026 22:40
@morluto
morluto disabled auto-merge November 19, 2026 22:41
@morluto
morluto enabled auto-merge (squash) November 19, 2026 22:45
@morluto
morluto disabled auto-merge November 19, 2026 22:48
@morluto
morluto merged commit 473b3ee into main Nov 19, 2026
41 of 42 checks passed
@morluto
morluto deleted the audit/second-native-array-read-order branch November 19, 2026 22:58
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Nov 22, 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.

1 participant