T09 · Insecure Skill Coding Practices
- Location
scripts/add-client.sh:19- Finding
Unvalidated Client Identifier Enables Path Traversal Outside the Client Workspace
- Content
View full analysis
- Remediation
View remediation
&2 exit 1 fi ``` 2. Apply equivalent validation to `NAME` in `add-client.sh`. 3. Canonicalize both the client root and candidate path with `realpath` or `realpath -m`. 4. Verify containment after canonicalization: ```bash CLIENT_ROOT="$(realpath -m "$BASE_DIR/clients")" CLIENT_DIR="$(realpath -m "$CLIENT_ROOT/$CLIENT")" case "$CLIENT_DIR/" in "$CLIENT_ROOT"/*) ;; *) echo "Client path escapes workspace" >&2; exit 1 ;; esac ``` 5. Reject symbolic links where configuration, report, or data files are expected, or open files using mechanisms that prevent symlink following. 6. Apply the same centralized validation routine to every script accepting a client identifier. ]]>
