Skip to content

fix: refuse writes on read-only servers when the file is opened - #2

Merged
ValgulNecron merged 1 commit into
mainfrom
fix/refuse-writes-on-read-only-servers
Nov 23, 2026
Merged

ValgulNecron merged 1 commit into
mainfrom
fix/refuse-writes-on-read-only-servers

Conversation

@ValgulNecron

Copy link
Copy Markdown
Contributor

Summary

A user with only servers:read could open a file for writing on a server; the upload was refused only at close, when the API rejected the stream. Gameplane spec 040 (US2 scenario 3) wants "permission denied" for the operation itself, and the Gameplane E2E TestSFTP_Lifecycle/read-only-permission-matrix checks that Create fails.

  • GET /sftp/v1/servers items now carry write, the API's file-access decision (Gameplane PR #1074 adds it).
  • On a server marked write: false, open-for-write, mkdir, rename and remove return permission denied before any request reaches the file routes.
  • A server without the field is left to the API, which still checks every change, so this is compatible with an API that does not send it.
  • specs.md documents the field.

Tests

New internal/vfs/readonly_test.go: tree and per-server logins refuse open-for-write and mkdir on a read-only server without touching the stream route; writable servers and servers without the field still accept writes. Existing tests unchanged.

Shipping

Merge this, then the sftp pointer bump goes into Gameplane #1074 together with the API side.


Generated by Claude Code

GET /sftp/v1/servers now marks each server with the API's write decision.
On a server marked write: false, open-for-write, mkdir, rename and remove
fail with permission denied before reaching the API, so a read-only user's
upload fails at open instead of at close (Gameplane spec 040, US2 scenario 3).
A missing field leaves the decision to the API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d76784b2-be33-453a-98b0-ab6e6b44ccde
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ValgulNecron
ValgulNecron merged commit 2d695cc into main Nov 23, 2026
6 checks passed
@ValgulNecron
ValgulNecron deleted the fix/refuse-writes-on-read-only-servers branch November 24, 2026 00:04
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.

2 participants