T09 · Insecure Skill Coding Practices
- Location
scripts/alapi.py:227- Finding
ALAPI Token Exposure Through Process Arguments and URL Query Strings
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This ALAPI helper is scoped to ALAPI documentation and API calls, but users should handle tokens carefully and prefer a pinned install source.
Install only from a source and revision you trust. Before live calls, understand that the skill may use ALAPI_TOKEN from the environment and send the token and request parameters to ALAPI; avoid putting real tokens in shell history or shareable snippets, and rotate any token that may have been logged.
scripts/alapi.py:227ALAPI Token Exposure Through Process Arguments and URL Query Strings
README.md:26Mutable and Unpinned npx Installation Sources
A second aspect of the same mismatch is that the skill is presented as a documentation/code-generation assistant, but the operational guidance centers on a CLI capable of real authenticated requests, with no enforceable confirmation mechanism shown. That can lead operators to enable the skill under a lower-risk assumption than its actual behavior warrants, which increases the chance of unintended external calls and credential exposure through use of ambient auth.
A second aspect of the same mismatch is that the skill is presented as a documentation/code-generation assistant, but the operational guidance centers on a CLI capable of real authenticated requests, with no enforceable confirmation mechanism shown. That can lead operators to enable the skill under a lower-risk assumption than its actual behavior warrants, which increases the chance of unintended external calls and credential exposure through use of ambient auth.
The README instructs users to install the skill via npx skills add without pinning a specific package version or validating the package source. Because npx resolves and executes remote package code dynamically, a compromised or unexpectedly updated package in the dependency chain could result in arbitrary code execution during installation.
This line continues the recommendation to use npx skills add as the installation mechanism, again relying on an unpinned transient executable. In the context of a security-sensitive agent skill, encouraging dynamic execution of unversioned tooling increases supply-chain risk and can expose users to malicious package updates or package-resolution attacks.
The skill instructs the agent to use environment access and make live network requests, but it declares no tool scope or permission boundaries. That creates an authorization gap: a host system or reviewer cannot easily tell that the skill may read ALAPI_TOKEN and perform outbound requests, increasing the chance of unintended credential use or network actions.
The activation text is broad enough to trigger on ordinary ALAPI-related conversation, which can cause the skill to engage in contexts where the user did not intend tool-assisted API handling. In a skill that can use environment tokens and make network requests, overbroad triggering increases the risk of unintended credential-backed actions or unnecessary exposure of external requests.
The skill allows authenticated network calls using ALAPI_TOKEN from the environment, but it does not require a prominent user-facing warning that ambient credentials may be used and data will be sent to an external service. This is dangerous because users may believe no credentialed action will occur unless they paste a token, while the skill can silently rely on existing secrets in the runtime environment.
This JSON file contains multiple natural-language prompts and expected outputs written to require Chinese responses and behavior, but it does not indicate that the user can choose another language or that the skill is intentionally region-specific. Under the policy rule, forcing a specific language without opt-in is a locale-policy violation.
The templates are designed to send ALAPI_TOKEN to a remote third-party service, but the surrounding guidance does not explicitly call out that the token will be transmitted over the network as part of requests, including in URLs for some examples. In a code-generation skill context, users may paste real credentials into generated commands without fully appreciating the exposure, increasing the chance of token disclosure via shell history, logs, proxies, monitoring tools, or copied snippets.
The documentation states that an explicitly provided token should take precedence over the environment variable, but the provided code templates largely hardcode use of ALAPI_TOKEN from the environment and do not implement that precedence. This can cause developers to rely on a security/control behavior that does not exist, leading to accidental use of the wrong credential, cross-environment token mixups, or failed attempts to override credentials safely during testing or incident response.
The cURL example places the ALAPI token directly in the URL query string, which is commonly exposed in shell history, process listings, reverse-proxy logs, browser history, observability systems, and support screenshots. In a code-template skill, this is especially risky because users may copy-paste the command verbatim with real credentials, causing avoidable secret leakage even though HTTPS protects the transport channel itself.
# GET
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
url = f"{BASE_URL}/{path}"
if method == "POST":
resp = requests.post(url, json=params, timeout=10)
else:
resp = requests.get(url, params=params, timeout=10)
The manifest says ALAPI should only be called when the user explicitly provides a token and confirms the call, but the code permits direct invocation by silently sourcing a token from ALAPI_TOKEN and immediately performing the network request. This creates a policy-bypass condition where an agent or wrapper could trigger outbound authenticated API calls without the user's contemporaneous awareness or consent.
The helper _resolve_token reads credentials from the process environment, expanding the skill's authority beyond the stated interaction model of user-supplied token usage. In agent environments, ambient credentials can be unexpectedly present, allowing the skill to authenticate as the user or operator without an explicit handoff in the current session.
This test explicitly validates that the CLI will read an ALAPI token from the ALAPI_TOKEN environment variable when the user does not provide one. That behavior conflicts with the skill description, which says the agent should only call ALAPI when the user explicitly provides a token and confirms the action. In an agent context, silently sourcing credentials from the environment can cause unintended use of secrets and external requests without the user's informed consent.
This test enforces both environment-token ingestion and precedence rules for an explicit token, confirming the tool is designed to handle credentials from multiple sources beyond what the manifest describes. Even though explicit override is normal CLI behavior, the underlying capability to automatically consume ambient secrets broadens the attack surface in an agent setting where hidden environment credentials may exist. The skill context makes this more dangerous because it is meant to call a third-party API, so unauthorized or unintended authenticated requests are plausible.
Earlier instructions require 2–3 rounds of keyword fallback before concluding that no matching API exists (L059-L065, L120), but L206 says to directly state there is no match when search results are empty. This is an active contradiction in the skill's own documentation about how the agent should behave.
The manifest presents the skill name and description in Chinese, but the default prompt instruction is fixed in English. This can amount to a language-policy issue because the skill appears to assume or force English behavior without explicit user opt-in or a documented language choice.
Unlike the Python and PHP templates, the JavaScript/TypeScript example exposes a generic callAlapi helper but provides no method parameter or POST handling, even though the surrounding document presents these templates as general ALAPI integration code. This creates an intent mismatch within the multi-language template set by implying equivalent request capability while omitting it here.
This code sends the API token and all provided request parameters to a remote service via HTTP requests, including appending them to the URL for GET requests. Although network access is central to the tool's purpose, the file does not clearly warn users that secrets and parameters will be transmitted to an external API, which is relevant because tokens may be provided directly on the command line or via environment variable.