Repository navigation
fix(slack): download files from Slack's download URL and never send the token off its file host - #10088
Merged
Conversation
…he token off its file host
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummarySlack file downloads prefer
|
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 9 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
Collaborator
Author
Collaborator
Author
|
@cubic-dev-ai review this PR |
Contributor
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
url_privatewith a redirect to a sandboxed viewer on another domain, whileurl_private_downloadserves the bytes fromfiles.slack.com. Confirmed on staging: a live search read of a PDF was redirected toslack-files.com(a Slack-owned domain) and fell back to the preview, while canvas, text and DOCX reads workedlib/internal/slack/file-download.ts, shared by every Slack file download (search reads, the Slack download tool, the Slack trigger's file attachments):slackFileDownloadUrlprefersurl_private_download, falls back tourl_private, and returns nothing for a file Slack does not host (is_external,mode: external,filetype: remote) or any URL that is not exactlyhttps://files.slack.comassertSlackFileHostkeeps redirects on the file host, so a sign-in bounce or viewer redirect is refused rather than saved as the fileurl_privateheld, including a remote file's own host. They now never request a file Slack does not hostFile has no Slack-hosted download URL) or is skipped with a log (trigger) instead of storing an HTML page as the fileurl_private_downloadType of Change
Testing
file-download.test.ts: download URL preferred,url_privatefallback, 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 redoperations.test.ts,webhooks/providers/slack.test.ts,sim-search/live/slack.test.ts: each caller downloads fromurl_private_download, passes the redirect guard, and never fetches a remote file; dropping either redirect guard turns its test redlib/internal/slack,lib/webhooks,lib/sim-search/live,lib/knowledge/searchsuites 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 passChecklist
test-auditauthoring gate)