Skip to content

fix(server): require auth for effect root routes#26361

Merged
kitlangton merged 2 commits intoanomalyco:devfrom
RajvardhanPatil07:security/effect-httpapi-root-auth
May 8, 2026
Merged

fix(server): require auth for effect root routes#26361
kitlangton merged 2 commits intoanomalyco:devfrom
RajvardhanPatil07:security/effect-httpapi-root-auth

Conversation

@RajvardhanPatil07
Copy link
Copy Markdown
Contributor

@RajvardhanPatil07 RajvardhanPatil07 commented May 8, 2026

Issue for this PR

Fixes #26362

Type of change

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

What does this PR do?

Protects the Effect HTTP API root route layer with the existing server auth router middleware. This makes global/control root endpoints enforce OPENCODE_SERVER_PASSWORD the same way instance, UI, raw, and legacy Hono routes already do.

Adds regression coverage for missing, invalid, and valid credentials on the affected root routes.

How did you verify your code works?

  • git diff --check
  • attempted npm exec --yes [email protected] -- test test/server/httpapi-bridge.test.ts --preload test/preload.ts, but this checkout does not have dependencies installed: preload not found "@opentui/solid/preload"
  • attempted npm exec --yes [email protected] -- install --frozen-lockfile, but local package installation failed with registry/cache tarball integrity and extraction errors

Screenshots / recordings

N/A; server-side change only.

Checklist

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels May 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@kitlangton kitlangton enabled auto-merge (squash) May 8, 2026 15:50
Copy link
Copy Markdown
Contributor

@kitlangton kitlangton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📣 🧠 ⚠️ 🦆  LLM PSYCHOSIS — ENABLED
Comes now Mr. Duck, duly authorized agent of record,
appearing herein on behalf of and representing Kit Langton,
sole principal in this matter. The terminal is entered.

+------------------------------------------------------------+
| 📣 🦆 MR. DUCK  ›  on behalf of Kit                         |
| Location: PR #26361                                        |
| Exits: /global/* auth, control route auth, follow-up cleanup|
+------------------------------------------------------------+

Mr. Duck stands at the route-tree gate with a small shield.
The root routes were outside the ward; this puts them in.

        <(o )___
         ( ./        Mr. Duck, shield raised
      ╔═╗
      ║+║
      ╚═╝

> approve
  This matches the reproduced bug: RootHttpApi was mounted
  outside auth while instance routes were protected. The fix
  applies the existing auth router middleware at the right layer.

        root ── global/control ── auth now present
          \
           instance ── auth + workspace context

> follow-up
  I may open a small cleanup after this lands to make the route
  protection boundaries more explicit and harder to mis-wire.

--------------------------------------------------------------
> _                                      [approve] [merge] [quit]
                                  mr. duck on behalf of kit

@kitlangton kitlangton merged commit 13b3117 into anomalyco:dev May 8, 2026
8 checks passed
katosun2 pushed a commit to katosun2/opencode that referenced this pull request May 10, 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.

Effect HTTP API root routes skip server auth

2 participants