Repository navigation
Demo hardening: manager-only demo server, cookie session, TestSprite fixes - #88
Merged
Merged
Conversation
In demo mode (--demo) the server refuses every command it would start from user-controlled configuration, with one code, server_commands_disabled: - writes that add Script lifecycle hooks, review ci/setup steps, environment setup commands or scaffolding answer 422; - stored commands never spawn: hooks record a failed result and a Task comment, review CI parks the Task with the reason, environment checks fail, server CLI/shell Agents, native Chat command tools, the terminal PTY and compiler-cache helpers are refused; - --demo also keeps the embedded daemon off. Git operations Forge builds itself are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Demo mode (the same process-wide switch as the command refusal) now refuses, with HTTP 422 and code server_agents_disabled: - adding a provider credential (POST /providers) and starting a provider OAuth authorization; - admitting a Chat turn (send, retry, handoff, Genesis); Project Agent wakes admit no turn. The native backend refuses run_turn and fork_topic as well, so turns queued by other paths (inquiries, native Task executions, topic rotation, raw-inserted turn jobs) fail with the same code before any provider request. A visitor could otherwise bring their own model key and have a server-side agent use its tools (workspace files, fetch). Co-Authored-By: Claude Opus 5.5 <[email protected]>
In demo mode a repository may only be an https:// remote at a public address (the provider-request address policy, including DNS resolution). Refused with HTTP 422 and code server_location_refused: - repository create/update with a local path, a file:// or other non-https remote, or a private/local host; - a default or target branch Git could read as an option; - registering a server-owned (or shared-mount) repository location. The same rule runs before Git touches a stored repository (source resolution for workspaces and managed clones, repository sync), and the embedded workspace backend accepts only Forge's own managed clone as a server source. A local-path repository let a visitor run Git, with that directory's own configuration and hooks, against any server directory and read server files through diffs. The demo test fixture now uses a public https remote with a prepared managed clone. A new test runs the --demo seed and the demo entrypoint's REST calls under the policy. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Project environment assets name absolute paths on the Forge host and are copied into Task and review worktrees, so a visitor could copy the server's data directory or signing key into a worktree and read it. Demo mode refuses asset settings with 422 server_location_refused and refuses materialization before any copy. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- An issue-tracker integration's token_secret_ref names an environment variable of the server process, whose value sync sends as a bearer token to the integration's base_url. Any Project owner could have the server send any of its environment variables to their own URL. Demo mode refuses integration create/update and sync with 422 server_location_refused. - POST /api/v1/config/mcp (any signed-in account) writes agent configuration files under the server's HOME or working directory. Demo mode refuses it with the same code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/demo-instance.md "What a visitor can and cannot do" now lists the three refusals (commands, agents, server files and data) with their codes, what remains (Forge's Git for public https repositories, the shared network, a visitor's own daemon) and that seeding and the entrypoint are unaffected. docs/api.md documents server_agents_disabled and server_location_refused; CHANGELOG Security and Breaking entries are extended; docs/architecture.md names the guards. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Task's merge_config.target_branch reaches Git as a positional argument (merge, rebase, checkout). Demo mode now validates it as a Git branch name on Task create, update and native proposal (422 server_location_refused), as repository default branches already are; target_branch() keeps the use-time check for stored rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- register, login and refresh also set forge_session (access token) and forge_refresh (Path=/api/v1/auth): HttpOnly, SameSite=Strict, Secure when the public base URL is https or a loopback proxy forwards https. - The API accepts Bearer first, then the cookie; refresh takes the body token first, then the cookie; logout clears both. - A cookie-only unsafe request that is not same-origin is refused with 403 csrf_rejected; Bearer clients (forge-ctl, MCP, daemons) unaffected. - The web app signs in from the cookie when local storage is empty (startup /auth/me, refresh, logout and SSE work cookie-only). Lets username/password test services (TestSprite) capture the session. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The middleware read Bearer, then the forge_session cookie, then ?token=. An EventSource sends its ?token= together with the ambient cookie, so a stale cookie or another account's cookie (cookies are shared by every port on a host) overrode the explicit query credential. An Authorization header that was not a parseable "Bearer " (lowercase scheme, Basic) fell through to the cookie instead of failing. The cookie now authenticates only a request with no Authorization header and no ?token=; an invalid explicit credential is never rescued by it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
check_csrf returned early for GET/HEAD/OPTIONS/TRACE before reading Sec-Fetch-Site. SameSite=Strict does not separate ports on one host or sibling subdomains, so a page on http://127.0.0.1:3000 (or another *.oc.mai1015.com app on the demo) is same-site with Forge: its <img>, <video> or no-cors requests carried the session cookie and were served, e.g. a victim's private project media rendered in the attacker's page. A cookie-only request with Sec-Fetch-Site other than same-origin/none is now refused with 403 csrf_rejected for every method. Requests without Fetch Metadata keep today's rule (safe methods allowed, unsafe ones need a matching Origin). The SPA, EventSource and direct navigation send same-origin or none and are unaffected. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The demo will attach a real daemon running a CLI Agent. Chat turn admission and Project Agent wakes are now refused in demo mode only when the responder's Profile is native (it would run in the server process); a CLI responder runs on its daemon and is admitted as before. The native backend guard is unchanged. Daemon-owned repository locations stay allowed (tested); server-owned and shared_mount locations stay refused. Docs and changelog say so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Clearing a Task description saves an empty description in the modal and the full page (both sent null, which PATCH treats as unchanged). - Board cards, the Task modal and the full-page header show the Task type for non-default types. - The header brand links to Forge home (/) instead of a Project's board. - Board dialog creation and Overview counts: no defect; regression tests pin one POST, one Task in Todo, and refreshed Overview counts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ookie-only session - Over plain http no session cookie is set (cookies ignore ports, so another local server could receive a live token); local installs keep using local storage. - __Host-forge_session / __Host-forge_refresh (Secure, Path=/, no Domain); only refresh and logout read the refresh cookie. - With no stored token, the web app refreshes once from the cookie when /auth/me answers 401, then signs in or goes to /login. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> # Conflicts: # CHANGELOG.md
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
CodeQL flagged them as overwritten/duplicate properties. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ReviewConfig.verify makes the server start an app and run checks from Project configuration. Demo mode now refuses saving it with server_commands_disabled, like CI steps and hooks, and a verify that is already configured parks the Task in review without spawning anything, opening a Review or spending retries. Every server spawn site on v0.14 was audited against the demo gate. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Demo mode keeps Forge's Git (clone, fetch, merge, inspection) available for public https repositories a visitor names, but that Git ran with Git's defaults: it followed an HTTP redirect on the first request, including to plain http on a private address. A public remote could redirect a clone or fetch to an internal host on the demo network and clone an internal repository through Forge. disable() now appends command-scope configuration to the process environment, which every Git child inherits and no repository can override: no HTTP redirect, no network protocol but https (file keeps Git's user default for Forge's local transfers and bundles), no hooks, no fsmonitor, no implicit bare repositories, no submodule recursion, a low-speed abort and no credential prompt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
mai1015
marked this pull request as ready for review
October 18, 2026 00:03
…ning Co-Authored-By: Claude Opus 5.5 <[email protected]>
The hardened commit command removes inherited GIT_CONFIG_* so operator or repository config cannot steer automatic finalization; that also removed the demo Git policy. In demo mode it now installs the policy from index zero (count covers only the policy) and disables prompts; outside demo mode the command is unchanged. The policy is one definition in server_commands. Co-Authored-By: Claude Opus 5.5 <[email protected]>
TestSprite (demo, parallel tests on one seeded Task) found title edits and description clears that silently did nothing: the PATCH hit 409 version_conflict and the detail view swallowed it. On a conflict the view now refetches the Task, re-applies the edit once when another writer did not change that field, and otherwise keeps the draft open beside the current server value. Drafts are protected from live refreshes; modal and full-page views share the behaviour. Playwright spec covers both TestSprite scenarios and the concurrent edits. Co-Authored-By: Claude Opus 5.5 <[email protected]>
mai1015
pushed a commit
that referenced
this pull request
Oct 18, 2026
Conflicts resolved keeping both sides: next's shared fake-executable / ETXTBSY spawn helper and proxy passthrough, and #88's demo-mode spawn guards (24/24 production spawn sites still guarded), demo Git policy and task-detail conflict handling. CHANGELOG keeps one Unreleased section with every entry from both sides once. Semantic fix in an auto-merged file: the MCP config write applies the demo server-file refusal before the admin check, so demo returns 422 server_location_refused and normal mode keeps 403 admin_required. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hardens the public demo (https://forge.oc.mai1015.com) and fixes what the TestSprite suite found on it. The demo check on this PR builds the branch, deploys it to the live URL and runs the TestSprite suite against that exact build.
The server runs nothing from user configuration (demo mode)
The demo has open registration. Under
--demothe server is a manager only:422 server_commands_disabled; stored commands never spawn and refusals are visible (hook results, Task parks).422 server_agents_disabled. CLI agents on remote daemons are unaffected.https://remotes at a public address; local paths,file://, private hosts, option-like branch names and server-owned/shared-mount locations return422 server_location_refused. Environment assets, integrations reading server env tokens andPOST /config/mcpare refused too.--demokeeps the embedded daemon off.Cookie session
TestSprite's username/password login looks for a session cookie; the web app kept its token only in local storage. Over HTTPS, login/register/refresh now also set
__Host-forge_session/__Host-forge_refresh(HttpOnly, Secure, SameSite=Strict, Path=/). The API accepts the cookie when no explicit credential is sent; cookie-only requests that are not same-origin get403 csrf_rejected. Plain-http local installs set no cookie and keep using local storage.Fixes from the TestSprite run (53 tests: 48 passed, 4 failed, 1 blocked)
null, which PATCH treats as unchanged).README
A "Live demo" section: the URL, how the PR check works, and the suite coverage.
Every part was implemented by Codex and reviewed adversarially (security reviews for the demo lockdown and the cookie session). Full local gate green: db 468+210, services 2466 + 351, agents 44, api 455 + lib 99, model 85, daemon roundtrip 58, demo 13, normal-mode 10, forge-cli 11, executors 142, client 198, web 780.
Update for v0.14.0 (2026-10-16)
main. This PR's CHANGELOG entries sit under## [Unreleased].ReviewConfig.verify(new in v0.14: the server starts the app and runs checks) on every save path, and a verify configured earlier parks the Task without spawning anything. All 24 user-configurable server spawn paths audited against the demo gate..git) no longer clone in demo mode.web/e2e/project-planner-task-breakdown.spec.ts.🤖 Generated with Claude Code