T09 · Insecure Skill Coding Practices
- Location
cmd/auth/login.go:62- Finding
OAuth Callback Accepts an Authorization Response Without State Validation
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill appears to be a real Labradoc CLI helper, but it handles account tokens and sensitive document/email data with several under-scoped security protections users should review before installing.
Install only if you trust the Labradoc CLI publisher and need agent-driven access to your Labradoc account. Prefer API tokens with narrow scope, avoid passing secrets on command lines, do not ask the agent to print raw tokens, keep API/auth URLs on HTTPS defaults, and review state-changing commands such as archive, revoke, upload, webhook, checkout, and API-key operations before running them.
cmd/auth/login.go:62OAuth Callback Accepts an Authorization Response Without State Validation
internal/cli/http.go:20Credential-Bearing Requests Permit Plaintext HTTP Endpoints
internal/cli/http.go:28Cross-Origin Redirects May Forward the Custom API-Key Header
The declared description centers on Labradoc CLI/API operations such as authentication and interacting with Labradoc resources. The actual code chunk does not perform any Labradoc API calls, CLI command execution, authentication, or document/task management. Instead, it is infrastructure code for config and logging initialization. While such code could support a larger Labradoc tool, this chunk’s behavior is materially different from the declared primary purpose, so this is a mismatch.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
var tokenCmd = &cobra.Command{
Use: "token",
Short: "Print the stored access token",
RunE: func(cmd *cobra.Command, _ []string) error {
tok, err := cli.LoadToken()
if err != nil {
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
var tokenCmd = &cobra.Command{
Use: "token",
Short: "Print the stored access token",
RunE: func(cmd *cobra.Command, _ []string) error {
tok, err := cli.LoadToken()
if err != nil {
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
var tokenCmd = &cobra.Command{
Use: "token",
Short: "Print the stored access token",
RunE: func(cmd *cobra.Command, _ []string) error {
tok, err := cli.LoadToken()
if err != nil {
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Exchange OAuth code for token
labradoc-cli api google drive code --code <oauth-code>
# Refresh access token
labradoc-cli api google drive refresh
# Revoke access
The documented auth token command prints the stored access token to stdout, which can expose credentials to agent logs, transcripts, shell history capture, or downstream tools. In an AI skill setting, commands that reveal raw tokens are especially dangerous because the agent may surface the secret back to the user or inadvertently leak it through observability pipelines.
- Optional: `--code-verifier`, `--redirect-uri`, `--state` (uses saved `pkce.json` if missing).
- Flag: `--json`.
- `labradoc auth token`
- Prints the stored access token. Flag: `--json`.
- `labradoc auth refresh`
- Refreshes the stored token. Flag: `--json`.
- `labradoc auth status`
The markdown describes that tokens and PKCE state are stored under the user's config directory, which affects credential privacy and account security. It does not include any caution about file sensitivity, access control, or avoiding sharing/backing up these files insecurely.
The documentation lists state-changing operations such as closing tasks, archiving files, reprocessing files, revoking API keys, and checkout/integration actions. The skill description does not warn that these commands modify remote account data or may be irreversible, which is relevant for user data and system integrity.
The skill exposes capabilities that can access environment variables and write files, but it does not declare any tool scope or permission boundaries. In a skill that handles API tokens and downloads/uploads documents, this increases the chance of unintended secret exposure or writing sensitive data to disk without clear user or platform constraints.
The trigger text is broad enough to activate on generic document-management requests, which could cause the agent to invoke this skill in situations the user did not intend. Because the skill can authenticate, call raw API endpoints, and interact with files, over-triggering increases the risk of unintended actions on sensitive data or external services.
The skill instructs users to pass API tokens via CLI flags, environment variables, and config files, but it does not warn about the exposure risks of each method. Tokens in command-line arguments can appear in process listings and shell history, and tokens stored in config files may be left with weak permissions or accidentally committed, which is especially dangerous given access to files, email, users, API keys, and billing endpoints.
The body command fetches email content from the API and supports --out to write the response to a file, but this file provides no confirmation prompt, warning comment, or other user-facing disclosure about that file-write behavior. Because email bodies may contain sensitive content, silently redirecting them to disk increases privacy and data-handling risk.
The upload command reads a local file and sends its contents to a remote API endpoint, but the code provides no confirmation prompt, warning print, or disclosure beyond the terse command description. Because this operation transmits potentially sensitive user data off-system, the lack of explicit warning is a semantic safety gap.
The question command constructs a request body from user-provided text or a local JSON file and posts it to the API, and the search command does the same for agent-based search. Although network transmission is part of the feature, there is no visible warning that request body contents may include sensitive data and will be sent to the remote service.
The Google Drive callback handler accepts an OAuth code and sends it over a network request via simpleGet, but there is no confirmation prompt, warning, or user-facing disclosure around handling this sensitive credential. The same pattern appears in the Gmail callback command, which can affect user privacy and account access because authorization codes are sensitive authentication material.
This command takes a --code value and includes it in a network request to the backend, but the file provides no warning, confirmation, or disclosure that sensitive OAuth material will be transmitted. Because OAuth codes can grant access to user accounts when exchanged, this operation should be made more explicit to the user.
This code takes a sensitive OAuth code from the --code flag, places it into a request query string, and sends it via simpleGet. The file contains no confirmation prompt, logging/print disclosure, or explanatory comment/docstring warning the user that credential-like data will be transmitted to an endpoint.
The manifest describes a CLI for Labradoc API operations such as tasks, files, users, API keys, email, integrations, and billing. This file adds direct Stripe-oriented commands and a webhook endpoint, which expose payment-provider-specific operations rather than just Labradoc resource management, expanding the described behavior into external billing infrastructure handling.
This code provides a command that directly sets the user's language preference from a supplied flag and sends it to the API, but the file contains no natural-language indication that the user is being offered a language choice or that any locale constraint is justified. Under the policy, forcing or changing language/locale settings without explicit opt-in is a natural-language policy concern.
This command explicitly prints the stored OAuth access token to stdout, which can expose credentials through terminal history, shell logging, CI job logs, process capture, or accidental copy/paste. In a CLI skill context, this is more dangerous because agent-driven execution may surface stdout back to users, logs, or other tools, increasing the chance of unintended token disclosure.
The documentation instructs users through OAuth flows for Google Drive, Gmail, and Microsoft Outlook but provides no warning that the generated URLs, authorization codes, and resulting tokens grant access to external accounts and should be treated as secrets. In an agent-driven CLI context, users may paste codes or share command output into logs or chats, which can expose linked email or file data and expand compromise beyond Labradoc itself.
The skill explicitly documents persistent storage locations for OAuth and PKCE state files but does not warn that these artifacts contain sensitive authentication material. In an agent context, this increases the chance that tokens are stored, reused, or exposed via logs, workspace access, or later tool calls without adequate user awareness.
When --out is provided, the code calls os.Create, which truncates or creates the destination file, but there is no confirmation prompt or user-facing warning about overwriting existing files. This is a file write with potentially destructive effects if the target path already exists.
This code saves the OAuth token to disk via cli.SaveToken(*token) but provides no prior disclosure that credentials will be persisted locally. Although the command's purpose is login, the only user-facing messages mention opening the auth URL and later that the token was saved, not that sensitive authentication material would be stored as part of the flow.
No suspicious patterns detected.