fix(eve): reject Slack sign-in HTML from private file fetch (missing files:read) (#1317) - #1437
Open
iroiro147 wants to merge 1 commit into
Open
fix(eve): reject Slack sign-in HTML from private file fetch (missing files:read) (#1317)#1437iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
…files:read) (vercel#1317) When the Slack bot token lacks files:read, the authenticated file fetch returns a 200 OK browser sign-in page (text/html) instead of the file bytes. createSlackFetchFile staged that HTML as the attachment, which surfaced downstream as a vision/auth mystery ('the model received a Slack login page'). Reject any HTML-shaped payload from the private file fetch with an actionable error that names the likely missing files:read scope and tells the operator to reinstall the app after adding it. Happy-path binary downloads are unchanged (a response is refused only when its content-type is text/html, or it has no content-type and reads as HTML, so real image/binary attachments are never false-positives). Signed-off-by: iroiro147 <sarthak.singh@juspay.in>
Contributor
|
@iroiro147 is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
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.
Fixes #1317.
Problem
When the Slack bot token lacks
files:read, the authenticated private-file fetch returns an HTTP 200 browser sign-in page (text/html) instead of the file bytes.createSlackFetchFilestaged that login HTML as the attachment, which surfaced downstream as a confusing "the model received a Slack login page" outcome rather than a clear "missing scope" signal.Change
In
packages/eve/src/public/channels/slack/attachments.ts,createSlackFetchFilenow refuses to stage an HTML-shaped payload:Content-Typeistext/htmlafter a successful (2xx) fetch throws.Content-Typethat reads as HTML (<!DOCTYPE html/<html, leading-whitespace tolerant, checked on a body clone so the real bytes are not consumed) also throws.The error is actionable — it names the likely missing
files:readbot scope and tells the operator to add it, reinstall the Slack app, and retry.Why this is safe / minimal
text/html, or it has no content-type and clearly reads as HTML. Real image/binary/other attachments never matchtext/html, so there is no false positive.Docs
docs/channels/slack.mdx→ Attachments now notes thefiles:readrequirement and the intentional sign-in-HTML failure.Validation
attachments.test.ts: reject 200+text/html; reject HTML body with no content-type; happy-path binary download still returns bytes + mediaType (no false positive). 32/32 pass.pnpm typecheckclean;oxlintclean on both edited files.packages/eve/.changeset/slack-file-fetch-reject-html-wrapper.md(patch).