Skip to content

fix(ledger): treat unparseable URLs as privacy-unsafe - #2

Open
SebTardif wants to merge 1 commit into
openclaw:mainfrom
SebTardif:fix/privacy-url-fail-closed
Open

SebTardif wants to merge 1 commit into
openclaw:mainfrom
SebTardif:fix/privacy-url-fail-closed

Conversation

@SebTardif

Copy link
Copy Markdown
Contributor

What Problem This Solves

The action ledger privacy filter is supposed to reject private hosts in event text. A candidate that looks like a URL but fails new URL (invalid port such as http://169.254.169.254:foo) was treated as public, then stripped before host and IP scans. The same host in a valid URL or as a bare address was already rejected. That hole can let link-local and loopback addresses into the public ledger.

Evidence

Live node import of actionEvent on the patched tree. Invalid-port private URLs now throw privacy-unsafe event data. A public GitHub Actions run URL still succeeds.

$ node --input-type=module -e "import { actionEvent } from './test/ledger-fixtures.mjs'; ..."
EVENT_THROW http://169.254.169.254:foo action ledger event: contains privacy-unsafe event data
EVENT_THROW http://127.0.0.1:notaport action ledger event: contains privacy-unsafe event data
EVENT_THROW http://169.254.169.254:99999 action ledger event: contains privacy-unsafe event data
EVENT_THROW https://169.254.169.254/latest/meta-data action ledger event: contains privacy-unsafe event data
EVENT_THROW 169.254.169.254 action ledger event: contains privacy-unsafe event data
EVENT_OK https://github.com/openclaw/clawsweeper/actions/runs/123

Before this patch the three invalid-port strings printed EVENT_OK.

Real behavior proof

  • Behavior or issue addressed: Unparseable URL candidates no longer bypass the privacy filter. Invalid ports that embed 169.254.169.254 or 127.0.0.1 are rejected the same way as valid URLs to those hosts.
  • Real environment tested: Windows 11, Node v24.19.0, patched scripts/ledger-schema.mjs on branch fix/privacy-url-fail-closed.
  • Exact steps or command run after this patch: From the patched checkout, ran node --input-type=module importing actionEvent with status strings http://169.254.169.254:foo, http://127.0.0.1:notaport, http://169.254.169.254:99999, plus the already-rejected valid metadata URL and a public GitHub run URL.
  • Evidence after fix: terminal output from that node command (see Evidence). Invalid-port private URLs print EVENT_THROW with privacy-unsafe event data. https://github.com/openclaw/clawsweeper/actions/runs/123 prints EVENT_OK.
  • Observed result after fix: privateUrl fails closed when new URL throws, so those strings never reach the strip-then-scan path that previously hid the private IP.
  • What was not tested: Publishing a crafted shard onto the live state branch.

Change

privateUrl in scripts/ledger-schema.mjs returns true when URL parsing throws, instead of false.

Origin

Introduced in 7964f2af5f7.

Unparseable URL candidates were classified as public, then stripped
before host and IP scans. That accepted http://169.254.169.254:foo
while the same host in a valid URL was rejected.

Signed-off-by: Sebastien Tardif <SebTardif@ncf.ca>
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.

1 participant