T09 · Insecure Skill Coding Practices
- Location
web_search.py:22- Finding
Hard-Coded Serper API Credential
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This web search skill does what it claims, but it ships with a hardcoded Serper API key and asks users to edit source code for secrets.
Review before installing. The core behavior is ordinary web search, but do not use the packaged API key and do not place your own key directly in web_search.py. The publisher should remove and rotate the exposed key, load credentials from an environment variable or secret store, and clearly disclose that search queries are sent to Serper.
web_search.py:22Hard-Coded Serper API Credential
The documented behavior omits two security-relevant facts: users' search queries are sent to a third-party service, and the setup encourages embedding the API key directly in source code. This creates both data exfiltration risk for user inputs and credential leakage risk if the file is shared, logged, or committed to version control.
The code not only hardcodes an API credential but also uses it transparently without any user-facing disclosure, so operators or downstream users may unknowingly run a skill backed by someone else's embedded account. This creates secret misuse risk, hides external dependency and billing behavior, and makes credential abuse easier if the code is redistributed.
The skill advertises network-capable behavior but does not declare any tool scope, permissions, or allowed tools in its manifest. This weakens review and policy enforcement because the runtime may permit outbound access without explicit user-facing disclosure or least-privilege constraints.
The skill description does not warn that user queries will be sent to a third-party search API, which undermines informed consent and can expose sensitive prompts, names, internal terms, or other private data to an external provider. In a search skill, this context makes the omission materially relevant because exfiltration of the core user input is the main operation.
The skill suggests activation via generic phrases like "搜索今天的新闻" and "搜索北京天气" without defining explicit trigger boundaries, exclusions, or context constraints. These common utterances could overlap with ordinary conversation and cause unintended invocation in systems that rely on natural-language matching.
A live Serper API key is hardcoded directly in the source, which exposes a reusable secret to anyone who can view the file, logs, repository history, or packaged skill artifact. Even though this is a web-search skill, embedding credentials in code enables unauthorized third parties to consume the account, incur charges, exhaust quota, and potentially access usage metadata tied to the owner.
The search query is sent to the external endpoint https://google.serper.dev/search, but the code provides no explicit notice, consent prompt, or privacy disclosure before transmitting potentially sensitive user input. In a search skill, external transmission is expected, which lowers suspicion, but lack of disclosure can still expose private queries, internal terms, or personal data to a third-party service.
The description and all user-facing usage examples are presented only in Chinese, including the instruction "对 OpenClaw 说" followed by Chinese trigger phrases. This can amount to a language-policy issue if the organization expects language choice or explicit justification for locale restriction, and no such opt-in or constraint is documented here.