[PR #8515] [MERGED] test(server): run the real access hook chain in a regression (#7914) #8647

Closed
opened 2026-11-07 16:46:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8515
Author: @Gunterlie
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @Gunterlie

Base: staging ← Head: test/access-chain-7914


📝 Commits (4)

  • 29e3b71 test(server): run the real access hook chain in a regression (#7914)
  • ee008e8 test(server): isolate env file, wait out login cache, tighten asserts (#7914)
  • b3b19c7 Merge remote-tracking branch 'origin/staging' into test/access-chain-7914
  • 05a0cc3 docs: name the peers that pass the IP allowlist (#7914)

📊 Changes

2 files changed (+123 additions, -1 deletions)

View changed files

📝 docs/REMOTE_ACCESS.md (+1 -1)
➕ scripts/regressions/access-chain-security.regression.ts (+122 -0)

📄 Description

Linked issue

Refs #7914 (last code slice; with #8510 merged, #7914 can close. The Docker gateway question moved to #8512).

Why this change

The access audit for #7914 found the hooks correct but untested as a chain: loopback-proxy-auth-security.regression.ts copies the hook order by hand, so removing an access hook from packages/server/src/app.ts passed every test.

What changed

  • New scripts/regressions/access-chain-security.regression.ts (test only, no product code). It builds the real app with buildApp() and sends requests from a remote address:

    • Default config: 403 on GET /api/chats, an avatar and a background route, /, an unknown path, and POST /api/generate; /api/health stays 200; loopback gets 200 on /api/chats.
    • Partial or invalid config keeps the remote client at 403: only BASIC_AUTH_USER, only BASIC_AUTH_PASS, empty or invalid-only IP_ALLOWLIST, an allowlist without the client, malformed BYPASS_AUTH_DOCKER / BYPASS_AUTH_TAILSCALE, a damaged .remote-login.json.
    • Valid login from outside the allowlist: 403 (the same credentials from the allowlisted address get 200), so only ipAllowlistHook can deny it.
    • Pins the documented limit that a same-host relay without forwarding headers looks local (docs/REMOTE_ACCESS.md).
  • Isolation: own temp DATA_DIR and MARINARA_ENV_FILE, so a developer .env cannot change the result; waits out the 2 s login-file cache before the damaged-file case.

  • docs/REMOTE_ACCESS.md: the allowlist bullet now says trusted Tailscale/Docker peers and TRUSTED_AUTH_PROXY still pass (review finding from #8510).

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Agent runs: node ./scripts/run-regressions.mjs --filter access-chain-security → 1/1 passed. Bite test: with basicAuthHook commented out the test fails (200 !== 403); with ipAllowlistHook commented out the valid-login-outside-allowlist case fails (200 !== 403). pnpm check passed on the first commit. An Opus review checked env and cache isolation; its fixes are in the second commit.

Manual verification notes

  • None needed beyond CI (test-only change). The security filename puts it in pnpm regression:security and the node-regressions shards.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Not applicable.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8515 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `test/access-chain-7914` --- ### 📝 Commits (4) - [`29e3b71`](https://github.com/Pasta-Devs/Marinara-Engine/commit/29e3b71baf7aebe47e3ab9ff69a57070935b14df) test(server): run the real access hook chain in a regression (#7914) - [`ee008e8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ee008e8ef7ab377ab47335c50f36b0b804f290f4) test(server): isolate env file, wait out login cache, tighten asserts (#7914) - [`b3b19c7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b3b19c77a1bf706e7ba4cbecd838c0c601f4f11e) Merge remote-tracking branch 'origin/staging' into test/access-chain-7914 - [`05a0cc3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/05a0cc3b149d11f37900397eb8fc9cb476ad0909) docs: name the peers that pass the IP allowlist (#7914) ### 📊 Changes **2 files changed** (+123 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/REMOTE_ACCESS.md` (+1 -1) ➕ `scripts/regressions/access-chain-security.regression.ts` (+122 -0) </details> ### 📄 Description ## Linked issue Refs #7914 (last code slice; with #8510 merged, #7914 can close. The Docker gateway question moved to #8512). ## Why this change The access audit for #7914 found the hooks correct but untested as a chain: `loopback-proxy-auth-security.regression.ts` copies the hook order by hand, so removing an access hook from `packages/server/src/app.ts` passed every test. ## What changed - New `scripts/regressions/access-chain-security.regression.ts` (test only, no product code). It builds the real app with `buildApp()` and sends requests from a remote address: - Default config: 403 on `GET /api/chats`, an avatar and a background route, `/`, an unknown path, and `POST /api/generate`; `/api/health` stays 200; loopback gets 200 on `/api/chats`. - Partial or invalid config keeps the remote client at 403: only `BASIC_AUTH_USER`, only `BASIC_AUTH_PASS`, empty or invalid-only `IP_ALLOWLIST`, an allowlist without the client, malformed `BYPASS_AUTH_DOCKER` / `BYPASS_AUTH_TAILSCALE`, a damaged `.remote-login.json`. - Valid login from outside the allowlist: 403 (the same credentials from the allowlisted address get 200), so only `ipAllowlistHook` can deny it. - Pins the documented limit that a same-host relay without forwarding headers looks local (`docs/REMOTE_ACCESS.md`). - Isolation: own temp `DATA_DIR` and `MARINARA_ENV_FILE`, so a developer `.env` cannot change the result; waits out the 2 s login-file cache before the damaged-file case. - `docs/REMOTE_ACCESS.md`: the allowlist bullet now says trusted Tailscale/Docker peers and `TRUSTED_AUTH_PROXY` still pass (review finding from #8510). ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Agent runs: `node ./scripts/run-regressions.mjs --filter access-chain-security` → 1/1 passed. Bite test: with `basicAuthHook` commented out the test fails (`200 !== 403`); with `ipAllowlistHook` commented out the valid-login-outside-allowlist case fails (`200 !== 403`). `pnpm check` passed on the first commit. An Opus review checked env and cache isolation; its fixes are in the second commit. ### Manual verification notes - None needed beyond CI (test-only change). The `security` filename puts it in `pnpm regression:security` and the node-regressions shards. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Not applicable. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:46:13 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8647
No description provided.