Skip to content

fix(browser): reject non-decimal --wait-ms during extension install - #130626

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
xydt-juyaohui:fix/browser-extension-install-wait-strict-parse
Aug 27, 2026
Merged

vincentkoc merged 2 commits into
openclaw:mainfrom
xydt-juyaohui:fix/browser-extension-install-wait-strict-parse

Conversation

@xydt-juyaohui

@xydt-juyaohui xydt-juyaohui commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where browser extension install --wait-ms would silently accept
non-decimal strings as valid wait times. Because normalizeExtensionInstallWaitMs
coerced the user-supplied value with Number(), inputs such as 0x1000 (4096ms),
1e4 (10000ms), or +50000 (50000ms) passed the integer/range checks and were
used as the install wait instead of being rejected. A typo like --wait-ms 1e4
could produce a far shorter registration wait than intended, with no error.

Why This Change Was Made

The browser plugin now validates --wait-ms at its owning normalization
boundary. Numeric callers remain accepted. String callers must contain ASCII
decimal digits only and then satisfy the existing integer range of
1000-120000.

This validation remains owner-local because the shared strict integer parser
trims whitespace and accepts signed strings, which is not the CLI contract
here.

User Impact

Operators who pass a non-decimal browser extension install --wait-ms value get
an explicit --wait-ms must be an integer from 1000 to 120000 error instead of a
silently coerced wait. Canonical decimal values such as 10000 are unchanged.

Evidence

Maintainer risk acknowledgements

  • Compatibility accepted: this intentionally rejects undocumented hexadecimal,
    scientific, signed, and whitespace-padded --wait-ms strings. Documented
    decimal input remains supported, and the permissive forms appeared only in
    beta releases.
  • Production growth accepted: the +3 net production lines are the smallest
    owner-local lexical guard. The shared parser intentionally accepts signed and
    trimmed strings; this change adds no helper, fallback, dependency, or broader
    surface.

Root cause and canonical fix

Current main used Number(value), which accepted hexadecimal, scientific
notation, leading +, and whitespace-padded strings.
normalizeExtensionInstallWaitMs owns this contract and is called by the CLI
before any preparation log or installation work.

The canonical fix enforces decimal lexical form at that owner boundary while
retaining the existing numeric, integer, and range validation.

Current-main failure

Current main at 21b41efc7bb83dbdba9ce57c2d7140f6c20014e2
retains the same affected owner and CLI source as
dff2d268206c4ebfad2852cbeab7d8d2163a5fcd. At the latter SHA, the focused
pre-fix regression matrix failed 12 assertions: non-decimal strings were
accepted and the CLI reached the installer.

Exact-head CLI proof

Head: 626fad01adff8001f9e1b6b1ed248f29bf314bb1

$ openclaw browser extension install --wait-ms 1e4
Error: --wait-ms must be an integer from 1000 to 120000
exit: 1
installation started: no

$ openclaw browser extension install --wait-ms +50000
Error: --wait-ms must be an integer from 1000 to 120000
exit: 1
installation started: no

Focused checks

  • node scripts/run-vitest.mjs extensions/browser/src/browser/extension-install.test.ts extensions/browser/src/cli/browser-cli-extension.test.ts - passed
  • Hosted CI - 57 successful, 43 skipped, 0 failed; openclaw/ci-gate passed
  • Exact-head autoreview - 0 findings, 0.98 confidence
  • Local ClawSweeper - A/A/A, proof sufficient, 0 findings or risks
  • Hosted ClawSweeper - no code findings; its remaining request was the exact-head CLI proof attached above

Scope and compatibility

  • Production: +4/-1, net +3
  • Tests: +35/-0
  • Numeric callers, canonical decimal strings, bounds, exported normalization,
    and the real Commander boundary are covered.
  • The affected behavior was introduced only in v2026.8.1-beta.2 and
    v2026.8.1-beta.3; no stable shipped contract accepted these noncanonical
    forms.
  • No config, default, protocol, SDK, auth, provider, security, session, storage,
    lifecycle, dependency, or feature surface changes.

Follow-up

None. The narrower grammar intentionally differs from the shared
signed/whitespace-tolerant integer parser.

@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

normalizeExtensionInstallWaitMs used loose Number() on the external
--wait-ms CLI value, so inputs like 0x1000 or 1e4 coerced into valid
in-range waits instead of being rejected. Migrate the string path to
parseStrictPositiveInteger so only plain decimal integers are accepted;
keep the bound/integer checks as the canonical guard and add a
failing-before/passing-after regression.
@xydt-juyaohui
xydt-juyaohui force-pushed the fix/browser-extension-install-wait-strict-parse branch from d44a9af to 832ea75 Compare August 27, 2026 03:06
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 4:17 AM ET / 08:17 UTC.

ClawSweeper review

What this changes

The PR makes browser extension installation reject non-decimal string values for --wait-ms while preserving numeric and canonical decimal inputs.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open: current main still loosely coerces this CLI option, while the branch places the decimal-only rule at the owning normalization boundary and supplies exact-head terminal proof.

Priority: P2
Reviewed head: 626fad01adff8001f9e1b6b1ed248f29bf314bb1

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-boundary fix with direct CLI proof, targeted regression coverage, and no blocking findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Exact-head terminal output in the PR body shows two previously accepted non-decimal inputs now fail before installation starts.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): Exact-head terminal output in the PR body shows two previously accepted non-decimal inputs now fail before installation starts.
Evidence reviewed 8 items Current-main defect: Current main still converts any non-number input with Number(value), so hexadecimal, scientific, signed, and whitespace-padded strings can pass the integer and range checks.
Owner-boundary repair: The PR accepts numbers or digit-only strings before retaining the existing integer and range guard.
CLI call order: The CLI normalizes opts.waitMs before resolving install paths, printing preparation output, or calling the installer.
Findings None None.
Security None None.

Live Verification

Command: pnpm run openclaw -- browser extension install --wait-ms 1e4

Result: FAIL (failed) — step 1 expect_output --wait-ms must be an integer from 1000 to 120000: expected terminal output was not visible within 30 seconds: "--wait-ms must be an integer from 1000 to 120000"

$ node scripts/run-node.mjs -- browser extension install --wait-ms 1e4
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 107.24 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (234
… output truncated …
                                                              │
│  Ask someone experienced to help before enabling tools or exposing it to the internet.     │
│                                                                                            │
│  Recommended safer setup                                                                   │
│  - Use pairing or allowlists; require mentions in group chats.                             │
│  - Shared inboxes: use separate gateways and credentials; separate OS users or hosts       │
│    provide stronger isolation.                                                             │
│  - Use a sandbox and give tools only the permissions they need.                            │
│  - Shared inboxes: isolate DM sessions (session.dmScope: per-channel-peer) and keep tool   │
│    access minimal.                                                                         │
│  - Keep secrets outside the agent's reachable filesystem.                                  │
│  - Use the strongest available model for bots with tools or shared/public inboxes.         │
│                                                                                            │
│  Run regularly                                                                             │
│  openclaw security audit --deep                                                            │
│  openclaw security audit --fix                                                             │
│                                                                                            │
│  Learn more at https://docs.openclaw.ai/gateway/security                                   │
│                                                                                            │
├────────────────────────────────────────────────────────────────────────────────────────────╯
│
◆  I understand this is personal-by-default and shared/multi-user use requires lock-down. Continue?
│  ● Yes
│  ○ No
└

Assertions:

  • FAIL expect_output: --wait-ms must be an integer from 1000 to 120000

How this fits together

The browser plugin registers OpenClaw’s native bootstrap host before Chrome discovers the extension. The extension-install CLI parses an operator’s wait duration, normalizes it, and passes the bounded result into that installation flow.

flowchart LR
  A[Operator CLI input] --> B[Extension install command]
  B --> C[Wait duration normalization]
  C --> D{Decimal integer in range?}
  D -->|Yes| E[Native bootstrap installation]
  D -->|No| F[Visible CLI error]
  E --> G[Chrome extension discovery]
Loading

Before merge

  • Resolve merge risk (P1) - This intentionally rejects noncanonical values used by beta-era scripts; canonical decimal input remains documented and covered.
  • Complete next step (P2) - No repair lane is needed: the submitted branch already contains the focused owner-boundary fix and proof for maintainer review.
Agent review details

Security

None.

PR surface

Source +3, Tests +35. Total +38 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 1 +3
Tests 2 35 0 +35
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 39 1 +38

Review metrics

Metric Value Why it matters
Production versus test delta production +3 net; tests +35 The small production guard is directly paired with normalization and real CLI-boundary regressions.

Merge-risk options

Maintainer options:

  1. Accept the bounded grammar change (recommended)
    Merge with the documented decimal grammar, accepting that undocumented beta-era hexadecimal, scientific, signed, and padded values now fail visibly.

Technical review

Best possible solution:

Land the owner-local lexical guard with the existing regression and CLI-boundary coverage, retaining numeric callers and documented decimal strings.

Do we have a high-confidence way to reproduce the issue?

Yes in source: current main passes opts.waitMs through permissive Number(value) coercion before installation; this read-only review did not execute the command.

Is this the best way to solve the issue?

Yes: the local lexical guard is the narrowest repair because the shared integer parser intentionally accepts signed and whitespace-trimmed strings.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9f581a7beec9.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a focused CLI validation bug with limited blast radius and an explicit error path.
  • merge-risk: 🚨 compatibility: Existing beta scripts using noncanonical numeric spellings will receive an error after merge.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Exact-head terminal output in the PR body shows two previously accepted non-decimal inputs now fail before installation starts.
  • proof: sufficient: Contributor real behavior proof is sufficient. Exact-head terminal output in the PR body shows two previously accepted non-decimal inputs now fail before installation starts.

Evidence

What I checked:

Likely related people:

  • SunnyShu: Current-main blame attributes both the option declaration and permissive normalization to this change. (role: introduced current browser-install path; confidence: high; commits: 6c10672d9507; files: extensions/browser/src/browser/extension-install.ts, extensions/browser/src/cli/browser-cli-extension.ts)
  • steipete: Recent history shows the Chrome Web Store bootstrap and browser CLI option work in this owner area. (role: major browser-extension contributor; confidence: high; commits: 63a3a958f4f0, a30e31091092; files: extensions/browser/src/browser/extension-install.ts, extensions/browser/src/cli/browser-cli-extension.ts)
  • vincentkoc: Recent browser test history and the current PR head connect this person to validation of this surface. (role: recent browser test contributor and current-head updater; confidence: medium; commits: 01cd9cc2a80d, 626fad01adff; files: extensions/browser/src/browser/extension-install.test.ts, extensions/browser/src/cli/browser-cli-extension.test.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-08-27T03:15:35.533Z sha 832ea75 :: needs real behavior proof before merge. :: [P2] Reject leading-plus wait values as the PR promises
  • reviewed 2026-08-27T04:08:57.481Z sha 832ea75 :: needs real behavior proof before merge. :: [P2] Reject signed decimal --wait-ms values
  • reviewed 2026-08-27T07:02:36.901Z sha 626fad0 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-27T07:46:34.350Z sha 626fad0 :: needs maintainer review before merge. :: none

@vincentkoc vincentkoc self-assigned this Aug 27, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 27, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 27, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Aug 27, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 27, 2026
@vincentkoc
vincentkoc merged commit 343e554 into openclaw:main Aug 27, 2026
132 of 133 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 28, 2026
…penclaw#130626)

* fix(browser): reject non-decimal extension install wait strings

normalizeExtensionInstallWaitMs used loose Number() on the external
--wait-ms CLI value, so inputs like 0x1000 or 1e4 coerced into valid
in-range waits instead of being rejected. Migrate the string path to
parseStrictPositiveInteger so only plain decimal integers are accepted;
keep the bound/integer checks as the canonical guard and add a
failing-before/passing-after regression.

* fix(browser): enforce decimal extension wait values

---------

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: browser merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants