Path lexical sanitize

path-lexical-sanitize · version 1.0.0 · File paths (lexical) · free, no key needed

Sanitize an untrusted path to produce a safe relative path, stripping roots, drive letters, traversal segments, and illegal characters.

Use when you need to: sanitize path · path security sanitize · safe relative path.

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "path": "safe/relative/file.txt"
}

Response:

{
  "result": {
    "sanitized": "safe/relative/file.txt",
    "was_safe": true,
    "changes": []
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "path-lexical-sanitize",
  "version": "1.0.0",
  "input": {
    "path": "safe/relative/file.txt"
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/path-lexical-sanitize/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"path":"safe/relative/file.txt"}'

The machine-readable contract is at /v1/tools/path-lexical-sanitize/versions/1.0.0.

CLI

node cli.mjs run path-lexical-sanitize 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.