T09 · Insecure Skill Coding Practices
- Location
scripts/youtube_client.py:50- Finding
Bearer API Key May Be Disclosed Through Cross-Origin HTTP Redirects
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a coherent YouTube search API wrapper, but it needs Review because its client can expose the AIsa API key if authenticated requests follow redirects outside the intended API domain.
Review before installing if the AIsa API key has billing or broad account authority. Use a limited-scope or low-credit key, avoid sensitive search terms, and prefer a version that rejects cross-origin redirects or strips Authorization on redirect.
scripts/youtube_client.py:50Bearer API Key May Be Disclosed Through Cross-Origin HTTP Redirects
The skill requires environment access for AISA_API_KEY and performs outbound network requests, but it does not declare an explicit tool scope such as permissions or allowed-tools. That omission weakens reviewability and runtime containment, making it easier for an agent platform to grant broader capabilities than intended or for users to miss that secrets will be sent to a third-party API.
This example sends an authorization bearer token and user-supplied search content to api.aisa.one, which is an external service. In context this is the skill's intended function, but it still represents a real data egress path where secrets and potentially sensitive queries leave the local agent environment.
# Search for videos
curl "https://api.aisa.one/apis/v1/youtube/search?engine=youtube&q=AI+agents+tutorial" \
-H "Authorization: Bearer $AISA_API_KEY"
This request transmits the bearer token plus search parameters to an external endpoint. Although expected for a YouTube search integration, the pattern is still security-relevant because any sensitive search terms, tenant data, or credentials provided by the agent are exposed to a third-party service boundary.
# Search in specific country (US)
curl "https://api.aisa.one/apis/v1/youtube/search?engine=youtube&q=machine+learning&gl=us" \
-H "Authorization: Bearer $AISA_API_KEY"
# Search in Japan
This example again causes external transmission of both authentication material and query content to api.aisa.one. The country and language parameters are low risk by themselves, but the overall request remains a data egress channel and should be treated as such.
-H "Authorization: Bearer $AISA_API_KEY"
curl "https://api.aisa.one/apis/v1/youtube/search?engine=youtube&q=AI&gl=jp&hl=ja"
-H "Authorization: Bearer $AISA_API_KEY"
This curl example performs outbound transmission to a third-party API using a bearer token from the environment. The skill context makes this expected rather than covert, but it remains a genuine security concern because it enables exfiltration of query content and misuse of the token if handling is lax.
# Search with interface language
curl "https://api.aisa.one/apis/v1/youtube/search?engine=youtube&q=python+tutorial&hl=en" \
-H "Authorization: Bearer $AISA_API_KEY"
# Chinese interface
The skill sends requests containing a bearer credential and user query to api.aisa.one, creating an external data flow. While aligned with the product purpose, this still increases exposure of user inputs and introduces dependency on the third party's handling of authentication and request data.
-H "Authorization: Bearer $AISA_API_KEY"
curl "https://api.aisa.one/apis/v1/youtube/search?engine=youtube&q=编程教程&hl=zh-CN&gl=cn"
-H "Authorization: Bearer $AISA_API_KEY"
The sp filter token request is another external transmission path that includes bearer authentication and potentially user-controlled parameters. If the parameter is sourced dynamically, it may broaden what data is sent externally and complicate monitoring, even though the request itself is part of normal functionality.
# Use sp parameter for pagination or advanced filters
curl "https://api.aisa.one/apis/v1/youtube/search?engine=youtube&q=AI&sp=<filter_token>" \
-H "Authorization: Bearer $AISA_API_KEY"
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
class YouTubeClient:
"""OpenClaw YouTube - YouTube SERP Scout API Client."""
BASE_URL = "https://api.aisa.one/apis/v1"
def __init__(self, api_key: Optional[str] = None):
"""Initialize the client with an API key."""
This code sends the user's query, country, language, and optional filter parameters to the remote AIsa API via urllib without any runtime notice beyond internal docstrings. For a code file, outbound transmission of user data should have some visible disclosure unless it is clearly surfaced to the user; here the CLI help describes search behavior but does not explicitly warn that inputs are sent to a third-party service.
No suspicious patterns detected.