Skip to content

fix(desktop): authenticate gated file downloads like REST (supersedes #89013) - #90546

Merged
OutThisLife merged 2 commits into
mainfrom
bb/gated-file-download-auth
Aug 20, 2026
Merged

fix(desktop): authenticate gated file downloads like REST (supersedes #89013)#90546
OutThisLife merged 2 commits into
mainfrom
bb/gated-file-download-auth

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

What does this PR do?

Supersedes #89013. Files panel listing on a gated remote uses hermes:api (native bearer, then OAuth-partition cookies). Download used saveGatewayFile, which always rode the OAuth cookie partition. A cookieless native / native-password session can list files and still 401 on Download.

This makes save/read use the same bearer-then-cookie choice as REST. It drops the default-session cookie-jar walk from #89013: Desktop password login already posts into persist:hermes-remote-oauth.

Related Issue

Fixes #88987

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Changes Made

  • resolveGatedDownloadAuth reuses resolveOauthRestAuth for oauth mode
  • saveGatewayFile and the data-URL fallback present that auth (native bearer streams with Authorization)
  • Tests pin bearer-first, then cookie; session-token for token/local

How to Test

cd apps/desktop
npx vitest run --project electron electron/native-auth-decisions.test.ts electron/gateway-file-download-transport.test.ts
  • Connect Desktop to a password-gated remote (native or embedded login)
  • Files panel Download writes the file locally (no 401)
  • Local (non-remote) Files panel is unchanged

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS (unit tests; not runtime-tested against a live password remote)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Credit: @686f6c61 (primary). Related: #89013, #89257.

OutThisLife and others added 2 commits August 20, 2026 00:35
Downloads have to present the same bearer-vs-cookie choice as oauth REST.
A cookie-only save against a cookieless native session is the Files-panel 401.

Co-authored-by: 686f6c61 <github@00b.tech>
saveGatewayFile rode the OAuth cookie partition even when hermes:api already
held a native bearer, so listing worked and Download 401'd.

Co-authored-by: 686f6c61 <github@00b.tech>
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

running on 0f18087 — fix(desktop): authenticate gated file downloads like REST


Still running 1 job: CI timing report

⚠️ Warnings

OSV vulnerability scan · View job

7 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.

@OutThisLife
OutThisLife enabled auto-merge (rebase) August 20, 2026 05:37
@OutThisLife
OutThisLife merged commit cce0427 into main Aug 20, 2026
41 checks passed
@OutThisLife
OutThisLife deleted the bb/gated-file-download-auth branch August 20, 2026 05:39
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.

[Bug] Desktop: attachment download fails (401) on remote gateway with password (basic) auth — "Couldn't fetch X from the gateway"

1 participant