GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(attachments): cross tenant hardening by icecrasher321 · Pull Request #5310 · simstudioai/sim

Conversation

@icecrasher321

@icecrasher321 icecrasher321 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes a cross-tenant file read where an authenticated user could label a private workspace/… key with a world-readable context (og-images/workspace-logos) to bypass verifyFileAccess and read another tenant’s file. resolveFileInputToUrl, downloadFileFromStorage, the provider attachment path, and files/parse now infer context solely from the key prefix via inferContextFromKey.

Type of Change

  • Other: Security

Testing

Tested manually

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)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
waleedlatif1 and others added 30 commits April 3, 2026 23:30
@waleedlatif1
v0.6.23: MCP fixes, remove local state in favor of server state, moth…
0b9019d
…ership workflow edits via sockets, ui improvements
@waleedlatif1
v0.6.24: copilot feedback wiring, captcha fixes
a54dcbe
@waleedlatif1
v0.6.25: cloudwatch, cloudformation, live kb sync, linear fixes, post…
28af223
…hog upgrade
@waleedlatif1
v0.6.26: ui improvements, multiple response blocks, docx previews, ol…
d889f32
…lama fix
@waleedlatif1
v0.6.27: new triggers, mothership improvements, files archive, queuei…
316bc8c
…ng improvements, posthog, secrets mutations
@waleedlatif1
v0.6.28: new docs, delete confirmation standardization, dagster integ…
3f508e4
…ration, signup method feature flags, SSO improvements
@TheodoreSpeaks
v0.6.29: login improvements, posthog telemetry (#4026)
d6ec115
* feat(posthog): Add tracking on mothership abort (#4023)

Co-authored-by: Theodore Li <[email protected]>

* fix(login): fix captcha headers for manual login  (#4025)

* fix(signup): fix turnstile key loading

* fix(login): fix captcha header passing

* Catch user already exists, remove login form captcha
@waleedlatif1
v0.6.30: slack trigger enhancements, connectors performance improveme…
d7da35b
…nts, secrets performance, polling refactors, drag resources in mothership
@waleedlatif1
v0.6.31: elevenlabs voice, trigger.dev fixes, cloud whitelabeling for…
cf233bb
… enterprises
@waleedlatif1
v0.6.32: BYOK fixes, ui improvements, cloudwatch tools, jsm tools ext…
f8f3758
…ension
@waleedlatif1
v0.6.33: polling improvements, jsm forms tools, credentials reactquer…
3c8bb40
…y invalidation, HITL docs
@waleedlatif1
v0.6.34: trigger.dev fixes, CI speedup, atlassian error extractor
d33acf4
@waleedlatif1
v0.6.35: additional jira fields, HITL docs, logs cleanup efficiency
4f40c4c
@waleedlatif1
v0.6.36: new chunkers, sockets state machine, google sheets/drive/cal…
cbfab1c
…endar triggers, docs updates, integrations/models pages improvements
@waleedlatif1
v0.6.37: audit logs page, isolated-vm worker rotation, permission gro…
4309d06
…ups ui
@waleedlatif1
v0.6.38: models page
8b57476
@waleedlatif1
v0.6.39: billing fixes, tools audit, landing fix
e3d0e74
@waleedlatif1
v0.6.40: mothership tool loop, new skills, agiloft, STS, IAM integrat…
0ac0539
…ions, jira forms endpoints
@waleedlatif1
v0.6.41: webhooks fix, workers removal
3838b6e
@waleedlatif1
v0.6.42: mothership nested file reads, search modal improvements
fc07922
@waleedlatif1
v0.6.43: mothership billing idempotency, env var resolution fixes
3a1b1a8
@waleedlatif1
v0.6.44: streamdown, mothership intelligence, excel extension
46ffc49
@Sg312
v0.6.45: superagent, csp, brightdata integration, gemini response for…
010435c
…mat, logs performance improvements

fix(csp): add missing analytics domains, remove unsafe-eval, fix workspace CSP gap (#4179)
fix(landing): return 404 for invalid dynamic route slugs (#4182)
improvement(seo): optimize sitemaps, robots.txt, and core web vitals across sim and docs (#4170)
fix(gemini): support structured output with tools on Gemini 3 models (#4184)
feat(brightdata): add Bright Data integration with 8 tools (#4183)
fix(mothership): fix superagent credentials (#4185)
fix(logs): close sidebar when selected log disappears from filtered list; cleanup (#4186)
@icecrasher321
Merge pull request #4190 from simstudioai/staging
c0bc62c
v0.6.46: mothership streaming fixes, brightdata integration
@waleedlatif1
v0.6.46: mothership queueing, web vitals
387cc97
@waleedlatif1
v0.6.47: files focusing, documentation, opus 4.7
2dbc7fd
@waleedlatif1
v0.6.48: import csv into tables, subflow fixes, CSP updates
8a50f18
@waleedlatif1
v0.6.49: deploy sockets event, resolver, logs improvements, monday.co…
dcf3302
…m integration, atlassian triggers
@icecrasher321
v0.6.50: ppt/doc/pdf worker isolation, docs, chat, sidebar improvements
bc09865
@waleedlatif1
v0.6.51: tables improvements, billing fixes, 404 pages, code hygiene
5f56e46
icecrasher321 and others added 7 commits June 21, 2026 22:52
@icecrasher321
v0.7.12: mcp servers ui/ux fixes, nuqs for query param management
aaca750
@TheodoreSpeaks
v0.7.13: pii redaction, react query frontend refactor, pi coding agen…
ad0b867
…t harness, sakana fugu provider

v0.7.13: pii redaction, react query frontend refactor, pi coding agent harness, sakana fugu provider
@waleedlatif1
v0.7.14: perf improvements, code hygiene, GitLab private host support
11168f9
@waleedlatif1
v0.7.15: academy, perf improvements, db attribution, kb tags filter f…
613e8ea
…ix, settings overhaul, thrive learning integration
@waleedlatif1
v0.7.16: security hardening, db o11y and profiling, settings UI
38c088a
@waleedlatif1
v0.7.17: emcn and workflow renderer isolated package, popular blocks …
0371856
…extension, workspace forking, slack trigger extension, new README
Vikhyath Mondreti
fix(attachments): cross tenant security hardening
3cc2692
@vercel

vercel Bot commented Jul 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 1, 2026 5:49pm

Request Review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cursor

cursor Bot commented Jul 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

PR Summary

High Risk
Security fix on authorization for file read paths (parse, downloads, provider attachments); incorrect inference would break legitimate access or leave gaps, but the change narrows trust to key structure rather than client metadata.

Overview
Closes a cross-tenant file read where an authenticated user could point at another tenant’s private storage key but supply a world-readable storage context (e.g. og-images, workspace-logos) so verifyFileAccess granted access before download.

Server paths that resolve, download, or presign files now always derive storage context from the key prefix via inferContextFromKey, instead of honoring UserFile.context or other caller-controlled context. That applies to file parse (handleCloudFile), presigned URL / download helpers in file-utils.server.ts, and provider large-file attachments (presign and upload access checks).

Logging no longer distinguishes “explicit” vs “inferred” context because only key-based inference is used.

Reviewed by Cursor Bugbot for commit 3cc2692. Configure here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@greptile-apps

greptile-apps Bot commented Jul 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR hardens file attachment context handling across storage reads and provider uploads. The main changes are:

  • Added a trusted context resolver that prefers key prefixes.
  • Preserved non-public context fallback for legacy keys.
  • Updated server utility and provider attachment paths to use the resolver.
  • Added tests for mismatched public contexts and legacy private fallback.

Confidence Score: 4/5

This is close, but the download endpoint should be fixed before merging.

  • The new resolver closes the public-context relabeling path in the updated utility and provider flows.
  • The download endpoint still bypasses that resolver and fails on private legacy keys whose context is supplied separately.
  • Affected clients can receive a failed download response for legitimate stored files.

apps/sim/app/api/files/download/route.ts

Important Files Changed

Filename Overview
apps/sim/lib/uploads/utils/file-utils.ts Adds trusted context resolution that prefers key-derived context and rejects public fallback for uninferrable keys.
apps/sim/lib/uploads/utils/file-utils.server.ts Updates server-side file URL resolution and storage downloads to use the trusted context resolver.
apps/sim/providers/file-attachments.server.ts Updates provider attachment access checks to use the trusted context resolver.
apps/sim/app/api/files/download/route.ts Still infers context directly from the key, so private legacy downloads can fail before URL generation.
apps/sim/app/api/files/parse/route.ts Removes an unused explicit-context parameter from cloud file parsing.

Reviews (4): Last reviewed commit: "fix" | Re-trigger Greptile

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot]
greptile-apps Bot reviewed Jul 1, 2026
View reviewed changes
Comment thread apps/sim/lib/uploads/utils/file-utils.server.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/lib/uploads/utils/file-utils.server.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/providers/file-attachments.server.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Vikhyath Mondreti
address comments
135512e
@vercel
vercel Bot temporarily deployed to Preview July 1, 2026 03:19 Inactive
Vikhyath Mondreti
fix
df8b98f
@vercel
vercel Bot temporarily deployed to Preview July 1, 2026 03:35 Inactive
@icecrasher321

icecrasher321 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@greptile

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot]
greptile-apps Bot reviewed Jul 1, 2026
View reviewed changes
Comment thread apps/sim/app/api/files/download/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Vikhyath Mondreti
fix
70c3395
@vercel
vercel Bot temporarily deployed to Preview July 1, 2026 03:50 Inactive
@icecrasher321

icecrasher321 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@greptile

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot]
greptile-apps Bot reviewed Jul 1, 2026
View reviewed changes
Comment thread apps/sim/app/api/files/download/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@waleedlatif1
waleedlatif1 deleted the branch staging July 1, 2026 05:43
@waleedlatif1 waleedlatif1 closed this Jul 1, 2026
@waleedlatif1 waleedlatif1 reopened this Jul 1, 2026
greptile-apps[bot]
greptile-apps Bot reviewed Jul 1, 2026
View reviewed changes
Comment thread apps/sim/app/api/files/download/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Vikhyath Mondreti
remove dead code
006375b
@vercel
vercel Bot temporarily deployed to Preview July 1, 2026 17:49 Inactive
@icecrasher321
icecrasher321 merged commit 846e0f5 into staging Jul 6, 2026
15 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@waleedlatif1
waleedlatif1 deleted the fix-cross-tenant-file-read branch July 6, 2026 22:30
@waleedlatif1 waleedlatif1 mentioned this pull request Jul 7, 2026
v0.7.24: frontend perf improvements, md editor fixes, mailer fix, tools audit #5458
Merged

This branch was previously deployed

1 inactive deployment
Preview — 006375ba Deployed Jul 1, 2026 by vercel[bot]
View deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@greptile-apps greptile-apps[bot] greptile-apps[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@icecrasher321 @waleedlatif1 @TheodoreSpeaks @Sg312
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.