Repository navigation
feat: SFTP access to game servers (spec 040) - #1074
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
…T005-T009)
GET /files/stat returns one Entry (lstat, never follows a symlink).
POST /files/rename {from,to,overwrite} renames with renameat on
descriptors from the rooted walk; overwrite=false uses RENAME_NOREPLACE.
PUT /files/stream?path=&offset=N writes a raw body through a temp file,
copying the first N bytes of the existing file first for resume; it
checks free space before writing (507), caps size with the new
--max-upload-bytes flag (default 20 GiB, 413) and leaves an existing file
untouched on any error or cancel. ENOSPC now answers 507 on every write.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
|
Important Review skippedToo many files! This PR contains 230 files, which is 130 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. CodeRabbit couldn't verify your organization's usage billing state, so no usage-priced review was started. Retry after the billing service recovers.
|
|
Generated by Claude Code |
The streaming upload route is mounted without the 30 s operation timeout (spec 040 FR-018). Approved by the maintainer (spec 040 T002 sign-off, row 6); no assertion removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
CI Report - fdf8d6brun 45244573277 - attempt 1 0 failed - 33 passed - 0 skipped - 48m39s elapsed Test selection: full (selection-rule change) - per-suite table Coverage
Changed
Slowest jobs
e2e buckets run
|
Changed-lines coverage was 84.3% (gate 90%). Adds tests for the upload size option, a missing data root, free-space errors, statfs, a resume source swapped for a directory, and rename into itself or over a file; drops two unreachable branches in the stream code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
…utes (spec 040 T010-T019) - Migration 024: sftp_ssh_keys, sftp_passwords, sftp_service_tokens, sftp_sessions and audit_events.source; DeleteUserTx removes SFTP rows. - auth: SSH key parsing (ed25519, ecdsa, RSA >= 3072), generated SFTP passwords (20-40 printable ASCII, argon2id), service tokens gpsftps_ and 15-minute sliding session tokens gpsftp_ stored as SHA-256 digests, revoked on key delete, password change, disable or delete; session guard restricted to the contract's routes with the cluster forced. - audit: source=sftp for session-token requests; source joins the hash only when set, so existing chains verify; additive webhook/S3 field. - rbac: FileAccess helper (VisibleServers, Allow, FilterEntries) now authorizes every file route with today's outcomes. - File routes stat, rename and stream through the gateway; stream is long-running, exempt from the body limit and capped by --files-max-upload-bytes (default 20 GiB). - /sftp/v1/login, /sftp/v1/sessions/check, /sftp/v1/servers and the /users/me/sftp self-service routes. - Approved test additions (spec 040 T002 rows 1-3): gateway duration tables gain the stream, stat and rename rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
lint (agent) on #1074: bodyclose in the new stream and rename tests (helpers now return the recorder) and unparam on locate, whose create argument was always false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
gosec G115/G202/G101, noctx in the new guard tests, revive doc comments, and unparam on audit insertChained (dashboard rows keep calling it). CheckSFTPSessions now checks each digest in one read transaction instead of building an IN list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
…t context Clears gosec G101 (name-based credential match) and contextcheck in the new guard test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
The API answers plain text unless the request accepts application/problem+json; the new envtest requests now send that header like the existing handler tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
|
Generated by Claude Code |
… server listing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
|
Generated by Claude Code |
…servers (spec 040) - Chart: optional sftp component (Deployment, Service, host key Secret kept across upgrades, local service token shared with the API, NetworkPolicy), files.maxUploadSize (20Gi) passed to the operator (agent --max-upload-bytes), API and gateway, policies that admit only the API, operator and gateway to gameplane-files pods on 8090. - API seeds the local SFTP service token from its Secret. - Agent --files-only mounts only the file routes. - Operator: a stopped or sleeping server whose files are requested gets a short-lived gameplane-files pod; the <name>-agent Service follows it; idle teardown after --files-idle-timeout (10m); a start deletes the file pod first; file access never wakes a server. - API: file routes on a stopped server stamp gameplane.local/files-requested-at (at most once a minute), wait up to 60 s, else 503 server.files.starting. - Tests: operator envtest and unit tests, agent files-only routes, API ensure-files and stream/rename/stat authorization. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
…or oversize streams Refresh files-requested-at every 30 s while a file request to a stopped server runs, map an over-cap body to 413 instead of 502, and cover the SFTP handlers, file proxy limits and gateway upload limit with unit tests. Pass the caller's context through the auth fault test helpers and align two new rbac tests with the catalog's 400 statuses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Settings SFTP page and dialogs, admin SFTP panel in Users & RBAC, cluster SFTP endpoint and token dialogs, Files tab upload progress, errors and file-pod starting states; SFTP entry in the shared settings nav. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Lets the SFTP server revoke an API login session it turned away (session cap reached, SSH handshake failed after login). Same service-token auth and cluster binding as sessions/check; foreign or unknown tokens are ignored and the answer is 204. Contract, plan, data model and tasks (T056) updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
- Admin Settings Nav: ACCOUNT (Theme, SFTP) and SERVER groups, with a terminal icon for SFTP. Non-admin copy of Settings — SFTP shows ACCOUNT only. - Sidebars on new screens are cloned from their section's source screen, so the matching item is active and icons render. - SSH keys Remove buttons align with the Add key right edge. - Users SFTP access panel rebuilt with vertical auto-layout: key line, fingerprint with ellipsis, Remove and Revoke in one column, primary Done. - Remove 204 stale export files that are not listed in screens.json or parts.json. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Users SFTP access and the Clusters SFTP dialogs become right-side drawers over a dimmed full-width page; the upload tray floats bottom-right over the full Files page. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Files starting: spinner, indeterminate bar and muted caption instead of the input-like pill, stopped-server header, no selection bar or editor tabs. Timed out: Retry button. Clusters SFTP drawer: endpoint-token wording, spacing and Create token gap. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Adds GET /users/{id}/sftp (keys with name, type, fingerprint, created and
last used times, plus password metadata; never the hash or key body),
DELETE /users/{id}/sftp/keys/{keyId} and DELETE /users/{id}/sftp/password.
Revoking a key or the password also revokes that user's live SFTP sessions
in the same transaction, as the self-service routes already do.
RBAC: the admin routes need users:manage. The new rules sit before the
generic users rules, and rbac.rule gains a contains field so the key
route can match its middle segment. Refused for SFTP-session callers.
Tests: unit tests for success, unknown user and key, cross-user scoping,
session revocation, SFTP-session refusal and store failures; rbac rule
tests; envtest file for the admin list and revoke flow through the
real rbac middleware.
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
US4 of spec 040. Each cluster gets its own SFTP endpoint:
- GET /clusters/{name}/sftp returns the address, host key fingerprint and
active service tokens; PUT stores a remote cluster's endpoint; POST and
DELETE /clusters/{name}/sftp-token mint (shown once, 2 active at most)
and revoke tokens. All need cluster:manage, and SFTP session tokens are
refused.
- The panel's own cluster reads its address from sftp.publicAddress
(GAMEPLANE_SFTP_PUBLIC_ADDRESS) and its fingerprint from the host key
Secret. Remote clusters use the new sftp_cluster_endpoints table
(migration 025).
- Chart: sftp.nodePort and sftp.loadBalancerIP, serviceType and
combination checks, sftp.caSecret renamed to sftp.apiCASecret, and
charts/gameplane/tests/sftp.sh wired into the helm CI job.
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Add an interrupted-upload resume subtest (drop the connection mid-write, reconnect, write at the server-reported offset) to TestSFTP_Lifecycle, reuse alice's key session for it, tighten the revocation bound to 60 s (SC-006) and move the CI payload to 64 MiB with a comment on why it is below the spec's 2 GiB. Document the SFTP endpoint in docs/security.md (threat model), the optional component in docs/architecture.md and the personal, cluster and endpoint-facing routes in api/specs.md. operator/specs.md and agent/specs.md already cover the file-only pod and the stat, rename, stream and --files-only surface. Mark T052 and T053 done. The sftp/specs.md and sftp/README.md part of T053 lives in the GameplanePanel/sftp submodule and stays open there. Signed-off-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
The sftp e2e bucket enables the chart's SFTP endpoint, which defaults to gameplane-test/sftp:<tag>, so the e2e image set now bakes, saves and loads it. suite-components.json maps TestSFTP_ and adds sftp to TestMultiCluster_. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
… events The SFTP screens had untranslated literals in JSX (empty values, key rows, username forms, placeholders); they now go through formatMessage. The upload queue started the next file from an effect that set state synchronously; it now advances from the enqueue, cancel, retry and settle handlers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
|
Generated by Claude Code |
Brings the approved spec 040 screens (Settings SFTP, SSH key and password dialogs, admin SFTP access, cluster SFTP drawer, file uploads and files-starting states) back onto master's design.fig, with the settings nav grouped ACCOUNT (Theme, MCP tokens, SFTP) and SERVER. Master's MCP tokens screens now use the shared nav instance. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
…tests The login subtest registered the connection's Close on its own t, so it closed as soon as that subtest ended and the upload subtest saw "connection lost". The parent test now closes whichever connection is current. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Without Accept: application/problem+json the API answers plain English text, so the token-limit and local-endpoint checks never saw the id. They now use the existing problem helper and compare messageId. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
- SFTP transfers on PostgreSQL: stream revalidation re-checks the SFTP session token instead of demanding a cookie. - Long transfers: sessions/check slides live sessions, so a transfer longer than 15 minutes is not cut off. - The agent gets the upload's Content-Length, so its size and free-space checks run before writing. - SFTP renames are audited with their paths. - Revoking an SFTP service token ends the sessions it minted (migration 026); a newly seeded chart token replaces the previous seeded one. - A user+server login refuses a server that does not exist. - The operator never creates a file-only pod while a start is pending. - Docs: sftp e2e bucket in AGENTS.md, local cluster name in data-model.md, operator pod rights in security.md, GitOps note in sftp.md. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
|
This is a spec conflict, not a flake. SC-003/FR-014 want an interrupted upload to resume from where it stopped, but the streaming upload only commits the file when the stream ends cleanly, so nothing is left behind after a drop. The fix depends on a maintainer decision on what a dropped upload should leave behind (keep the partial file for new files only, always, or stay atomic and amend SC-003). It will be pushed once that is settled. Generated by Claude Code |
main.go mounts the cluster routes with MountClustersWithSFTP now; list it in homeClientMounts and mount it in mountHomeClientRoutes (approved test rows 10 and 11). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
…oteGrant Rename TestMultiCluster_MCPTokenRemoteGrant to TestMultiCluster_TokenRemoteGrant and run the remote-cluster SFTP endpoint check as its sftp-remote-endpoint subtest, so it shares that test's admin login and remote cluster and the multicluster bucket stays at 7 admin logins (valgul 2026-11-23). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
valgul 2026-11-23: an upload cut mid-file leaves no partial file and is sent again; only downloads resume. Amend SC-003, US2 scenario 2, the edge case and FR-014, and turn the e2e resume subtest into an interrupted-upload-atomic check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
…ret ref Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
GET /sftp/v1/servers items gain write, the file-access check's create decision for that server, so the SFTP endpoint can refuse an upload on a read-only server when the file is opened (US2 scenario 3). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
|
The API side is in this PR (00400e5: Generated by Claude Code |
design.fig and assets/design-export take master's version (spec 030 frames); the spec 040 screens are re-applied on top in a follow-up design commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Settings SFTP row, Files upload/starting screens, Users SFTP access, Clusters SFTP screens, SFTP cards and the ACCOUNT/SERVER settings nav, copied onto master's design (spec 030 frames kept); export regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Summary
Spec 040: SFTP access to game server files (issue #1051). Every SFTP login and file operation goes through the API as the signed-in user; the SFTP endpoint itself is the
sftp/component (GameplanePanel/sftp, pointer at sftp#2's merge).files/stat,files/rename, streamedPUT files/stream(atomic commit, offset prefix copy, free-space and size checks).user,user+server,user+ns/server), session tokens with keepalive slide and revocation, per-cluster SFTP endpoint and service tokens, shared file-access check (rbac.FileAccess) for the Files tab and SFTP,GET /sftp/v1/serverswith per-serverwrite, audit sourcesftp, rename audit paths, migrations 025/026.sftpcomponent (host key Secret, service token, NetworkPolicy),files.maxUploadSize.design.fig(re-applied on master's spec 030 design) with export.Tests
New unit, envtest and E2E tests (bucket
sftp; remote endpoint as thesftp-remote-endpointsubtest ofTestMultiCluster_TokenRemoteGrant, renamed fromTestMultiCluster_MCPTokenRemoteGrant). Existing-test edits were approved by valgul row by row (T002 sign-off rows 1–11).Changelog
changelog/unreleased/1074-sftp-access.md.Generated by Claude Code