Skip to content

fix: pr-bug-scan validated finding from #6335 - #8804

Merged
AmethystLiang merged 3 commits into
mainfrom
bot/pr-bug-scan-6335-1784085783
Jul 15, 2026
Merged

AmethystLiang merged 3 commits into
mainfrom
bot/pr-bug-scan-6335-1784085783

Conversation

@buf0-bot

@buf0-bot buf0-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Automated fix-PR from pr-bug-scan for parent #6335.

Fixer status: FIXED_WITH_CODE_PROOF
Summary: Replaced unguarded crypto.randomUUID() with the established createBrowserUuid() fallback in both markup shape-id call sites.
Blocked proof link: src/renderer/src/components/browser-pane/markup/useMarkupPointerHandlers.ts:60 (and useMarkupEditor.ts:142) — the unguarded crypto.randomUUID() that threw in a non-secure LAN context now calls createBrowserUuid(), which falls back to getRandomValues/Math.random when randomUUID is undefined
Typecheck: skipped

Proof (from validator)

  • C1 — proof_type: code_analysis
    • trigger: On a non-secure LAN web client (plain HTTP), user opens a remote browser tab, clicks the Draw button, and starts any stroke on the markup canvas.
    • observable: onPointerDown throws TypeError: crypto.randomUUID is not a function in the React event handler; setInProgress is never reached, no shape is committed, and every draw/text gesture silently fails — the markup tool appears completely inert.
    • path:
      • src/renderer/src/lib/non-secure-context-crypto.repro.test.ts:26 — proves crypto.randomUUID is undefined and crypto.randomUUID() throws in a plain-HTTP LAN web client
      • src/renderer/src/web/web-preload-api.ts:1195 — web client implements runtimeEnvironments.subscribe (browser.screencast), so RemoteBrowserPagePane renders frames and frameUrl is set
      • src/renderer/src/components/browser-pane/BrowserPane.tsx:2631 — MarkupDrawButton in the remote pane is enabled once frameUrl is truthy
      • src/renderer/src/components/browser-pane/markup/markup-base-image.ts:60 — captureFromImage flattens the same-origin screencast via canvas.toDataURL, so capture succeeds and the overlay opens in state 'drawing'
      • src/renderer/src/components/browser-pane/markup/useMarkupPointerHandlers.ts:60 — onPointerDown calls const id = crypto.randomUUID() unguarded before setInProgress
      • src/renderer/src/components/browser-pane/markup/useMarkupEditor.ts:142 — commitPendingText likewise calls crypto.randomUUID() unguarded

Generated by pr-bug-scan (proof-machine architecture). Human approval required before merge.

orca-bug-scan-bot and others added 3 commits July 15, 2026 16:47
Replaced unguarded crypto.randomUUID() with the established createBrowserUuid() fallback in both markup shape-id call sites.
…tests

PR #8804 replaced two unguarded crypto.randomUUID() calls with
createBrowserUuid(), matching the convention established in #5471, but
shipped without extending that PR's regression-test pattern to the new
call sites. Add hook-level tests for useMarkupPointerHandlers.onPointerDown
and useMarkupEditor.commitPendingText under a simulated non-secure-context
crypto global.

Co-authored-by: Orca <help@stably.ai>
BrowserPane had its own inline crypto.randomUUID guard with a
Date.now()+Math.random() fallback, duplicating the getRandomValues-based
fallback already centralized in createBrowserUuid() and used at every
other call site in the renderer.

Co-authored-by: Orca <help@stably.ai>
@AmethystLiang
AmethystLiang force-pushed the bot/pr-bug-scan-6335-1784085783 branch from 0f3505c to c3860b6 Compare July 15, 2026 23:47
@AmethystLiang
AmethystLiang merged commit f7ef467 into main Jul 15, 2026
1 check passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* fix: address pr-bug-scan validated finding from stablyai#6335

Replaced unguarded crypto.randomUUID() with the established createBrowserUuid() fallback in both markup shape-id call sites.

* fix(review): cover markup crypto fallback call sites with regression tests

PR stablyai#8804 replaced two unguarded crypto.randomUUID() calls with
createBrowserUuid(), matching the convention established in stablyai#5471, but
shipped without extending that PR's regression-test pattern to the new
call sites. Add hook-level tests for useMarkupPointerHandlers.onPointerDown
and useMarkupEditor.commitPendingText under a simulated non-secure-context
crypto global.

Co-authored-by: Orca <help@stably.ai>

* fix(review): consolidate annotation bridge token onto createBrowserUuid

BrowserPane had its own inline crypto.randomUUID guard with a
Date.now()+Math.random() fallback, duplicating the getRandomValues-based
fallback already centralized in createBrowserUuid() and used at every
other call site in the renderer.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: orca-bug-scan-bot <orca-bug-scan-bot@stably.ai>
Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
Co-authored-by: Orca <help@stably.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants