Skip to content

fix(eve): reject Slack sign-in HTML from private file fetch (missing files:read) (#1317) - #1437

Open
iroiro147 wants to merge 1 commit into
vercel:mainfrom
iroiro147:fix/slack-file-fetch-html-1317
Open

fix(eve): reject Slack sign-in HTML from private file fetch (missing files:read) (#1317)#1437
iroiro147 wants to merge 1 commit into
vercel:mainfrom
iroiro147:fix/slack-file-fetch-html-1317

Conversation

@iroiro147

Copy link
Copy Markdown
Contributor

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. createSlackFetchFile staged 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, createSlackFetchFile now refuses to stage an HTML-shaped payload:

  • A response whose Content-Type is text/html after a successful (2xx) fetch throws.
  • A response with no Content-Type that 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:read bot scope and tells the operator to add it, reinstall the Slack app, and retry.

Why this is safe / minimal

  • Happy-path binary downloads are untouched: a response is refused only when it is explicitly text/html, or it has no content-type and clearly reads as HTML. Real image/binary/other attachments never match text/html, so there is no false positive.
  • The refusal is a single guard in the fetch seam; no other channel, route, or staging logic changes.
  • Error message is the actionable frame (missing scope + reinstall), matching the issue's suggestions Hello Eve #1 + Question: have you looked at x711 for agent tool calls? #2.

Docs

docs/channels/slack.mdxAttachments now notes the files:read requirement and the intentional sign-in-HTML failure.

Validation

  • Targeted tests in 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 typecheck clean; oxlint clean on both edited files.
  • Changeset: packages/eve/.changeset/slack-file-fetch-reject-html-wrapper.md (patch).

…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>
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@iroiro147 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

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.

Slack: reject login HTML from private file fetch (missing files:read)

1 participant