{"id":18361601,"url":"https://github.com/cardoso/spinlet","last_synced_at":"2025-04-10T04:29:58.075Z","repository":{"id":168225334,"uuid":"643888539","full_name":"cardoso/spinlet","owner":"cardoso","description":"Spin plugin to run wasm32-wasi (preview2) command components as plugins","archived":false,"fork":false,"pushed_at":"2023-06-26T20:33:07.000Z","size":28885,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T14:46:11.322Z","etag":null,"topics":["plugin","runtime","spin","wasi","wasm"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cardoso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-22T11:16:06.000Z","updated_at":"2023-05-24T02:26:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"3a446ec9-dd36-4710-b491-40ee4f4ccc82","html_url":"https://github.com/cardoso/spinlet","commit_stats":null,"previous_names":["cardoso/spinlet"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cardoso%2Fspinlet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cardoso%2Fspinlet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cardoso%2Fspinlet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cardoso%2Fspinlet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cardoso","download_url":"https://codeload.github.com/cardoso/spinlet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248157255,"owners_count":21056981,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["plugin","runtime","spin","wasi","wasm"],"created_at":"2024-11-05T22:34:34.797Z","updated_at":"2025-04-10T04:29:58.044Z","avatar_url":"https://github.com/cardoso.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spinlet\n\nSpinlet is a plugin and runtime for building and running wasm32-wasi cli components as  [plugins](https://github.com/fermyon/spin-plugins) for  [Spin](https://github.com/fermyon/spin). It provides a sandboxed environment with access control to protect the host system from malicious code. Spinlet supports features such as `std::env::args` and `std::fs::read_dir`, and allows users to specify which environment variables, directories, and files the plugin has access to.\n\n## Requirements\n\nSpinlet requires the following tools to be installed:\n\n- [Rust](https://www.rust-lang.org/) \u003e= 1.70.0\n- [Spin](https://github.com/fermyon/spin) \u003e= 1.2.0\n- [wasm-tools](https://github.com/wasmtime/wasm-tools) \u003e= 1.0.35\n- [wit-bindgen](https://github.com/wasmtime/wasm-tools) \u003e= 0.7.0\n- [spin-pluginify](https://github.com/itowlson/spin-pluginify) \u003e= [PR #6](https://github.com/itowlson/spin-pluginify/pull/6)\n\n## Installation\n\n```bash\ngit clone https://github.com/cardoso/spinlet\ncd spinlet\nspin pluginify -i\nspin let\n```\n\n## Status\n\n### Hooks\n\n- [x] `spin let [command]`\n\nSpinlets can now hook into spin's native commands by specifying in their manifest:\n\n```toml\n[hook.build.after]\nenabled = true\n[hook.build.before]\nenabled = true\n```\n\n### Sandboxed Environment\n\n- [x] access control\n\nSpinlet's manifest allows users to specify which environment variables, directories, and files the plugin has access to.\n\n```toml\n[[access.fs.dir]]\npath = \".\"\nread = true\n\n[[access.env.var]]\nkey = \"HOME\"\n\n[access.env.args]\nenabled = true\n[access.io.stdin]\nenabled = true\n[access.io.stdout]\nenabled = true\n[access.io.stderr]\nenabled = true\n\n```\n\n- [x] `std::env::args`\n\n```rust\nfn main() {\n    for arg in std::env::args() {\n        println!(\"{}\", arg);\n    }\n\n    // Plugin only has access to environment variables specified in the manifest\n    for (key, value) in std::env::vars() {\n        println!(\"{}: {}\", key, value);\n    }\n}\n```\n\n```bash\n➜  spinlet git:(main) ✗ spin let update\nYou're using a pre-release version of Spin (1.3.0-pre0). This plugin might not be compatible (supported: \u003e=0.7). Continuing anyway.\n/Users/cardoso/Library/Application Support/spin/plugins/let/let\nupdate\nSPIN_BIN_PATH: /Users/cardoso/.cargo/bin/spin\nSPIN_BRANCH: main\nSPIN_BUILD_DATE: 2023-05-20\nSPIN_COMMIT_DATE: 2023-05-19\nSPIN_COMMIT_SHA: d476000\nSPIN_DEBUG: false\nSPIN_TARGET_TRIPLE: aarch64-apple-darwin\nSPIN_VERSION: 1.3.0-pre0\nSPIN_VERSION_MAJOR: 1\nSPIN_VERSION_MINOR: 3\nSPIN_VERSION_PATCH: 0\nSPIN_VERSION_PRE: pre0\n```\n\n- [x] `std::fs::read_dir`\n\n```rust\npub fn main() {\n    /// Plugin only has access to files in the current working directory\n    match std::fs::read_dir(\"/workspace\") {\n        Ok(dir) =\u003e {\n            for entry in dir {\n                match entry {\n                    Ok(entry) =\u003e println!(\"{}\", entry.path().display()),\n                    Err(error) =\u003e println!(\"error reading entry: {}\", error),\n                }\n            }\n        }\n        Err(error) =\u003e println!(\"error reading /: {}\", error),\n    }\n}\n```\n\n```bash\n➜  spinlet git:(main) ✗ pwd\n/Users/cardoso/Developer/cardoso/spinlet/spinlet\n➜  spinlet git:(main) ✗ spin let workspace\nYou're using a pre-release version of Spin (1.3.0-pre0). This plugin might not be compatible (supported: \u003e=0.7). Continuing anyway.\n/workspace/Cargo.toml\n/workspace/.spinlets\n/workspace/.DS_Store\n/workspace/target\n/workspace/install.sh\n/workspace/let-0.1.5-macos-aarch64.tar.gz\n/workspace/Cargo.lock\n/workspace/README.md\n/workspace/adapters\n/workspace/build.sh\n/workspace/.gitignore\n/workspace/spinlets\n/workspace/.git\n/workspace/let.json\n/workspace/spin-pluginify.toml\n/workspace/src\n```\n\n## Usage\n\n```bash\nspin let [spinlet] -- [spinlet args]\n```\n\n```terminal\nUsage: spin let [OPTIONS] \u003cSPINLET\u003e [-- \u003cARGS\u003e...]\n\nArguments:\n  \u003cSPINLET\u003e  Spinlet to run\n  [ARGS]...  Arguments to pass to the\n             spinlet\n\nOptions:\n  -w, --workspace \u003cWORKSPACE\u003e\n          Workspace to run the spinlet\n          in [default: .]\n  -h, --help\n          Print help\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcardoso%2Fspinlet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcardoso%2Fspinlet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcardoso%2Fspinlet/lists"}