Skip to content

feat(abilities): add datamachine/web-fetch for public pages - #3922

Merged
chubes4 merged 2 commits into
mainfrom
fix/issue-3917-data-machine
Nov 6, 2026
Merged

chubes4 merged 2 commits into
mainfrom
fix/issue-3917-data-machine

Conversation

@chubes4

@chubes4 chubes4 commented Nov 6, 2026

Copy link
Copy Markdown
Member

Closes #3917. Gardner (editor, ability tools only) had no way to read a web page for show or bio research. The web_fetch chat and pipeline tool existed, but it was not an ability, so REST, MCP and person-scoped sessions couldn't reach it.

What's added

  • New ability datamachine/web-fetch (inc/Abilities/WebFetchAbilities.php): input url, output title, readable content, final_url, content_length, content_truncated and fetch_timestamp. It is show_in_rest, readonly and idempotent, and lives in the datamachine-content category.
  • Permission: PermissionHelper::can( 'web_fetch' ) maps to publish_posts, the same author level the chat tool already required (access_level => author). It is also implied by can_manage().
  • One implementation: the web_fetch chat tool now delegates to WebFetchAbilities::fetch(). Its HTML-to-text extraction was moved over unchanged, so chat output is the same apart from the new final_url.

Safety (new, applies to the existing chat tool too)

The old tool fetched any URL with WordPress following redirects, including internal addresses. The shared fetch now:

  • Allows only http/https on ports 80 and 443, and rejects embedded credentials.
  • Rejects internal names (localhost, *.local, *.internal) and any host that resolves (A and AAAA) to a private, reserved, loopback, link-local (169.254.169.254), CGNAT, unique-local, or IPv4-mapped address. If any resolved address is non-public, the host is refused.
  • Follows redirects itself (redirection = 0 on the WP request, max 5 hops) and re-validates every hop, so a public page can't redirect into a metadata endpoint.
  • Caps the body at 2 MB (limit_response_size) and the returned text at 50,000 characters. The timeout is 20s.

Residual risk: DNS can change between validation and the request (rebinding). Closing that would require pinning the resolved IP into the transport, which WP's HTTP API doesn't expose. Noted, not addressed here.

Verification

  • Live run of fetch() on production with the new class required (no deploy):
    • https://example.com returns its title and text.
    • http://extrachill.com/ follows the redirect to https://extrachill.com/.
    • 127.0.0.1, 169.254.169.254, [::1] and localhost:8080 are blocked; so are credentials in the URL and file://. None of them issued a request.
  • tests/web-fetch-ability-smoke.php (plain php, stubbed DNS and HTTP) covers: extraction, the size cap, 18 blocked or invalid targets with no request issued, relative and absolute redirect chains, a redirect into the metadata IP blocked before it is requested, redirect loops, truncation, upstream errors, the IP classifier, and the tool delegating to the shared fetch.
  • phpcs: new files have 0 findings. Touched files are unchanged against main (PermissionHelper's 5 findings already exist on main).
  • Related smokes: global-tool-pipeline-modes and global-ability-projections pass. adjacent-handler-tool-policy-smoke fails identically on main.

Notes

  • Merge decision: opening web fetch to authors and editors is Chubes's call. This PR keeps the tool's existing author gate rather than widening it.
  • Possible conflict with fix(abilities): let logged-in readers run local-search #3920: it also adds a PermissionHelper action (search_content). If one merges first, the other needs a trivial rebase of the same map and list lines.

Provenance: the Homeboy cooks for this issue failed before starting (lab transport retries were exhausted), so Extra Chill Bot wrote this directly. AI-generated (Extra Chill Bot).

@homeboy-ci

homeboy-ci Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Homeboy Results — data-machine-events

Review lint

✅ review lint — passed

Deep dive: homeboy review lint data-machine-events --changed-since da5215c

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-events-review-lint-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-events-review-lint-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/42305274700
Tooling versions
  • Homeboy CLI: homeboy 0.446.14+1b1bd24c49b69fa38e78627704c1139804598608
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy
  • Extension revision: 1b1bd24
  • Action: Extra-Chill/homeboy-action@v2

@homeboy-ci

homeboy-ci Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Homeboy Results — data-machine-business

Review lint

✅ review lint — passed

Deep dive: homeboy review lint data-machine-business --changed-since da5215c

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-business-review-lint-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-business-review-lint-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/42305274688
Tooling versions
  • Homeboy CLI: homeboy 0.446.14+1b1bd24c49b69fa38e78627704c1139804598608
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy
  • Extension revision: 1b1bd24
  • Action: Extra-Chill/homeboy-action@v2

@homeboy-ci

homeboy-ci Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Homeboy Results — data-machine-socials

Homeboy

No files changed since da5215c
⚡ Scope: changed files only (since da5215c6c3e35ba60cd91f5027899bd1bf7b7d89)

0 finding(s) across 2 stage(s)

✅ lint

Deep dive: homeboy review lint data-machine-socials --changed-since=da5215c6c3e35ba60cd91f5027899bd1bf7b7d89

✅ test

Deep dive: homeboy review test data-machine-socials --changed-since=da5215c6c3e35ba60cd91f5027899bd1bf7b7d89

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-socials-review-lint-review-test-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-socials-review-lint-review-test-homeboy-__Extra-Chill_homeboy-action-Linux-php8.2-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/42305274785
Tooling versions
  • Homeboy CLI: homeboy 0.446.14+1b1bd24c49b69fa38e78627704c1139804598608
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy
  • Extension revision: 1b1bd24
  • Action: Extra-Chill/homeboy-action@v2

@chubes4
chubes4 force-pushed the fix/issue-3917-data-machine branch from e81232c to 00787a8 Compare November 6, 2026 22:30
@chubes4
chubes4 merged commit 4cd3db3 into main Nov 6, 2026
38 checks passed
@chubes4
chubes4 deleted the fix/issue-3917-data-machine branch November 6, 2026 22:44
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.

Expose the web_fetch tool as a datamachine/web-fetch ability for MCP agents

1 participant