Skip to content

Send fuller browser-shaped headers on xoxc/xoxd requests (not just User-Agent) #143

Description

@nitrocode

Context

#141 / #142 fixed browser-session (xoxc/xoxd) API calls sending a non-browser User-Agent, which Slack's Enterprise Grid session-security policy was flagging as unexpected_user_agent and using to kill the session (forcing a logout of the real browser tab that owned it).

That fix only addressed the User-Agent header. src/slack/client.ts (browserApi, browserApiMultipart), src/slack/files.ts, and src/slack/canvas.ts still send a header set that's otherwise nothing like a real browser request: no Accept, Accept-Language, Accept-Encoding, sec-ch-ua, sec-ch-ua-mobile, sec-ch-ua-platform, or sec-fetch-* headers.

We don't have confirmation that Slack's fingerprinting checks any of these today. But since it's plausible it checks more than just UA, and the failure mode (force-logout of a real browser session, not just a failed API call) is high-cost, it's worth closing the gap defensively rather than waiting for the next flavor of this bug report.

Proposal

Add a shared "browser-shaped headers" helper (mirroring getUserAgent() in src/lib/version.ts) that all three browser-session call sites use, sending a header set consistent with a real Chrome/macOS request:

  • Accept, Accept-Language, Accept-Encoding
  • sec-ch-ua, sec-ch-ua-mobile, sec-ch-ua-platform
  • sec-fetch-site, sec-fetch-mode, sec-fetch-dest

Same override pattern as AGENT_SLACK_USER_AGENT/--user-agent would make sense here too, so a user whose actual browser/OS differs from the hardcoded defaults can match their own fingerprint more closely.

Out of scope: this only covers request headers. It doesn't address TLS/JA3-level or HTTP-stack-level fingerprinting differences between Bun's fetch and a real Chromium network stack, which no header change can fix.

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