Skip to content

Commit 33c3051

Browse files
joe4devclaude
andauthored
feat(aws-client): ask the user to allow local paths outside the workdir (#152)
* feat(aws-client): ask the user to allow local paths outside the workdir A path outside LOCALSTACK_AWS_WORKDIR (a file in ~/Downloads to upload) no longer fails outright: localstack-aws-client asks the user through MCP elicitation to allow it, once or its folder for the session. Without an answer (a client without elicitation, a headless run, decline) the command is refused as before. The private home, ~ paths, roots and folders holding the home or temp directory, network shares and .git / .lstk stay refused without asking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(aws-client): ask with inputRequired, which works on MCP 2026-07-28 extra.elicit() sends a server-initiated elicitation/create request, which protocol revision 2026-07-28 (Claude Code's) no longer has: the SDK threw before sending it, and the tool reported "Local Path Not Allowed". The tool now returns inputRequired with the form; the client asks the user and calls the tool again with the answer. On earlier revisions the SDK's shim sends the form as elicitation/create and calls the tool again. The state between the rounds names the paths allowed so far, so it is HMAC-signed with a per-process key, expires after 15 minutes and is bound to the command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(mcp): expect the SDK's refusal for an outside path without elicitation The tool now asks about a path outside the working directory with inputRequired. The test client declares no elicitation, so the SDK refuses to ask ("did not declare the required capability") and nothing runs. xmcp gives tool handlers no client capabilities, so the tool cannot return its own refusal first. A ~ path is still refused without asking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(aws-client): refuse .git, the private home and tool configs before asking Applies the review on #152: the .git/.lstk and private-home checks ran only on the part below an allowed folder, so allowing /repo/.git or the folder above the private home let them through. Every refusal now runs on the resolved path before the user is asked. Adversarial review rounds added: - refuse '..' after a symlink, which the OS applies where the link points - refuse the user's git and lstk config, and folders holding them, under any name a case-insensitive file system opens them by - one canonical real path on macOS (firmlinks), refuse /.vol paths - the "allow folder" answer covers the folder the prompt showed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 83341b7 commit 33c3051

9 files changed

Lines changed: 1045 additions & 46 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ This server provides your AI with dedicated tools for managing your LocalStack e
7575
| [`localstack-state-management`](./src/tools/localstack-state-management.ts) | Manages local file-based LocalStack state export/import workflows | - Export LocalStack state to a local file on disk through the LocalStack State REST API<br/>- Import LocalStack state from a local file<br/>- Inspect: list the resources deployed in the running LocalStack (type, ID, region, account)<br/>- Reset all state or only selected services<br/>- Supports service-level granularity for export, reset, and inspect<br/>- Use this for local disk workflows; use Cloud Pods for remote cloud-backed snapshots<br/>- Requires a valid LocalStack Auth Token |
7676
| [`localstack-extensions`](./src/tools/localstack-extensions.ts) | Installs, uninstalls, lists, and discovers LocalStack Extensions | - Manage installed extensions (`list`, `install`, `uninstall`) inside the running container<br/>- Browse the LocalStack Extensions marketplace (`available`)<br/>- Requires a valid LocalStack Auth Token |
7777
| [`localstack-ephemeral-instances`](./src/tools/localstack-ephemeral-instances.ts) | Manages cloud-hosted LocalStack Ephemeral Instances | - Create temporary cloud-hosted LocalStack instances and get an endpoint URL<br/>- List available ephemeral instances, fetch logs, and delete instances<br/>- Supports lifetime, extension preload, Cloud Pod preload, and custom env vars on create<br/>- Requires a valid LocalStack Auth Token |
78-
| [`localstack-aws-client`](./src/tools/localstack-aws-client.ts) | Runs AWS CLI commands against LocalStack for AWS | - Executes commands with the official AWS CLI v2 through `lstk aws`, so it requires `lstk` and `aws` in your system path<br/>- Keeps every request on LocalStack: the CLI runs without your `~/.aws` and behind a local proxy that refuses other hosts<br/>- Reads and writes local files only inside `LOCALSTACK_AWS_WORKDIR`<br/>- Sanitizes commands to block shell chaining<br/>- Auto-detects LocalStack coverage errors and links to docs |
78+
| [`localstack-aws-client`](./src/tools/localstack-aws-client.ts) | Runs AWS CLI commands against LocalStack for AWS | - Executes commands with the official AWS CLI v2 through `lstk aws`, so it requires `lstk` and `aws` in your system path<br/>- Keeps every request on LocalStack: the CLI runs without your `~/.aws` and behind a local proxy that refuses other hosts<br/>- Reads and writes local files only inside `LOCALSTACK_AWS_WORKDIR`, unless you allow a path outside it when the client asks (MCP elicitation)<br/>- Sanitizes commands to block shell chaining<br/>- Auto-detects LocalStack coverage errors and links to docs |
7979
| [`localstack-azure-client`](./src/tools/localstack-azure-client.ts) | Runs Azure CLI (`az`) commands against the LocalStack for Azure emulator | - Runs the Azure CLI installed on your machine with its own profile, never your Azure login<br/>- Blocks shell syntax and commands that would change the profile, install software or never end<br/>- Uses the extensions you installed with `az extension add`<br/>- Requires the Azure CLI and a valid LocalStack Auth Token |
8080
| [`localstack-aws-replicator`](./src/tools/localstack-aws-replicator.ts) | Replicates external AWS resources into a running LocalStack instance | - Start single-resource replication jobs with a resource type and identifier or ARN<br/>- Start batch replication jobs, such as SSM parameters under a path prefix<br/>- Poll job status by job ID and list existing jobs<br/>- List resource types supported by the running Replicator extension<br/>- Reads source AWS credentials from the MCP server environment and supports optional target account or region overrides |
8181
| [`localstack-app-inspector`](./src/tools/localstack-app-inspector.ts) | Inspects LocalStack application traces, spans, events, and IAM evaluations | - Enable or disable App Inspector for the running LocalStack instance<br/>- List and inspect traces to understand AWS service-to-service flows<br/>- Drill into spans, events, payload metadata, and IAM policy evaluation events<br/>- Filter by service, region, operation, resource, ARN, status, and time range<br/>- IAM: set the enforcement mode (`get-iam-mode`, `set-iam-mode`, which reports the previous mode and how to restore it), list denied requests and, after a fix, only new ones (`list-iam-denials`, `newer_than`), explain one with its deciding policies and LocalStack's suggested fix (`explain-iam`, `detail`, `get-iam-policy`), and read or clear the least-privilege policies derived from a run (`get-auto-derived-iam-policies`, `clear-auto-derived-iam-policies`)<br/>- Requires a valid LocalStack Auth Token and the App Inspector feature in the connected LocalStack license, except `get-iam-mode` / `set-iam-mode` (IAM enforcement) and the auto-derived policies (IAM Policy Stream); IAM details need a license that includes viewing IAM policy errors |
@@ -228,7 +228,7 @@ See **[docs/DOCKER.md](./docs/DOCKER.md)** for the run command, MCP client confi
228228
| `LOCALSTACK_AZURE_IMAGE_NAME` | Docker image the `start` action launches for the Azure stack (default `localstack/localstack-azure:latest`). | Latest Azure image |
229229
| `LOCALSTACK_AZ_PATH` | The `az` launcher, or the Azure CLI's Python, for the Azure tool. | Found on `PATH` |
230230
| `LOCALSTACK_AZ_CONFIG_DIR` | The Azure tool's own Azure CLI profile directory (default `~/.localstack/azure/mcp-config-<port>`); it must not overlap your `~/.azure`. | Under `~/.localstack/azure` |
231-
| `LOCALSTACK_AWS_WORKDIR` | The directory the AWS client tool runs the AWS CLI in. Local files a command reads or writes (`s3 cp`, `file://`, `--body`, an outfile) must be inside it. Unset in the Docker image, and when the server runs in `/` or your home directory: then only relative paths work, in a private temp directory. | The server's working directory |
231+
| `LOCALSTACK_AWS_WORKDIR` | The directory the AWS client tool runs the AWS CLI in. Local files a command reads or writes (`s3 cp`, `file://`, `--body`, an outfile) must be inside it. Unset in the Docker image, and when the server runs in `/` or your home directory: then only relative paths work, in a private temp directory. For an absolute path outside it, an MCP client with elicitation (such as Claude Code) asks you to allow the path, once or its folder for the session; without one, the command is refused. | The server's working directory |
232232
| `LOCALSTACK_AZ_WORKDIR` | The directory the Azure tool runs `az` in; relative file paths resolve against it. | The server's working directory |
233233
| `LOCALSTACK_AZ_TIMEOUT_SECONDS` | Time limit for one Azure CLI command (5–3600). | `300` |
234234

0 commit comments

Comments
 (0)