Skip to content

Origin/Referer headers are inconsistent across browser-session request sites #148

Description

@nitrocode

Context

Follow-up from #141/#142 and #143 (browser-shaped headers). This one is narrower than #143: it's not about missing browser headers, it's that agent-slack's own code disagrees with itself about which of Origin/Referer to send.

What's inconsistent

  • src/slack/client.ts (browserApi, browserApiMultipart, the call path behind auth.test, message.*, search.*, drafts.*, and most other commands) sends Origin: https://app.slack.com but never sets Referer.
  • src/slack/files.ts and src/slack/canvas.ts (file/canvas downloads) send Referer: https://app.slack.com/ but never set Origin.

A real browser fetch/XHR from app.slack.com sends both headers together, on every request, always. Having only one or the other, and having it differ depending on which agent-slack module made the call, is a stranger signal than either header being simply absent.

Proposal

Send both Origin: https://app.slack.com and Referer: https://app.slack.com/ (or a more precise https://app.slack.com/client/<team_id>/... Referer if the team_id is known at call time) on every browser-session request, across client.ts, files.ts, and canvas.ts. Ideally as a shared constant/helper so the three call sites can't drift again.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions