T09 · Insecure Skill Coding Practices
- Location
scripts/run.py:111- Finding
API credential exposed through command-line arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/run.py:111-115(credential use also occurs atscripts/run.py:39-43; insecure invocation is documented atSKILL.md:29-31)
Vulnerability Type: Exposure of a secret through process arguments
Risk Level: MediumEvidence
scripts/run.py:39-43:python def call_llm(system: str, user: str, appkey: str) -> str: payload = {"model": MODEL, "temperature": 0.0, "messages": [ {"role": "system", "content": system}, {"role": "user", "content": user}, ]} body = _http_post(API_URL, payload, {"Authorization": f"Bearer {appkey}"})scripts/run.py:111-115:python parser.add_argument( "--appkey", required=True, help="内部医疗大模型鉴权 key。", )SKILL.md:29-31:bash python3 scripts/run.py --input input.json --output output.json --appkey YOUR_KEYTechnical Analysis
The application requires the API credential to be passed in the
--appkeycommand-line argument. Command-line arguments are not an appropriate secret transport mechanism because they can be exposed through shell history, process inspection facilities, job-runner logs, audit records, crash diagnostics, monitoring systems, or command transcription.The supplied value is subsequently used as a bearer credential in the HTTP
Authorizationheader. Therefore, disclosure of the command-line value directly discloses a reusable authentication secret rather than a non-sensitive identifier.HTTPS protects the credential while it is transmitted to the configured API endpoint, but it does not mitigate exposure that occurs locally before the request is sent.
Attack Path
- A user follows the documented command and supplies a valid API key through
--appkey. - The complete command is retained in shell history, recorded by an automation platform, or temporarily exposed through operating-system process inspecti ...[truncated 1074 chars]
- A user follows the documented command and supplies a valid API key through
- Remediation
View remediation
Remediation Suggestions
- Remove the required secret-bearing
--appkeyargument. - Read the credential from a protected environment variable or a dedicated secret manager. Avoid printing the value or including it in exception messages.
- For interactive use, optionally support a non-echoing prompt through
getpass.getpass()when no managed secret is available. - Update
SKILL.mdso its examples do not place a real credential in the command line. - Configure short-lived, narrowly scoped credentials and provider-side quota restrictions.
- Document credential rotation and immediately revoke keys suspected of having appeared in shell history or logs.
- If backward compatibility requires retaining
--appkey, clearly mark it as deprecated and emit a warning without including the supplied value.
- Remove the required secret-bearing
