Skip to content

📸 fix: Authenticate Native GitHub Attachment Uploads - #397

Merged
danny-avila merged 1 commit into
mainfrom
danny-avila/github-attachment-auth
Nov 14, 2026
Merged

danny-avila merged 1 commit into
mainfrom
danny-avila/github-attachment-auth

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

Summary

I fixed native GitHub attachment authentication for sandboxed worker commands. A screenshot upload can fail with HTTP 401 even while Git and GitHub API requests authenticate: gh uploads attachments to uploads.github.com, but the worker restores its masked CLI credential only at api.github.com.

  • Add the exact uploads.github.com origin to GitHub.com's CLI credential substitution hosts.
  • Preserve credential masking, TLS verification, host-environment restoration, and separate Git authentication.
  • Keep enterprise routing and credential exclusion from arbitrary subdomains and asset-storage hosts covered by regression tests.
  • Document the upload path and GitHub's remaining credential acceptance checks.
sandboxed gh: sentinel token
    → SRT HTTPS proxy
    → api.github.com or uploads.github.com: substitute CLI credential
    → other hosts: no CLI credential substitution

Related report: LibreChat-AI/LibreChat#18116.

Change Type

  • Bug fix
  • Documentation update

Testing

  • Reproduced the missing upload-host regression with two failing tests before the production change.
  • Passed 109 tests across github.test.js and native-sandbox.test.js, using TMPDIR=/private/tmp to avoid an existing macOS temporary-path alias failure in a linked-worktree fixture.
  • Passed the worker package build, explicit TypeScript check, and git diff --check.
  • Covered propagation of the upload-host policy to SRT while the command receives only a sentinel and the parent environment is restored. These tests use a simulated SRT manager; they do not perform a real upload.

Test Configuration

npm ci --prefix packages/code --ignore-scripts
npm run build --prefix packages/code
TMPDIR=/private/tmp node --test packages/code/dist/github.test.js packages/code/dist/native-sandbox.test.js
npm exec --prefix packages/code -- tsc --noEmit -p packages/code/tsconfig.json

Rollout requires updated workers and a GitHub CLI with native attachment support. A real upload using Lia's App remains the acceptance check after rollout; GitHub may reject credentials from particular Apps independently of this routing fix.

Checklist

  • I followed the existing worker credential policy structure.
  • I performed a self-review of the scoped diff and the CLI-to-SRT credential handoff.
  • I added regression coverage for the authentication boundary.
  • I updated the worker documentation.
  • Focused local checks pass with the test configuration above.

@danny-avila

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current PR head efe2584. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads. Please focus on the credential-masking boundary, exact upload-host matching, and unchanged enterprise routing.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T18:12:18.702114Z efe2584 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: efe25843ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila
danny-avila merged commit cd0a38b into main Nov 14, 2026
29 of 31 checks passed
@danny-avila

Copy link
Copy Markdown
Collaborator Author

Post-merge native-SRT upload canary using personal OAuth authentication and explicit identity content encoding to preserve request framing. Synthetic one-pixel image; this is transport verification only. Asset: https://github.com/user-attachments/assets/76791b8b-12e7-4867-ae84-9a7b4f0f983f

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.

1 participant