René's URL Explorer Experiment


Title: id(web/image-upload): /api/upload response shape-trusted — a wrong-shape 200 inserts an image node with src undefined into the document · Issue #7823 · developing-today/code · GitHub

Open Graph Title: id(web/image-upload): /api/upload response shape-trusted — a wrong-shape 200 inserts an image node with src undefined into the document · Issue #7823 · developing-today/code

X Title: id(web/image-upload): /api/upload response shape-trusted — a wrong-shape 200 inserts an image node with src undefined into the document · Issue #7823 · developing-today/code

Description: Problem id(web/image-upload): the image upload flow shape-trusts the /api/upload response — a wrong-shape 200 response silently inserts an image node with src: undefined (or a numeric src) into the document, and a null body is misreporte...

Open Graph Description: Problem id(web/image-upload): the image upload flow shape-trusts the /api/upload response — a wrong-shape 200 response silently inserts an image node with src: undefined (or a numeric src) into the...

X Description: Problem id(web/image-upload): the image upload flow shape-trusts the /api/upload response — a wrong-shape 200 response silently inserts an image node with src: undefined (or a numeric src) into the...

Opengraph URL: https://github.com/developing-today/code/issues/7823

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"id(web/image-upload): /api/upload response shape-trusted — a wrong-shape 200 inserts an image node with src undefined into the document","articleBody":"## Problem\n\nid(web/image-upload): the image upload flow shape-trusts the `/api/upload` response — a wrong-shape 200 response silently inserts an image node with `src: undefined` (or a numeric `src`) into the document, and a `null` body is misreported as an insertion failure for an upload that \"succeeded\".\n\n`pkgs/id/web/src/image-upload.ts`:\n\n- `:109` — `return (await response.json()) as UploadResponse;` in `uploadImageFile()` is a bare cast; any 200 body is resolved as a well-formed `{ hash: string; name: string; url: string }` with no validation. The `!response.ok` guard at `:104` only covers non-200 statuses.\n- `:277-283` — the caller (`handleImageUpload`) treats any resolution as success (`outcome.ok = true`); only a rejection takes the upload-failure path.\n- `:312-315` — on \"success\" the caller creates the image node with `src: outcome.result.url` and `alt: outcome.result.name || fileName`. With a wrong-shape body, `result.url` is `undefined`, so a src-less image node is inserted into the real document and dispatched. With a `null` body, `result.url` throws a raw `TypeError` inside the insertion `try`, which the catch at `:320-328` reports as \"Insertion failed\" — the wrong diagnosis (the upload response was malformed; nothing about the document insertion was at fault), and the placeholder is removed with no accurate feedback anywhere.\n- A wrong-typed body is worse: `{ url: 123 }` inserts an image node with `src: 123`.\n\nThe server contract is three required strings (`pkgs/id/src/web/routes.rs:1564` `UploadResponse { hash: String, name: String, url: String }`, returned at `:2226`), so a wrong-shape 200 requires deploy skew, a proxy/error envelope with a 200, or a future contract change — exactly the boundary this cast refuses to check. Siblings: #7812 (image-browser `/api/images`, same src-less-insert outcome via a different module), #7811 (home feed).\n\n## Evidence (verified this run, laptop @ origin/main af4e603e89, image-upload.ts md5 41fa9f0a3ba46a56452fd5c3608fef75)\n\nProbe `~/git/fleet/probe-upload-shape/probe.ts` (bun, real module imported from a clean `git archive origin/main` snapshot at `~/git/fleet/probe-main-c`, fetch stubbed per case; caller effect mirrors `image-upload.ts:312-315`):\n\n- control (well-formed `{hash:\"abc123\", name:\"cat.png\", url:\"/blob/abc123?filename=cat.png\"}`): resolves the object — image node attrs `src=\"/blob/abc123?filename=cat.png\"`, `alt=\"cat.png\"` — OK\n- `null` body: RESOLVES `null` (not rejected) → caller deref throws `TypeError: null is not an object (evaluating 'result.url')`, caught and misreported as \"Insertion failed\"\n- `{}` body: resolves `{}` → image node created with `src=undefined`\n- `\"abc\"` body: resolves `\"abc\"` → image node created with `src=undefined`\n- `[]` body: resolves `[]` → image node created with `src=undefined`\n- `{hash:42, name:null, url:123}`: resolves → image node created with `src=123`\n- `{hash:\"abc123\", name:\"cat.png\"}` (missing `url`): resolves → image node created with `src=undefined`\n\nThe existing tests (`pkgs/id/web/src/image-upload.test.ts`, `uploadImageFile` describe at `:231`) mock only the well-formed success body, a non-ok response, and a network error — no malformed-200 cases.\n\n## Why it matters\n\nPaste/drop image upload is a primary editing path. The upload itself succeeded server-side (the blob is stored), so a wrong-shape response today either corrupts the document with a broken src-less image node that then gets saved, or misdiagnoses the failure as an insertion problem — making the real contract break undebuggable from user reports. Failing closed is cheap: validate the shape at the fetch boundary and let the existing upload-failure path (warn + placeholder removal, `:279-282`) handle it.\n\n## Acceptance criteria\n\n- [ ] A malformed `/api/upload` 200 payload (null/non-object body, missing `hash`/`name`/`url`, or wrong-typed fields) makes `uploadImageFile` REJECT with a clear upload error — it never resolves a malformed value.\n- [ ] On a malformed payload, no image node is inserted, and the failure is reported through the existing upload-failure path (\"Upload failed for …\"), never as \"Insertion failed\" and never as a raw TypeError.\n- [ ] Well-formed payloads behave exactly as today (existing `uploadImageFile` tests unchanged and green).\n- [ ] New regression tests in `pkgs/id/web/src/image-upload.test.ts` cover the malformed cases above and fail pre-fix.\n- [ ] Web suite + typecheck green.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-11-08T22:09:36Z","url":"https://github.com/developing-today/code/issues/7823"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:74542919-e1d2-9efe-6323-86c2494a2ff3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idED94:2046A0:31F475:446A48:6B0763CE
html-safe-nonce6e962f85e4fecd4474a7493561750727a557fccbbe98e2372cdf4b801bb2ecf3
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDk0OjIwNDZBMDozMUY0NzU6NDQ2QTQ4OjZCMDc2M0NFIiwidmlzaXRvcl9pZCI6IjM4MTAyMjYxNzMzOTM3MjQzNjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac8fa0b1973d239ad644787eb1537a4f2ffa030682bcdc41e557eaa01b91ffefe3
hovercard-subject-tagissue:6276197290
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/7823/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ab7b5485476cd477b6d8f4120cce5bfe12fa202afa06e758fa4aaf14ee3a5d6f/developing-today/code/issues/7823
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ab7b5485476cd477b6d8f4120cce5bfe12fa202afa06e758fa4aaf14ee3a5d6f/developing-today/code/issues/7823
og:image:altProblem id(web/image-upload): the image upload flow shape-trusts the /api/upload response — a wrong-shape 200 response silently inserts an image node with src: undefined (or a numeric src) into the...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedezren39
hostnamegithub.com
expected-hostnamegithub.com
None7a557ecc960a3ae6e299fc66b0bc9132072f8860191648e6749fee5d3ff00d82
turbo-cache-controlno-preview
go-importgithub.com/developing-today/code git https://github.com/developing-today/code.git
octolytics-dimension-user_id26439447
octolytics-dimension-user_logindeveloping-today
octolytics-dimension-repository_id627308783
octolytics-dimension-repository_nwodeveloping-today/code
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id627308783
octolytics-dimension-repository_network_root_nwodeveloping-today/code
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasebd845eb7947c1ed8c850f7ab415a51339d162de3
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/developing-today/code/issues/7823#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdeveloping-today%2Fcode%2Fissues%2F7823
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fdeveloping-today%2Fcode%2Fissues%2F7823
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=developing-today%2Fcode
Reloadhttps://github.com/developing-today/code/issues/7823
Reloadhttps://github.com/developing-today/code/issues/7823
Reloadhttps://github.com/developing-today/code/issues/7823
developing-todayhttps://github.com/developing-today
codehttps://github.com/developing-today/code
Codehttps://github.com/developing-today/code
Issues1k (1k)https://github.com/developing-today/code/issues
Pull requests205 (205)https://github.com/developing-today/code/pulls
Discussionshttps://github.com/developing-today/code/discussions
Actionshttps://github.com/developing-today/code/actions
Projectshttps://github.com/developing-today/code/projects
Wikihttps://github.com/developing-today/code/wiki
Security and qualityhttps://github.com/developing-today/code/security
Insightshttps://github.com/developing-today/code/insights
https://github.com/developing-today/code
New issuehttps://github.com/login?return_to=https://github.com/developing-today/code/issues/7823
New issuehttps://github.com/login?return_to=https://github.com/developing-today/code/issues/7823
#7827https://github.com/developing-today/code/pull/7827
id(web/image-upload): /api/upload response shape-trusted — a wrong-shape 200 inserts an image node with src undefined into the documenthttps://github.com/developing-today/code/issues/7823#top
#7827https://github.com/developing-today/code/pull/7827
app/idhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22app%2Fid%22
effort/shttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22effort%2Fs%22
kind/bughttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22kind%2Fbug%22
priority/lowhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22priority%2Flow%22
source/creatorhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22source%2Fcreator%22
status:donehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%3Adone%22
task/small-fixhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22task%2Fsmall-fix%22
https://github.com/dezren39
dezren39https://github.com/dezren39
on Nov 8, 2026https://github.com/developing-today/code/issues/7823#issue-6276197290
#7812https://github.com/developing-today/code/issues/7812
#7811https://github.com/developing-today/code/issues/7811
af4e603https://github.com/developing-today/code/commit/af4e603e896a92bb3ddfbacb9d1089d83571f401
https://github.com/apps/developing-today
developing-todayhttps://github.com/apps/developing-today
on Nov 8, 2026https://github.com/developing-today/code/issues/7823#issuecomment-6727814943
developing.todayhttps://kaneo.security.cab
CODE-2328https://kaneo.security.cab/dashboard/workspace/6oQgIkST0YGrCcxrnhbHPOUCfgdD3cqE/project/pfcq432h349r20up18gttfv4/task/zfx7dk3blpc8b7po911q1f03
dezren39https://github.com/dezren39
queue/queuedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22queue%2Fqueued%22
source/creatorhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22source%2Fcreator%22
task/small-fixhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22task%2Fsmall-fix%22
status/needs-triagehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fneeds-triage%22
priority/lowhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22priority%2Flow%22
app/idhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22app%2Fid%22
kind/bughttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22kind%2Fbug%22
effort/shttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22effort%2Fs%22
on Nov 8, 2026https://github.com/developing-today/code/issues/7823#event-35516258830
https://github.com/dezren39
dezren39https://github.com/dezren39
on Nov 8, 2026https://github.com/developing-today/code/issues/7823#issuecomment-6727827278
af4e603https://github.com/developing-today/code/commit/af4e603e896a92bb3ddfbacb9d1089d83571f401
id(web/image-browser): /api/images response shape-trusted — a wrong-shape 200 shows raw TypeErrors or bogus 'undefined' cards that insert src-less images #7812https://github.com/developing-today/code/issues/7812
id(web/home): home feed refresh shape-trusts /api/home/feed — a wrong-shape 200 wipes the rendered lists and surfaces raw TypeErrors #7811https://github.com/developing-today/code/issues/7811
dezren39https://github.com/dezren39
queue/claimedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22queue%2Fclaimed%22
status/in-progresshttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fin-progress%22
work/assignedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22work%2Fassigned%22
queue/queuedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22queue%2Fqueued%22
status/needs-triagehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fneeds-triage%22
on Nov 8, 2026https://github.com/developing-today/code/issues/7823#event-35516353651
https://github.com/apps/developing-today
developing-todayhttps://github.com/apps/developing-today
on Nov 8, 2026https://github.com/developing-today/code/issues/7823#issuecomment-6727850034
developing.todayhttps://kaneo.security.cab
#7823https://github.com/developing-today/code/issues/7823
#7823https://github.com/developing-today/code/issues/7823
6b94b29https://github.com/developing-today/code/commit/6b94b29d0d319c0b617783a76c3aee7d74a345bf
developing-todayhttps://github.com/apps/developing-today
status:in-reviewhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%3Ain-review%22
on Nov 8, 2026https://github.com/developing-today/code/issues/7823#event-35516521419
dezren39https://github.com/dezren39
on Nov 8, 2026https://github.com/developing-today/code/issues/7823#event-35516708368
fix(id/web): validate /api/upload response shape before inserting (#7823https://github.com/developing-today/code/commit/fb84378835aa4930980f983f67debfffe8245c86
#7823https://github.com/developing-today/code/issues/7823
fb84378https://github.com/developing-today/code/commit/fb84378835aa4930980f983f67debfffe8245c86
dezren39https://github.com/dezren39
completedhttps://github.com/developing-today/code/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#7827https://github.com/developing-today/code/pull/7827
on Nov 8, 2026https://github.com/developing-today/code/issues/7823#event-35516708588
developing-todayhttps://github.com/apps/developing-today
status:donehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%3Adone%22
status:in-reviewhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%3Ain-review%22
on Nov 8, 2026https://github.com/developing-today/code/issues/7823#event-35516710109
dezren39https://github.com/dezren39
status/in-progresshttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%2Fin-progress%22
queue/claimedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22queue%2Fclaimed%22
work/assignedhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22work%2Fassigned%22
on Nov 8, 2026https://github.com/developing-today/code/issues/7823#event-35516726171
https://github.com/apps/developing-today
developing-todayhttps://github.com/apps/developing-today
on Nov 8, 2026https://github.com/developing-today/code/issues/7823#issuecomment-6727939493
developing.todayhttps://kaneo.security.cab
#7823https://github.com/developing-today/code/issues/7823
#7827https://github.com/developing-today/code/pull/7827
fb84378https://github.com/developing-today/code/commit/fb84378835aa4930980f983f67debfffe8245c86
#7827https://github.com/developing-today/code/pull/7827
Sign up for freehttps://github.com/signup?return_to=https://github.com/developing-today/code/issues/7823
Sign in to commenthttps://github.com/login?return_to=https://github.com/developing-today/code/issues/7823
app/idhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22app%2Fid%22
effort/shttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22effort%2Fs%22
kind/bughttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22kind%2Fbug%22
priority/lowhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22priority%2Flow%22
source/creatorhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22source%2Fcreator%22
status:donehttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22status%3Adone%22
task/small-fixhttps://github.com/developing-today/code/issues?q=state%3Aopen%20label%3A%22task%2Fsmall-fix%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.