Skip to content

fix(server): authenticate only API requests - #46702

Merged
Brendonovich merged 4 commits into
v2from
api-only-auth
Sep 2, 2026
Merged

Brendonovich merged 4 commits into
v2from
api-only-auth

Conversation

@Brendonovich

@Brendonovich Brendonovich commented Sep 2, 2026 •

Copy link
Copy Markdown
Member

Issue for this PR

Reported while debugging iPhone home-screen icons: Basic Auth blocked installation assets. No linked issue.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Authenticate only /api, /api/*, and /openapi.json. The app HTML, SPA routes, and all bundled static assets are public, including icons, manifests, fonts, and service workers. Session data and server operations remain protected. PTY connection-ticket validation and browser preflight handling are unchanged.

Use the existing asset handler rather than an icon allowlist or separate public responder. Missing icons return 404 instead of SPA HTML, and successful static HEAD requests return 200.

This is an independent PR based directly on v2, with no PWA layout or persistence changes. No existing app or live server was restarted or redeployed.

How did you verify your code works?

  • Bun 1.4.0, packages/cli: bun test ./test/web-ui.test.ts: 1 passed.
  • packages/server: bun test ./test/process.test.ts ./test/fetch.test.ts ./test/auth.test.ts ./test/pty-socket.test.ts ./test/persistent-pty.test.ts: 15 passed, 3 existing persistent-PTY skips because the smoke-test binary is unavailable.
  • Sequential server and CLI typechecks, Prettier, Oxlint, and git diff --check passed.
  • The unmodified pre-push hook passed all 33 repository typecheck tasks.

Screenshots / recordings

Not applicable: server authentication and static-response behavior only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@Brendonovich
Brendonovich enabled auto-merge (squash) September 2, 2026 01:57
@Brendonovich
Brendonovich merged commit 46c3363 into v2 Sep 2, 2026
10 checks passed
@Brendonovich
Brendonovich deleted the api-only-auth branch September 2, 2026 02:05
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
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