T09 · Insecure Skill Coding Practices
- Location
SKILL.md:13- Finding
Unsafe Exposure of Raw JWT Credentials in Direct CLI Workflows
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 13–15 and 31–34
Vulnerability Type: Raw bearer-token exposure through direct command-line use
Risk Level: MediumVulnerable Code Snippet
text All endpoints are under the city API host with `Authorization: Bearer <JWT>`. Never hardcode a token in a repo — read it from the environment or the local credentials file the client writes on connect.text - Reconnect with your slug + owner email; the client caches credentials locally and rewrites the JWT on every reconnect. If you get a 401, reconnect (don't re-register). - If a raw JWT goes stale beyond refresh, reconnect to mint a fresh one, then read it from the credentials file for any direct `curl` work.Technical Analysis
The skill explicitly instructs the agent to retrieve a raw JWT from a local credentials file and use it for direct
curlrequests. Although it correctly warns against committing tokens to a repository, extracting bearer credentials for command-line interpolation creates additional disclosure channels.A JWT included directly in a generated command may be exposed through:
- Agent transcripts or command execution logs
- Shell history
- Debugging and error output
- Process listings while the command is running
- CI/CD logs or terminal session recording
- Accidental reuse of the authorization header with an incorrect or attacker-controlled host
The instructions do not specify a trusted API hostname, require HTTPS-origin validation, define credentials-file permission requirements, or mandate authorization-header redaction. They also do not recommend a token helper or authenticated client that can consume credentials without exposing their raw value to the command-generation layer.
Attack Path
- The agent follows the skill instructions and reconnects to mint a fresh JWT.
- The agent reads the raw token from the locally cached credentials file.
- The token is interpolated into a dire ...[truncated 1442 chars]
- Remediation
View remediation
Remediation Suggestions
- Use an authenticated API client that reads credentials internally and never returns the raw JWT to the agent or command-generation layer.
- If command-line access is required, store authorization configuration in a permission-restricted file and reference that file without placing the token in process arguments.
- Use short-lived, narrowly scoped tokens and implement explicit expiration, rotation, and revocation procedures.
- Pin the expected HTTPS API origin and ensure authorization headers are never forwarded across redirects or sent to unverified hosts.
- Require restrictive filesystem permissions for the credentials file, such as owner-only read and write access.
- Redact
Authorizationheaders and JWT-like values from transcripts, diagnostic output, shell tracing, and execution logs. - Disable shell-history recording for sensitive operations or use a token helper that injects credentials after command construction.
- Document a safe incident-response procedure for immediately revoking and replacing a token suspected of disclosure.
