Skip to content

Support creating temporary files and directories #306

Open

Description

@bjorn3
No description provided.

Activity

  1. caspervonb commented on Aug 5, 2020

    @caspervonb
    Contributor

    As far as I know, implementations will fallback to getenv("TEMP_DIR") as the base temp directory, do we need to provide anything else here?

  2. bjorn3 commented on Aug 5, 2020

    @bjorn3
    Author
  3. tschneidereit commented on Aug 5, 2020

    @tschneidereit
    Member

    As far as I know, implementations will fallback to getenv("TEMP_DIR") as the base temp directory

    WASI implementations really shouldn't be doing this, nor should WASI explicitly sanction it, as that'd go against WASI's design principles: it'd make shared global state available to content implicitly. Whatever data other processes leave in that directory would now be accessible from within the sandbox.

    Even if you solve that part by instead creating an isolated temporary directory just for this sandboxed content, there are still tricky issues: depending on the OS and configuration, you can do DoS attacks by writing large files. And you can gather information about the system by figuring out the free space, again by writing large files, but incrementally until you get an error.

    We clearly should have support for temp_dir etc, but it'll probably have to come through an explicit capability the application needs to request.

  4. theduke commented on Jun 15, 2022

    @theduke

    Chiming in here: I had the exact same idea.

    Many applications really want/need temporary files, especially considering how important it is on Wasm to not blow up the memory usage, since allocated memory can't be reclaimed.

    It would also be nice to specify a minimum required size and a requested size when creating a temp dir/file, and to ask the environment for size allowance.

    What's the best way to push this forward? A concrete API proposal?

  5. bjorn3 commented on Jun 15, 2022

    @bjorn3
    Author

    Even if you solve that part by instead creating an isolated temporary directory just for this sandboxed content, there are still tricky issues: depending on the OS and configuration, you can do DoS attacks by writing large files. And you can gather information about the system by figuring out the free space, again by writing large files, but incrementally until you get an error.

    That is already possible if you have any directory exposed to the wasi module. So maybe just have a --allow-tmpdir option?

  6. added
    S-inactiveStatus: no discussion in over a year. Records silence during triage; not a proposal to close.
    on Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-inactiveStatus: no discussion in over a year. Records silence during triage; not a proposal to close.feature-requestRequests for new WASI APIs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions