T09 · Insecure Skill Coding Practices
- Location
SKILL.md:80- Finding
Long-Lived OAuth Tokens Are Stored Without Enforced Filesystem Protection
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 80–85; related scope and security guidance at lines 138 and 328–332
Vulnerability Type: Insecure storage of sensitive OAuth credentials
Risk Level: MediumVulnerable Snippet
markdown The script will: 1. Generate a cryptographically random PKCE code_verifier + code_challenge 2. Print an authorization URL for you to open in your browser 3. Wait for you to paste back the redirect URL containing the `?code=` parameter 4. Exchange the code for access + refresh tokens 5. Save the tokens to `config/lovable-tokens.json`The requested authorization scope is documented separately:
markdown | `scope` | `offline projects:read projects:write projects:create workspaces:read workspaces:write` |The only documented local protection is repository exclusion:
markdown - **Never commit tokens or credentials to git.** The `config/lovable-tokens.json` file should be in your `.gitignore`. - The access token is a JWT that expires after 8 hours. The refresh token is a long-lived secret.Technical Analysis
The skill directs users to persist an access token and a long-lived refresh token in a JSON file. It does not require restrictive filesystem permissions, encryption at rest, an operating-system credential store, atomic file creation, or validation that the file is excluded from version control.
Adding a path to
.gitignoreonly reduces one accidental publication scenario. It does not protect the token from other local users, processes running under the same account, backups, workspace synchronization, overly broad file permissions, or manual repository inclusion. The artifact contains no.gitignoreor token-management scripts, so the claimed storage implementation and its permissions cannot be verified.The
offlinescope enables refresh-token use beyond the access token’s eight-hour lifetime. The requested write scopes also ...[truncated 2106 chars]- Remediation
View remediation
Remediation Suggestions
- Store refresh tokens in an operating-system keychain, credential manager, or dedicated secret-management service rather than a plaintext JSON file.
- If file-based storage is unavoidable:
- Create the configuration directory with mode
0700. - Create the token file with mode
0600. - Use atomic creation with exclusive-open semantics to avoid unsafe intermediate files.
- Reject operation if ownership or permissions are broader than expected.
- Avoid logging token values, authorization codes, or complete redirect URLs.
- Create the configuration directory with mode
- Include and verify an effective
.gitignoreentry forconfig/lovable-tokens.json; also add secret-scanning controls and a pre-commit check. - Request only the minimum OAuth scopes needed for the current operation. Avoid
offline, project-write, workspace-write, database, governance, or deployment privileges unless explicitly required. - Require explicit user confirmation before destructive or externally visible operations such as deployment, database changes, connector removal, or governance modification.
- Document token revocation procedures and provide a supported revocation mechanism rather than relying only on contacting support.
- Include the referenced scripts in the audited package so their endpoint validation, PKCE state verification, file handling, logging behavior, and refresh-token implementation can be reviewed.
