Skip to content

fix(search): follow Slack's file download redirects without carrying the token off its file host - #10084

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

waleedlatif1 merged 2 commits into
stagingfrom
fix/slack-file-redirects

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Follow-up to fix(search): read the full text of Slack canvases and files instead of the preview #10082: a live test against a real workspace read canvases, text files and DOCX in full, but a PDF still fell back to the preview. Its download failed before any response with an unclassified error, which on this path means a redirect rejected by maxRedirects: 0
  • Slack's file host now follows up to 3 redirects, only within files.slack.com (same origin, so an http: downgrade or lookalike host is refused too) via secure fetch's existing assertRedirectTarget hook. Every other native request, including Sheets, still follows none
  • A hop to any other host is refused, not followed without credentials: Slack bounces a token it will not serve to the workspace sign-in page, and following that would read the sign-in page as the file. The refusal is a NativeSearchError, so the read keeps the preview and names the host it was sent to
  • Matches Slack's guidance (handle redirects deliberately, require an exact Slack file host) and Sim's other Slack url_private downloaders, which already follow redirects

Type of Change

  • Bug fix

Testing

  • http.test.ts: the file-host redirect guard (the real closure passed to secure fetch) accepts a same-host hop and refuses the sign-in page, a lookalike host and an http: downgrade; Sheets keeps zero redirects and no guard. Comparing hostname instead of origin, dropping the guard, or letting Sheets follow redirects each turn a test red
  • Redirect following itself is proven at the real HTTP boundary in pinned-redirect-replay.server.test.ts
  • lib/sim-search/live + lib/knowledge/search suites pass; biome; egress-boundary, organization-egress, boundaries, comment-hygiene, test-patterns audits pass
  • Will re-run the live PDF read 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 6:52am UTC

Request Review

@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 3 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

@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 remain.

Summary

Slack file downloads may follow up to three redirects, but every hop must stay on https://files.slack.com.

  • Slack file reads follow redirects only on their file host.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Slack file download] --> B{Redirect target}
  B -->|Same origin, within three hops| C[Continue with token]
  B -->|Different origin| D[Refuse download]
  D --> E[Return preview and reason]
  C --> F[Read file contents]
Loading

Reviews (2) · Last reviewed commit: "fix(search): follow Slack file redirects..." · Reviewed by Greptile

@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 3 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 f42cf21 into staging Nov 16, 2026
81 of 82 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/slack-file-redirects branch November 16, 2026 16:58

This branch was previously deployed

1 inactive deployment
Preview — bf93223e 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