spinframework / spinframework/spin

Improve diagnostics on forbidden file write

Open
#3,144 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
6.5k
Forks
310
Avg merge
1d 20h
Merged PRs (30d)
24

Description

When a guest attempts to write to the file system, it gets a "permission denied" error. For developers not familiar with Spin's stateless model, the reason for this can be non-obvious - after all, Spin itself has permission to write to the mapped directory - and can send them on a wild goose chase.

The current error is certainly the right result to return to the guest, but it might be good if we can provide more information to the operator (developer), indicating to them that:

  • Writes are intentionally forbidden by default, because in general Spin runtimes are stateless.
  • Writes can be enabled in the CLI environment, although this will hamper portability.
  • There is documentation to help you figure out how to achieve what you want to. (TODO: check that there is. Write it if there isn't)
    • You should also read the documentation for your target deployment environment because nobody likes surprises.

This is currently tricky because we defer all permissions stuff to Wasmtime - we just preopen the tempdir with read only permissions, so have no opportunity to intercept writes and do something more informative with them.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing where Spin preopens the temp directory read-only and how Wasmtime reports forbidden writes. Then inspect the CLI environment options and the relevant documentation. Done means operators receive an explanation of stateless write restrictions and available configuration or deployment guidance, while the guest still receives permission denied.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
backend, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.