T09 · Insecure Skill Coding Practices
- Location
audio_to_text.py:92- Finding
Baidu API credentials may be exposed through command-line arguments and OAuth query parameters
- Content
View full analysis
Vulnerability Details
File Location:
audio_to_text.py:92-100,audio_to_text.py:426-427,SKILL.md:31-32,README.md:58-59
Vulnerability Type: Sensitive credential exposure
Risk Level: MediumComplete Code Snippets
audio_to_text.py:92-100:python url = "https://aip.baidubce.com/oauth/2.0/token" params = { "grant_type": "client_credentials", "client_id": self.api_key, "client_secret": self.secret_key } try: response = requests.get(url, params=params)audio_to_text.py:426-427:python parser.add_argument('--api-key', help='Baidu API Key', default=os.getenv('BAIDU_API_KEY')) parser.add_argument('--secret-key', help='Baidu Secret Key', default=os.getenv('BAIDU_SECRET_KEY'))The documentation recommends passing credentials directly on the command line:
bash python audio_to_text.py \ --api-key YOUR_API_KEY \ --secret-key YOUR_SECRET_KEYTechnical Analysis
The Skill legitimately requires Baidu API credentials to obtain an access token. However, accepting and recommending secrets as command-line arguments exposes them to shell history and, depending on the operating system and process isolation settings, process inspection tools.
The token request also sends
client_secretthrough the query parameters of an HTTP GET request. HTTPS protects the request in transit from passive network observers, but the complete URL can still be recorded by local debugging infrastructure, HTTP proxies, application-performance monitoring systems, or server-side access logs. Query strings are generally more likely to be retained than request bodies.This behavior does not grant the Skill broader system privileges, and transmitting credentials to Baidu is necessary for the declared speech-recognition function. Nevertheless, the selected credential-handling mechanisms exceed the minimum exposure necessary to authenticate.
Attack Path
- A u ...[truncated 1312 chars]
- Remediation
View remediation
Remediation Suggestions
- Stop recommending command-line arguments for secrets. Prefer environment variables, operating-system credential stores, or a dedicated secret manager.
- If configuration files remain supported, require restrictive filesystem permissions and clearly warn users not to commit credential-bearing files.
- If supported by Baidu's OAuth endpoint, send the token request as an HTTPS POST with credentials in a form-encoded request body rather than a GET query string.
- Ensure HTTP clients, proxies, exception handlers, and telemetry systems redact
client_id,client_secret, access tokens, and credential-bearing URLs. - Consider deprecating
--secret-key, or support a secure interactive prompt that does not echo or persist the supplied secret. - Rotate any credential that may already have appeared in command histories or logs.
- Add explicit network timeouts to the token and recognition requests to prevent indefinite blocking while hardening the request code.
