Title: lab-ops-hub: fetchFollowingValidatedRedirects fetches its start URL unvalidated — the SSRF guard is not safe by construction (PR #461) · Issue #464 · developing-today/code · GitHub
Open Graph Title: lab-ops-hub: fetchFollowingValidatedRedirects fetches its start URL unvalidated — the SSRF guard is not safe by construction (PR #461) · Issue #464 · developing-today/code
X Title: lab-ops-hub: fetchFollowingValidatedRedirects fetches its start URL unvalidated — the SSRF guard is not safe by construction (PR #461) · Issue #464 · developing-today/code
Description: Problem PR #461's new fetchFollowingValidatedRedirects (the Worker-fallback crawler's SSRF guard, fixing #460) validates every redirect target with validateCrawlUrl — but fetches its startUrl argument without validating it at all. The fe...
Open Graph Description: Problem PR #461's new fetchFollowingValidatedRedirects (the Worker-fallback crawler's SSRF guard, fixing #460) validates every redirect target with validateCrawlUrl — but fetches its startUrl argum...
X Description: Problem PR #461's new fetchFollowingValidatedRedirects (the Worker-fallback crawler's SSRF guard, fixing #460) validates every redirect target with validateCrawlUrl — but fetches its startU...
Opengraph URL: https://github.com/developing-today/code/issues/464
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"lab-ops-hub: fetchFollowingValidatedRedirects fetches its start URL unvalidated — the SSRF guard is not safe by construction (PR #461)","articleBody":"## Problem\n\nPR #461's new `fetchFollowingValidatedRedirects` (the Worker-fallback crawler's SSRF guard, fixing #460) validates every *redirect* target with `validateCrawlUrl` — but fetches its `startUrl` argument without validating it at all. The fetching component itself therefore does not enforce the #441 policy; it relies entirely on its one current caller pre-validating.\n\n## Evidence (verified on current main `468b9155`, 2026-10-21)\n\n- `pkgs/lab-ops-hub/src/lib.ts` — `fetchFollowingValidatedRedirects(startUrl, fetchFn, maxRedirects = 5)`: the loop's first action is `const res = await fetchFn(current)` with `current = startUrl` unchecked; `validateCrawlUrl` is only called on `Location`-derived URLs.\n- Empirically reproduced this run against the merged `src/lib.ts` (plain Node, injected stub fetcher): `fetchFollowingValidatedRedirects(\"http://127.0.0.1/secret\", stub)` fetched `http://127.0.0.1/secret` and returned its 200 response — no refusal. Redirect targets in the same probe (integer/hex IPv4 forms, IPv4-mapped IPv6, NAT64-embedded 169.254.169.254, userinfo tricks) were all correctly refused, so the gap is specifically hop 0.\n- The only production caller is safe today by accident of wiring, not by the helper's contract: `src/index.ts` `/api/crawl` handler validates and rewrites `b.url = target.url` before `crawlFallback(b.url)`. Any future caller — or a refactor that drops the rewrite — silently re-opens the #460/#441 SSRF on the first hop.\n- This contradicts the repo's own stated design for the sibling crawler: `pkgs/lab-ops-hub/container/app.py` validates in the fetching component itself (\"this service re-validates independently (defence in depth — it is the component that actually fetches)\"). The Worker fallback is the component that actually fetches on its path, yet validates only hops 1..n.\n\n## Why it matters\n\n#460 existed precisely because one fetch path in this package silently skipped the validation every other path applied. A security helper whose name and doc comment promise validated fetching (\"Redirect-following fetch with per-hop validation\") but which leaves hop 0 to caller discipline recreates that failure mode one refactor away. Making the helper safe by construction costs one `validateCrawlUrl` call at entry and breaks no current caller (the handler's URL is already validated/normalised; the PR's tests all start from public URLs).\n\n## Acceptance criteria\n\n- [ ] `fetchFollowingValidatedRedirects` validates `startUrl` with `validateCrawlUrl` before the first fetch and throws a clear error (fetching nothing) for a non-public / non-http(s) start URL; the first fetch uses the validated/normalised URL.\n- [ ] Regression test: a start URL of `http://127.0.0.1/…` (and/or `http://169.254.169.254/…`) is refused with the fetcher never invoked; existing public-start redirect tests still pass.\n- [ ] `npm test` and `tsc --noEmit` pass for `pkgs/lab-ops-hub`.\n\nSingle-repo: lab-ops-hub exists only in developing-today/code (as established in #460). Deduped: no open or closed issue names `fetchFollowingValidatedRedirects`, the start-URL gap, or `crawlFallback` validation (issue searches empty, 2026-10-21).\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-21T07:22:45Z","url":"https://github.com/developing-today/code/issues/464"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:045b6f04-51dd-29fe-91e2-8dfd7d568400 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9DE6:CCFBF:72F2A1:95B95E:6B0628BB |
| html-safe-nonce | c9196eac2d380c142eb35ff6edece81d3418ae86b2da094d1543f3f686825819 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REU2OkNDRkJGOjcyRjJBMTo5NUI5NUU6NkIwNjI4QkIiLCJ2aXNpdG9yX2lkIjoiNTE0OTY5NTc1OTk4MTM1NzI0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 467eb0c5e0d9f0e295aa558a820b76cb193964812b95224988c6f79a41a1e09e |
| hovercard-subject-tag | issue:5956193061 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/464/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5b99a3cccd02aee7eee7386a3192871c6c118555fb7ff43faacf2b6775a48bcb/developing-today/code/issues/464 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5b99a3cccd02aee7eee7386a3192871c6c118555fb7ff43faacf2b6775a48bcb/developing-today/code/issues/464 |
| og:image:alt | Problem PR #461's new fetchFollowingValidatedRedirects (the Worker-fallback crawler's SSRF guard, fixing #460) validates every redirect target with validateCrawlUrl — but fetches its startUrl argum... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9e10bb0ecc0bd0f8692aa89586ee9b54e498d7ab9f244a44cdb5b93653a125ce |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32e57d5cc2ce6ce92ec6dceb65858344750c27c2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width