T05 · Unauthorized Access and Privilege Escalation
Warning
- Location
- scripts/generate-docs.ts:1
- Finding
- Documentation Generator Runs with Unrestricted Filesystem and Process Permissions## Vulnerability Details **File Location**: `scripts/generate-docs.ts:1` **Vulnerability Type**: Excessive Deno runtime permissions **Risk Level**: Medium ```typescript #!/usr/bin/env -S deno run --allow-run --allow-read --allow-write ``` ### Technical Analysis The documentation generator is granted unrestricted process execution, filesystem read access, and filesystem write access. Its intended operations only require executing the `linear` and `deno` binaries and accessing files within the Skill directory. Deno permissions are security boundaries. Using `--allow-run`, `--allow-read`, and `--allow-write` without resource restrictions removes those boundaries for the entire script and any imported code. Although no malicious behavior or direct command-injection path was found in the current implementation, a compromised dependency or future code change would inherit access substantially broader than the documented task requires. ### Attack Path 1. A user invokes `scripts/generate-docs.ts` through its shebang. 2. Deno grants the process unrestricted read, write, and subprocess permissions. 3. Malicious code introduced through a compromised import or later modification executes in the generator's context. 4. The code reads any file available to the current operating-system user, modifies unrelated files, or launches arbitrary local executables. 5. Those actions occur without further Deno permission prompts because the broad permissions were granted at startup. ### Impact Assessment Exploitation would provide access equivalent to the operating-system account running the generator. Potential impact includes: - Reading user-accessible credentials, configuration, source code, and other sensitive files. - Modifying or deleting files outside the project. - Executing arbitrary commands and programs under the current user's privileges. - Using accessible local credentials to affect external services. This does not dire ...[truncated 126 chars]
- Remediation
- ## Remediation Suggestions Apply least-privilege Deno permissions: 1. Restrict reads and writes to the Skill directory and its generated documentation paths. 2. Restrict subprocess execution to the specific required binaries, `linear` and `deno`. 3. Prefer a reviewed Deno task or wrapper that computes explicit absolute paths rather than placing unrestricted permissions in the shebang. 4. Pin and review imported dependencies before allowing them to execute with filesystem or subprocess capabilities. 5. Run documentation generation in a sandbox or CI environment without production credentials. A hardened invocation should follow this pattern: ```bash deno run \ --allow-read=/absolute/path/to/skill \ --allow-write=/absolute/path/to/skill \ --allow-run=linear,deno \ scripts/generate-docs.ts ```
