Repository navigation
feat(electron): report custom URL protocol registrations - #2978
gensokyo-dev merged 7 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Looks like a really interesting PR |
[Medium impact] This PR appears safe to merge, with the previous wording issue fixed and no new findings. SummaryThis PR records static Electron URL protocol calls and adds
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[JavaScript source] --> B[Static Electron analysis]
B --> C[Protocol call findings]
C --> D[URL scheme nodes and relations]
C --> E[Registration count]
D --> F[Shared CLI and MCP results]
E --> F
Reviews (15) · Last reviewed commit: "docs(electron): distinguish protocol cal..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09ed16e609
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@morluto thanks! glad it's useful fixed the review stuff in a2b9257:
if you'd want these as graph nodes in the boundary graph instead of just file facts + the count, i can do that as a follow up |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2b9257163
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
fixed the |
|
TL;DR: All 26 tests in the two changed test files pass on the PR head, and 5 older Electron test files also pass (252 tests). On plain main, the 10 new protocol tests fail, as they should for a new feature. The PR does not apply to current main as is, so I tested its own tree. Edit: This is out of date. The author rebased the PR, and the new head merges cleanly into main. I retested it here. The other items under Not run below have not run yet. I tested head fc886cd, which sits on merge base 2895a18. Main was at 5b16f24. CI has not run on this PR. Its runs wait for a maintainer to approve them. Only the Greptile check ran, and it passed. Results
Not run
Thanks, UnknownHacker1, for the work. Commandsgit -C ~/code/rea-mirror/rea.git fetch origin
git -C ~/code/rea-mirror/rea.git archive refs/pull/2978/head | tar -x -C /tmp/look-1015/t2978-head
npm ci # Node 24.18.0, exit 0 (the PR lock file differs from main)
npm run test:focused -- src/domain/javascript/electronStaticAnalysisProtocol.test.ts src/domain/javascript/javascriptApplicationAnalysisSteps.test.ts # exit 0, 26 passed
npm run test:focused -- src/domain/javascript/electronModuleInterop.test.ts src/domain/javascript/electronNativeLoaderPaths.test.ts src/domain/javascript/electronStaticAnalysisIdentity.test.ts src/domain/javascript/electronStaticAnalysisOptions.test.ts src/domain/javascript/electronWrappedCallPaths.test.ts # exit 0, 252 passed
# git apply onto main fails in: src/application/javascript/JavaScriptArtifactAnalysis.ts, src/domain/javascript/javascriptStaticAnalysisState.ts
# main 5b16f2431 tree, the two PR test files copied in, first command again: exit 1, 10 failed, 16 passedTest setup🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
fc886cd to
445d04c
Compare
|
@CassieFox23 thanks for testing this!! good catch on it not applying to current main. rebased onto e2db768 (head is 445d04c now), same 3 commits, nothing else changed. on top of current main: typecheck clean, all 75 javascript domain test files pass (1824 tests), 0 lint errors, and it still picks up all 3 registrations on a real electron app. also ran the 4 boundary files that read the summary, everything passes except one whitespace ESM path test in javascriptSelfImportRelationships that fails on plain main too on windows (my repo path has a space in it), so thats not from this |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 445d04c8cd
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
fixed the per-value one in 01036e4. |
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01036e4221
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
01036e4 to
b247ab7
Compare
|
@morluto This should be ready now. Rebased on current main (7e4eed9), no conflicts, and every bot thread is addressed. The big addition since you looked is that the schemes now show up as |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b247ab7b8b
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
TL;DR: I retested head b247ab7. It merges cleanly into current main. Both changes the author described work. They are the per-value unwrap and the new The head is b247ab7, rebased onto 7e4eed9. Main was at eb2c3b5. My earlier test used head fc886cd, which did not apply to main. CI has still not run on this PR. Its three runs wait for a maintainer to approve them, and only the Greptile check ran. Results
Not run
Thanks, UnknownHacker1, for the rebase and for the quick fixes. Commandsgit -C ~/code/rea-mirror/rea.git fetch origin
git -C ~/code/rea-mirror/rea.git archive b247ab7b8 | tar -x -C /tmp/rea-rt-2978/head
git -C ~/code/rea-mirror/rea.git archive eb2c3b589 | tar -x -C /tmp/rea-rt-2978/main
# merge check, in a scratch repo under /tmp with objects fetched from the mirror
git -C /tmp/rea-rt-2978/mt merge-tree --write-tree --name-only eb2c3b589 b247ab7b8 # exit 0, tree fab0927cb, no conflicts
npm ci && npm run build:cached && npm run test:prepare # Node 24.18.0, in head and in main, all exit 0
npm run test:focused -- src/domain/javascript/electronStaticAnalysisProtocol.test.ts src/domain/javascript/javascriptApplicationAnalysisSteps.test.ts # head, Node 24: exit 0, 29 passed
npm run test:focused -- src/domain/javascript/electronModuleInterop.test.ts src/domain/javascript/electronNativeLoaderPaths.test.ts src/domain/javascript/electronStaticAnalysisIdentity.test.ts src/domain/javascript/electronStaticAnalysisOptions.test.ts src/domain/javascript/electronWrappedCallPaths.test.ts # head, Node 24: exit 0, 392 passed
npm run test:focused -- tests/boundary/filesystem/javascript-applications/electronProtocolBoundaries.test.ts # head, Node 24: exit 0, 2 passed
npm run test:focused -- src/domain/javascript/electronStaticAnalysisProtocol.test.ts src/domain/javascript/javascriptApplicationAnalysisSteps.test.ts tests/boundary/filesystem/javascript-applications/electronProtocolBoundaries.test.ts # head, Node 22.23.1: exit 0, 31 passed; Node 26.11.1: exit 0, 31 passed
# main eb2c3b589 with those three test files copied in from the head, same command, Node 24: exit 1, 13 failed, 18 passed
# merged tree laid over the main tree (same lock file), build:cached exit 0, then the three files plus the five older files, Node 24: exit 0, 430 passed
# merged tree, all 44 test files with "electron" in the name, Node 24: exit 0, 829 passed, 1 skipped
# a throwaway probe test (not part of the PR) printed the findings and graph nodes quoted above
gh api graphql # query only: reviewThreads(first:50) isResolved / isOutdatedTest setup🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
b247ab7 to
cb64564
Compare
|
@CassieFox23 Thanks again for retesting, you were right about both. Fixed in cb64564: literal spreads in privileges are read now (last definition wins), and a non-string literal like |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb64564d62
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f900b72e92
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Thanks for the fixes, UnknownHacker1, they help a lot. This is a read of the mirror, not a retest. cb64564 is in the PR, and its tests for literal spreads in privileges are in My earlier results cover head b247ab7 only. I have not retested f900b72. The checks listed on f900b72 show only Greptile and the author declaration, so no test job ran there. 🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊 |
Detect app.setAsDefaultProtocolClient, protocol.registerSchemesAsPrivileged, and protocol handlers and interceptors on protocol or session.defaultSession.protocol as electron.protocols findings. Project each scheme into the application graph as a url-scheme node linked by handles or exposes, count registrations in the summary, end feature traces at schemes, and give them a reconstruction obligation policy.
A handler or interceptor without a callback, and a privileged scheme list that is known not to be an array, install nothing in Electron, so they are no longer reported. The privileges lookup now reads past nullish entry spreads like the scheme lookup.
f900b72 to
a9c1a51
Compare
|
@CassieFox23 Thanks for catching the name. Yeah, Also rebased onto current main (64196b0) since it had conflicts again, and fixed the three new Codex threads (handlers with no callback and non-array privileged lists no longer count as registrations). Validation in the description is updated for the new head a9c1a51. Main's CI jobs don't seem to run on fork PRs here until a maintainer approves them, so the local runs are what I have for now. |
…d lists Electron converts the whole privileged list or throws, so a hole, a non-object entry or an entry without a scheme now means the call registers nothing. A privilege value that is not a boolean literal makes the set unknown instead of dropping it, and allowExtensions is read.
|
@morluto Hey, whenever you get a chance, this one should be ready for a look. It's rebased on current main with no conflicts, all review threads are addressed, and the readiness check passes. CI is waiting on workflow approval since it's from a fork. Happy to change anything if you'd rather it go a different way. Thanks! |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
gensokyo-dev
left a comment
There was a problem hiding this comment.
Reviewed the integrated diff at cfaf0f7 against current main, including the shared identity producer, graph projection, version/feature consumers, worker contract and historical summaries.
The two reproduced defects are fixed at their owning boundaries: schemes use case-insensitive canonical identity with original source spelling retained, and the module-only privileged-scheme API is excluded from session protocol objects. Static call observations no longer claim reachability or successful routing.
Validation: 5,253 JavaScript tests passed (one existing skip), 41 public boundary/worker tests passed, 47 reconstruction consumer tests passed, and static/docs/format checks passed. Real Obsidian 1.8.10 CLI and actual stdio MCP pages match all three selected-source call sites, scheme identities and locations. Final-head rerun preserves the exact facts/provenance. CPU, elapsed time, process-family RSS and token estimates are recorded in the PR body.
The Obsidian 1.14.5 shared alias-capacity limitation is explicitly recorded as partial/unknown, not absence. Non-default sessions, receiver TypeScript assertions and runtime OS routing remain unverified/out of scope. Codex remote review could not run due repository credit limits. This is an AI-assisted code review; it does not replace the original author's human ownership declaration. Current-head CI and Greptile must finish before merge.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
gensokyo-dev
left a comment
There was a problem hiding this comment.
Re-reviewed final follow-up c474f5f. The only change since the prior integration review is replacing the protocol detector's new delimiter-joined internal key with the existing compositeKey owner. Architecture guards now pass without an exemption. The 61 targeted source tests, 41 public protocol/worker tests and check:fast pass. Final real Obsidian CLI output preserves exact protocol identities/provenance, and actual MCP fact pages again match all three independent source positions.
My earlier review and its explicit static-analysis/coverage limitations still apply. This is an AI-assisted review; final-head CI and Greptile are tracked separately.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Problem and outcome
REA could inspect Electron internals but did not expose custom URL protocol entry-point facts. This change records static registration calls, projects
url-schemenodes and relations, and adds an optional registration count. The existing CLI/MCP workflows share the same implementation; no provider, dependency, target execution or new tool is introduced.Supported calls:
app.setAsDefaultProtocolClient, module-levelprotocol.registerSchemesAsPrivileged, protocol handlers/interceptors, and handlers/interceptors onsession.defaultSession.protocol. Findings retain source locations, artifact digests, API, role, session and privileges. Dynamic values remain unknown. Registration success, control-flow reachability and OS/session routing remain unproven.Valid scheme identity is case-insensitive; original spelling is preserved per observation. Historical summaries without the count remain readable. Existing
javascript-factsviews support filtering, field selection, paging and retained Evidence. Non-default sessions, URL event listeners and TypeScript assertions on receivers remain outside this change.Integration review
Integrated against main
69bf61f7c. Additional corrections:Appandappshare identity while raw values survive. A new public boundary regression was observed failing before the fix. Electron scheme rules.compositeKeyowner for finding deduplication, fixing the first CI architecture-guard failure without an exemption.Validation
Final head:
3570044eadadc7866ad4bfa75f3e18628112655c.Portable testsandCI requiredpassed (run). Static checks, build, documentation, JavaScript recovery, bundled Windows controls and Linux native package baseline passed.check:fast,docs:check, architecture guards, touched-file formatting and diff checks passed. The final follow-up changes only JSDoc, with no runtime statement changes.Real application: official Obsidian 1.8.10 updater ASAR, SHA-256
f9e1d3030d2d165a559f339a91a100e1d3381972a4ce5fdb3b481bd550681dd6. Public CLI analysis selects packagedmain.js(33,318 bytes; SHA-256dea142680af9272f0663a5857f6135ba69c54dcb10e5382b943793295d55169e). Actual CLI and stdio MCP paged facts match an independent source-call/position check:registerFileProtocol("app"),handle("app"), andsetAsDefaultProtocolClient("obsidian"), at line 38 columns 4128, 4266 and 14388. Three call sites, two canonical nodes; the first two are conditional alternatives. This verifies the selected packaged file, not the entire application or runtime routing. The target was never executed. Runtime validation was repeated onc474f5ffc; the final commit only corrects type JSDoc.Real limit probe: Obsidian 1.14.5, SHA-256
3a349274f789b62c5b35ad19de10311909a94e8783033569c2210a4bac491780, selectingmain.jsandstarter.js. Shared analysis reports its existing 512-state alias limit and cannot prove the receivers of three visible protocol calls. Evidence remains partial/unknown with zero confirmed registrations; this is a coverage gap, not an absence claim. Limits and shared identity rules were preserved.Performance and context
Fresh processes, four-CPU affinity, 512 MiB analysis heap, 100 ms process-family RSS sampling including separate sessions. OS caches were uncontrolled: these are single observations, not controlled cold/warm measurements. Comparison pins baseline
0ffed7a48and the integrated feature tree before the last unrelated main refresh.No speedup claim. Final runtime recheck: 10.431 s elapsed, 11.629 s CPU, 678.7 MiB RSS, identical protocol facts/provenance. The 1.14.5 probe completed before/after in 40.110 / 40.952 s, CPU 42.924 / 43.962 s and RSS 994.6 / 1009.9 MiB; those two probes shared CPU and do not establish isolated latency. The broad local JavaScript run used 66.408 s elapsed, 110.229 s CPU and 1,898.7 MiB sampled family RSS while sharing CPU with static/build checks.
Token estimates (
[email protected]; actual billing unmeasured): selected CLI summary 3,514 → 3,523; relevant MCP input schemas unchanged at 5,024; full relevant definitions 196,186 → 196,219. Summary plus two actual paged MCP request/response exchanges estimates 18,058 tokens, excluding tool definitions. The 17.1 MB complete Evidence stays local. Pages select properties and preserve identity, provenance, coverage and limitations. Existing Evidence parsing/transport costs are included in the observed workflow; no cache was added.Executed integration checks above were on Linux/Node 24.22.1. The original contributor's Windows/editor validation remains historical evidence in the discussion, not a claim of additional current-head OS/runtime verification.
Author readiness
Human owner: @UnknownHacker1