Skip to content

fix(slack): download files from Slack's download URL and never send the token off its file host - #10088

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/slack-file-download-url
Nov 16, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/slack-file-download-url

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Slack now answers a PDF's url_private with a redirect to a sandboxed viewer on another domain, while url_private_download serves the bytes from files.slack.com. Confirmed on staging: a live search read of a PDF was redirected to slack-files.com (a Slack-owned domain) and fell back to the preview, while canvas, text and DOCX reads worked
  • New lib/internal/slack/file-download.ts, shared by every Slack file download (search reads, the Slack download tool, the Slack trigger's file attachments):
    • slackFileDownloadUrl prefers url_private_download, falls back to url_private, and returns nothing for a file Slack does not host (is_external, mode: external, filetype: remote) or any URL that is not exactly https://files.slack.com
    • assertSlackFileHost keeps redirects on the file host, so a sign-in bounce or viewer redirect is refused rather than saved as the file
  • Security fix in the download tool and trigger: they sent the Slack token to whatever url_private held, including a remote file's own host. They now never request a file Slack does not host
  • Tool and trigger behavior: a PDF now downloads its bytes instead of the viewer page; a remote file or off-host redirect fails (tool: 400 File has no Slack-hosted download URL) or is skipped with a log (trigger) instead of storing an HTML page as the file
  • Matches Slack's guidance (never send a token to a remote file's URL; require an exact Slack file host) and recent OSS fixes for the same redirect, which prefer url_private_download

Type of Change

  • Bug fix

Testing

  • file-download.test.ts: download URL preferred, url_private fallback, every external/off-host/lookalike/http:/malformed case refused (an off-host download URL does not fall back), redirect guard keeps hops on the file host. Each guard reverted and watched go red
  • operations.test.ts, webhooks/providers/slack.test.ts, sim-search/live/slack.test.ts: each caller downloads from url_private_download, passes the redirect guard, and never fetches a remote file; dropping either redirect guard turns its test red
  • lib/internal/slack, lib/webhooks, lib/sim-search/live, lib/knowledge/search suites pass (1,243 tests); biome; egress-boundary, organization-egress, boundaries, comment-hygiene, test-patterns, file-names, utils, explicit-any, import-specifiers, source-text, source-conventions audits pass
  • Will re-run the live PDF, canvas, text and DOCX reads on staging after merge

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 16, 2026 5:34pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Slack file downloads prefer url_private_download and reject files hosted elsewhere.

  • Slack live-search file reads prefer the byte-download URL and stay on Slack.
  • The Slack download tool fetches files from Slack’s byte-download URL.
  • Slack trigger attachments only download files hosted by Slack.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Slack file metadata] --> B{Slack-hosted download URL?}
  B -->|No| C[Tool fails, trigger skips, Search keeps preview]
  B -->|Yes| D[Download from files.slack.com]
  D --> E{Redirect stays on file host?}
  E -->|Yes| D
  E -->|No| C
  D --> F[Return file contents]
Loading

Reviews (2) · Last reviewed commit: "fix(slack): report an off-host file redi..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit d0ef9eb into staging Nov 16, 2026
62 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/slack-file-download-url branch November 16, 2026 17:38

This branch was previously deployed

1 inactive deployment
Preview — d0f0f230 Deployed Nov 16, 2026 by vercel[bot]
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.

1 participant