T09 · Insecure Skill Coding Practices
- Location
patterns/cli-wrapper.md:25- Finding
Plaintext Secrets and Sensitive API Data May Be Stored in Publishable Skill State
- Content
View full analysis
Vulnerability Details
File Location:
patterns/cli-wrapper.md:25-28(also supported bypatterns/api-wrapper.md:14-18andSKILL.md:77-79)
Vulnerability Type: Plaintext credential and sensitive-data storage
Risk Level: MediumVulnerable Code Snippets
patterns/cli-wrapper.md:25-28:markdown ## State CLI wrappers are usually stateless. Exceptions: - **Auth tokens** that expire → `{baseDir}/state.json`patterns/api-wrapper.md:14-18:markdown ### State & Caching Store in `{baseDir}/state.json`: - Incremental polling (last-seen ID/timestamp) - Response cache with expiry - Rate limit trackingSKILL.md:77-79:markdown **State locations:** - `<workspace>/memory/` — user-facing context - `{baseDir}/state.json` — skill-internal state (travels with skill)Technical Analysis
The Skill instructs generated CLI wrappers to store expiring authentication tokens in
{baseDir}/state.json. It also recommends storing API response caches in the same location and explicitly states that this state travels with the Skill.This creates a plaintext-secret exposure risk because the Skill directory may be copied, archived, committed to version control, or published to ClawHub. An authentication token or sensitive API response stored there could consequently be distributed with the package. This guidance also conflicts with
patterns/api-wrapper.md:23-24, which more safely states that secrets should use environment variables and never be hardcoded.The pre-scan's network-related pattern is otherwise consistent with legitimate API-wrapper functionality: the project recommends authenticated API requests but contains no fixed exfiltration endpoint, hardcoded credential, or executable network payload. The confirmed issue is the unsafe handling of credentials and response data after such requests.
Attack Path
- A user follows this Skill to generate an authenticated CLI or API wrapper.
- The generated wrapper writes an acc ...[truncated 1114 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the recommendation to store authentication tokens in
{baseDir}/state.json. - Store secrets only in environment variables, an operating-system keychain, or a dedicated secret manager such as 1Password.
- Keep non-secret runtime state in a non-publishable workspace or platform-specific application-data directory rather than inside the Skill package.
- Cache only explicitly non-sensitive response fields. Encrypt sensitive caches when storage is unavoidable and define short retention periods.
- Apply restrictive filesystem permissions to runtime state and secret material.
- Add
state.jsonand other runtime-state files to package, publication, and version-control exclusion rules. - Add a pre-publication check that rejects packages containing tokens, credentials, or populated runtime caches.
- Document token revocation and rotation procedures for accidental disclosure.
- Revise the state guidance to distinguish clearly among secrets, non-secret synchronization metadata, and potentially sensitive API response content.
- Remove the recommendation to store authentication tokens in
