Repository navigation
fix(browser): reject non-decimal --wait-ms during extension install - #130626
vincentkoc merged 2 commits into
Conversation
|
🦞👀 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.
d44a9af to
832ea75
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 4:17 AM ET / 08:17 UTC. ClawSweeper reviewWhat this changesThe PR makes browser extension installation reject non-decimal string values for Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep 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 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +3, Tests +35. Total +38 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest 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 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
Merged via squash.
|
…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]>
What Problem This Solves
Fixes an issue where
browser extension install --wait-mswould silently acceptnon-decimal strings as valid wait times. Because
normalizeExtensionInstallWaitMscoerced the user-supplied value with
Number(), inputs such as0x1000(4096ms),1e4(10000ms), or+50000(50000ms) passed the integer/range checks and wereused as the install wait instead of being rejected. A typo like
--wait-ms 1e4could produce a far shorter registration wait than intended, with no error.
Why This Change Was Made
The browser plugin now validates
--wait-msat its owning normalizationboundary. 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-msvalue getan explicit
--wait-ms must be an integer from 1000 to 120000error instead of asilently coerced wait. Canonical decimal values such as
10000are unchanged.Evidence
Maintainer risk acknowledgements
scientific, signed, and whitespace-padded
--wait-msstrings. Documenteddecimal input remains supported, and the permissive forms appeared only in
beta releases.
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
mainusedNumber(value), which accepted hexadecimal, scientificnotation, leading
+, and whitespace-padded strings.normalizeExtensionInstallWaitMsowns this contract and is called by the CLIbefore 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
mainat21b41efc7bb83dbdba9ce57c2d7140f6c20014e2retains the same affected owner and CLI source as
dff2d268206c4ebfad2852cbeab7d8d2163a5fcd. At the latter SHA, the focusedpre-fix regression matrix failed 12 assertions: non-decimal strings were
accepted and the CLI reached the installer.
Exact-head CLI proof
Head:
626fad01adff8001f9e1b6b1ed248f29bf314bb1Focused checks
node scripts/run-vitest.mjs extensions/browser/src/browser/extension-install.test.ts extensions/browser/src/cli/browser-cli-extension.test.ts- passedopenclaw/ci-gatepassedScope and compatibility
and the real Commander boundary are covered.
v2026.8.1-beta.2andv2026.8.1-beta.3; no stable shipped contract accepted these noncanonicalforms.
lifecycle, dependency, or feature surface changes.
Follow-up
None. The narrower grammar intentionally differs from the shared
signed/whitespace-tolerant integer parser.