Skip to content

fix(commands): widen isLocalBaseUrl to full 127.0.0.0/8 loopback range - #98632

Closed
crh-code wants to merge 1 commit into
openclaw:mainfrom
crh-code:fix/commands-local-url-loopback
Closed

crh-code wants to merge 1 commit into
openclaw:mainfrom
crh-code:fix/commands-local-url-loopback

Conversation

@crh-code

@crh-code crh-code commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The isLocalBaseUrl function in the model provider status command only matched exact "127.0.0.1", missing model providers bound to other loopback addresses like 127.0.0.2:11434. This affects how openclaw status classifies provider URLs as local or remote.

Why This Change Was Made

Changed from host === "127.0.0.1" to host.startsWith("127."), covering the full 127.0.0.0/8 loopback range. 0.0.0.0 and :: are intentionally preserved as local-classified wildcard binds (consistent with existing status display contract).

Evidence

$ node scripts/run-vitest.mjs run src/commands/status.format.test.ts src/commands/status.command-report-data.test.ts 2>&1 | tail -10

 ✓ |unit-fast| src/commands/status.command-report-data.test.ts > ...
 ✓ |unit-fast| src/commands/status.format.test.ts > status cache formatting > ...
 Test Files  2 passed (2)
      Tests  11 passed (11)
   Start at  22:11:29
   Duration  14.03s

All 11 status command tests pass. The isLocalBaseUrl function is a display classifier for openclaw status output — the wider range check means providers on 127.0.0.2+ are now correctly displayed as local.

🤖 Generated with Claude Code

The status command isLocalBaseUrl only matched exact "127.0.0.1",
missing model providers bound to other loopback addresses in the
127/8 range. This affects the openclaw status display.

Co-Authored-By: Claude <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 1, 2026
@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

Close as implemented on current main. The submitted raw 127. prefix would also classify non-IP hostnames such as 127.evil.example as local, while current main already implements the requested full IPv4 loopback behavior through the shared canonical-IP policy without that false-positive path.

So I’m closing this as already implemented rather than keeping a duplicate issue open.

Review details

Best possible solution:

Keep the current-main canonical-IP implementation and do not merge the stale raw-prefix branch; release the existing fix through the normal next release train.

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

No current-main reproduction remains: current main already recognizes canonical 127.0.0.2 loopback URLs. The submitted branch's false-positive behavior is source-reproducible because a hostname such as 127.evil.example passes its raw prefix test.

Is this the best way to solve the issue?

No: the branch's string-prefix check is not the best fix because it accepts non-IP hostnames. Current main uses the shared canonical IPv4 and parsed-loopback predicates, which covers the full loopback range without widening classification beyond numeric addresses.

Security review:

Security review cleared: The branch changes only a local display/filter classifier and introduces no dependency, workflow, credential, permission, or supply-chain change.

AGENTS.md: found and applied where relevant.

What I checked:

  • Current main implementation: Current main classifies a host as loopback only when it is a canonical dotted-decimal IPv4 literal and the shared IP policy identifies it as loopback; this includes 127.0.0.2 while excluding hostname text that merely begins with 127.. (src/commands/models/list.local-url.ts:12, e07d75dc091c)
  • Shared IP contract: The shared policy validates canonical four-part decimal IPv4 before testing the parsed address range for loopback, providing the missing hostname rejection that the PR branch lacks. (packages/net-policy/src/ip.ts:168, e07d75dc091c)
  • Current-main provenance: Commit e07d75dc091c867ddd44f3618257fde5da314c9e already contains the exact current classifier source; git log and git blame show the same implementation carried into current main, with a later baseline-refresh commit preserving the file blob. (src/commands/models/list.local-url.ts:12, e07d75dc091c)
  • Submitted branch differs from the safe implementation: The PR head replaces the exact address check with host.startsWith("127."); comparing the PR head with current main shows current main instead uses canonical-IP validation plus the shared loopback predicate. (src/commands/models/list.local-url.ts:11, b4cdc8dc5ca5)
  • Release check: The current-main implementation is newer than the latest release tag v2026.7.1; the tag points to 2d2ddc43d0dcf71f31283d780f9fe9ff4cc04fe4, and git merge-base --is-ancestor returned false for the fix commit, so this is unreleased current-main provenance. (src/commands/models/list.local-url.ts:12, e07d75dc091c)

Likely related people:

  • vincentkoc: Commit e07d75dc091c867ddd44f3618257fde5da314c9e carries the canonical-IP loopback classifier now on main. (role: current implementation contributor; confidence: high; commits: e07d75dc091c; files: src/commands/models/list.local-url.ts)
  • Shakker: Current-file blame attributes the preserved classifier source to the latest baseline-refresh commit after the implementation landed. (role: recent area contributor; confidence: medium; commits: 64b6f2194806; files: src/commands/models/list.local-url.ts)
  • steipete: The path history shows repeated earlier maintenance of this command classifier and its surrounding normalization behavior. (role: historical area contributor; confidence: medium; commits: 174cd49f78c1, 00d8d7ead059; files: src/commands/models/list.local-url.ts)

Codex review notes: model internal, reasoning high; reviewed against a8b114b3f315; fix evidence: commit e07d75dc091c, main fix timestamp 2026-08-02T00:30:21+08:00.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 1, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jul 1, 2026
@crh-code

crh-code commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. and removed merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jul 1, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 23, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 30, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jul 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant