René's URL Explorer Experiment


Title: fix(uploads): authorize internal file URLs before download by waleedlatif1 · Pull Request #5049 · simstudioai/sim · GitHub

Open Graph Title: fix(uploads): authorize internal file URLs before download by waleedlatif1 · Pull Request #5049 · simstudioai/sim

X Title: fix(uploads): authorize internal file URLs before download by waleedlatif1 · Pull Request #5049 · simstudioai/sim

Description: Summary downloadFileFromUrl treated any URL containing /api/files/serve/ as trusted-internal and read the object straight from storage by key, skipping the verifyFileAccess check every other resolution path in the file runs. Reachable during workflow execution via file[] inputs (type: 'url'), so an authenticated user could read storage objects across tenants by supplying a storage key. Now thread the caller's userId into downloadFileFromUrl and run verifyFileAccess(key, userId, undefined, context, false) on the resolved key before reading bytes; fail closed when no userId is present. Updated all callers (execution file inputs, tool file outputs, KB ingestion). Webhook and chat inputs already thread userId via processExecutionFiles. External/presigned URLs are unchanged (still DNS/SSRF-guarded); only the internal branch gained the check, reusing the same authorization the /api/files/serve route already enforces. Type of Change Bug fix (security) Testing Tested manually. Typecheck, Biome, check:api-validation, and existing upload/KB tests pass. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary downloadFileFromUrl treated any URL containing /api/files/serve/ as trusted-internal and read the object straight from storage by key, skipping the verifyFileAccess check every other resol...

X Description: Summary downloadFileFromUrl treated any URL containing /api/files/serve/ as trusted-internal and read the object straight from storage by key, skipping the verifyFileAccess check every other resol...

Opengraph URL: https://github.com/simstudioai/sim/pull/5049

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:603a363c-820f-12a6-2d70-99b9df415297
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDB90:41EE1:1E73DF:2AA2AE:6AFB5030
html-safe-nonce073822cdcb0eef53e5b2a3ce0a04b57ed2a894b8c5a3832251d459a6b280a282
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjkwOjQxRUUxOjFFNzNERjoyQUEyQUU6NkFGQjUwMzAiLCJ2aXNpdG9yX2lkIjoiNjUyNzY2ODg2OTM4MzU0MDc4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac2a2806c2e9dc8ee989826e449d89101d2188987982e90e0731a2f335db8cf2ed
hovercard-subject-tagpull_request:3865033210
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/5049/files
twitter:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/40672544?s=400&v=4
og:image:altSummary downloadFileFromUrl treated any URL containing /api/files/serve/ as trusted-internal and read the object straight from storage by key, skipping the verifyFileAccess check every other resol...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecbf66c024bb6d10e6955baa7413c54cf13a201bb
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/5049/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F5049%2Ffiles
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%2Fsimstudioai%2Fsim%2Fpull%2F5049%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/5049/files
Reloadhttps://github.com/simstudioai/sim/pull/5049/files
Reloadhttps://github.com/simstudioai/sim/pull/5049/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests197 (197)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
icecrasher321https://github.com/icecrasher321
staginghttps://github.com/simstudioai/sim/tree/staging
fix/file-url-access-checkhttps://github.com/simstudioai/sim/tree/fix/file-url-access-check
Conversation 14 https://github.com/simstudioai/sim/pull/5049
Commits 6 https://github.com/simstudioai/sim/pull/5049/commits
Checks 14 https://github.com/simstudioai/sim/pull/5049/checks
Files changed https://github.com/simstudioai/sim/pull/5049/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5049/files
fix(uploads): authorize internal file URLs before download https://github.com/simstudioai/sim/pull/5049/files#top
Show all changes 6 commits https://github.com/simstudioai/sim/pull/5049/files
912a983 fix(uploads): authorize internal file URLs before download waleedlatif1 Jun 15, 2026 https://github.com/simstudioai/sim/pull/5049/commits/912a9837666234dba08a978198e8251d2da41778
41ae711 chore(uploads): log denied internal file downloads for rollout telemetry waleedlatif1 Jun 15, 2026 https://github.com/simstudioai/sim/pull/5049/commits/41ae71164e3537bdfd1c87c621a34446d5649e51
e9b2e11 fix(uploads): derive internal file context from key, not query param waleedlatif1 Jun 15, 2026 https://github.com/simstudioai/sim/pull/5049/commits/e9b2e11ccd04d68a61835a7b108758dc9854fb18
a4bba94 docs(uploads): move context-derivation rationale into TSDoc waleedlatif1 Jun 15, 2026 https://github.com/simstudioai/sim/pull/5049/commits/a4bba94e783c93dabfa81c441808222b3ece4700
9f47c14 fix(uploads): match internal file marker in URL path only waleedlatif1 Jun 15, 2026 https://github.com/simstudioai/sim/pull/5049/commits/9f47c1487cd3598545464ab08172f2df2a94067e
bb1d384 consolidate access, billing principals Jun 15, 2026 https://github.com/simstudioai/sim/pull/5049/commits/bb1d384d523a0d3a839bc8e60861888c137ce68c
Clear filters https://github.com/simstudioai/sim/pull/5049/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5049/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5049/files
file-tool-processor.ts https://github.com/simstudioai/sim/pull/5049/files#diff-954c47acb94f5eb46e921502cbcfe8612c6ef1b55d03c4cb583d49cc7f8065dd
files.ts https://github.com/simstudioai/sim/pull/5049/files#diff-2dcc7234a173b16e60ccbdf5374e0f021ffc26b87df90602fdac56b6915f3125
document-processor.ts https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
service.ts https://github.com/simstudioai/sim/pull/5049/files#diff-12adff6ec055d413ec20f1debed4ca207b994d23df6de9aa4ef79bf47f2857b2
file-utils.server.ts https://github.com/simstudioai/sim/pull/5049/files#diff-56073f04957682936465d04d9660e33d45b8f6151b8ce0947b9cfd6ad3e3533e
file-utils.test.ts https://github.com/simstudioai/sim/pull/5049/files#diff-2c0b382fe8cf3fa3e05f4f04cc4a5c203ec332a424f97a35623169aff658f0d8
file-utils.ts https://github.com/simstudioai/sim/pull/5049/files#diff-ffb723db3f5688d79b0407b2238a775980249044a6ab20e212e0297a248b71e3
apps/sim/executor/utils/file-tool-processor.tshttps://github.com/simstudioai/sim/pull/5049/files#diff-954c47acb94f5eb46e921502cbcfe8612c6ef1b55d03c4cb583d49cc7f8065dd
View file https://github.com/simstudioai/sim/blob/bb1d384d523a0d3a839bc8e60861888c137ce68c/apps/sim/executor/utils/file-tool-processor.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5049/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5049/files#diff-954c47acb94f5eb46e921502cbcfe8612c6ef1b55d03c4cb583d49cc7f8065dd
https://github.com/simstudioai/sim/pull/5049/files#diff-954c47acb94f5eb46e921502cbcfe8612c6ef1b55d03c4cb583d49cc7f8065dd
apps/sim/lib/execution/files.tshttps://github.com/simstudioai/sim/pull/5049/files#diff-2dcc7234a173b16e60ccbdf5374e0f021ffc26b87df90602fdac56b6915f3125
View file https://github.com/simstudioai/sim/blob/bb1d384d523a0d3a839bc8e60861888c137ce68c/apps/sim/lib/execution/files.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5049/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5049/files#diff-2dcc7234a173b16e60ccbdf5374e0f021ffc26b87df90602fdac56b6915f3125
https://github.com/simstudioai/sim/pull/5049/files#diff-2dcc7234a173b16e60ccbdf5374e0f021ffc26b87df90602fdac56b6915f3125
apps/sim/lib/knowledge/documents/document-processor.tshttps://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
View file https://github.com/simstudioai/sim/blob/bb1d384d523a0d3a839bc8e60861888c137ce68c/apps/sim/lib/knowledge/documents/document-processor.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5049/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
https://github.com/simstudioai/sim/pull/5049/files#diff-caef18c7f5680f8ad0ec1e40b90e7635fe8f182b55d4fd20ef78fbe881f11205
apps/sim/lib/knowledge/documents/service.tshttps://github.com/simstudioai/sim/pull/5049/files#diff-12adff6ec055d413ec20f1debed4ca207b994d23df6de9aa4ef79bf47f2857b2
View file https://github.com/simstudioai/sim/blob/bb1d384d523a0d3a839bc8e60861888c137ce68c/apps/sim/lib/knowledge/documents/service.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5049/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5049/files#diff-12adff6ec055d413ec20f1debed4ca207b994d23df6de9aa4ef79bf47f2857b2
https://github.com/simstudioai/sim/pull/5049/files#diff-12adff6ec055d413ec20f1debed4ca207b994d23df6de9aa4ef79bf47f2857b2
https://github.com/simstudioai/sim/pull/5049/files#diff-12adff6ec055d413ec20f1debed4ca207b994d23df6de9aa4ef79bf47f2857b2
https://github.com/simstudioai/sim/pull/5049/files#diff-12adff6ec055d413ec20f1debed4ca207b994d23df6de9aa4ef79bf47f2857b2
apps/sim/lib/uploads/utils/file-utils.server.tshttps://github.com/simstudioai/sim/pull/5049/files#diff-56073f04957682936465d04d9660e33d45b8f6151b8ce0947b9cfd6ad3e3533e
View file https://github.com/simstudioai/sim/blob/bb1d384d523a0d3a839bc8e60861888c137ce68c/apps/sim/lib/uploads/utils/file-utils.server.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5049/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5049/files#diff-56073f04957682936465d04d9660e33d45b8f6151b8ce0947b9cfd6ad3e3533e
https://github.com/simstudioai/sim/pull/5049/files#diff-56073f04957682936465d04d9660e33d45b8f6151b8ce0947b9cfd6ad3e3533e
https://github.com/simstudioai/sim/pull/5049/files#diff-56073f04957682936465d04d9660e33d45b8f6151b8ce0947b9cfd6ad3e3533e
Please reload this pagehttps://github.com/simstudioai/sim/pull/5049/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5049/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/5049/files
https://github.com/simstudioai/sim/pull/5049/files#diff-56073f04957682936465d04d9660e33d45b8f6151b8ce0947b9cfd6ad3e3533e
apps/sim/lib/uploads/utils/file-utils.test.tshttps://github.com/simstudioai/sim/pull/5049/files#diff-2c0b382fe8cf3fa3e05f4f04cc4a5c203ec332a424f97a35623169aff658f0d8
View file https://github.com/simstudioai/sim/blob/bb1d384d523a0d3a839bc8e60861888c137ce68c/apps/sim/lib/uploads/utils/file-utils.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5049/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5049/files#diff-2c0b382fe8cf3fa3e05f4f04cc4a5c203ec332a424f97a35623169aff658f0d8
https://github.com/simstudioai/sim/pull/5049/files#diff-2c0b382fe8cf3fa3e05f4f04cc4a5c203ec332a424f97a35623169aff658f0d8
apps/sim/lib/uploads/utils/file-utils.tshttps://github.com/simstudioai/sim/pull/5049/files#diff-ffb723db3f5688d79b0407b2238a775980249044a6ab20e212e0297a248b71e3
View file https://github.com/simstudioai/sim/blob/bb1d384d523a0d3a839bc8e60861888c137ce68c/apps/sim/lib/uploads/utils/file-utils.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/5049/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/5049/files#diff-ffb723db3f5688d79b0407b2238a775980249044a6ab20e212e0297a248b71e3
https://github.com/simstudioai/sim/pull/5049/files#diff-ffb723db3f5688d79b0407b2238a775980249044a6ab20e212e0297a248b71e3
Please reload this pagehttps://github.com/simstudioai/sim/pull/5049/files
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

Viewport: width=device-width


URLs of crawlers that visited me.