T09 · Insecure Skill Coding Practices
- Location
scripts/bls_query.py:330- Finding
Secret Key Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/bls_query.py:88-90, 330-331
Vulnerability Type: Command-line credential exposure
Risk Level: MediumVulnerable Code
python ak = getattr(args, "ak", None) sk = getattr(args, "sk", None) # 1. Command line args if ak and sk: return ak, skpython parser.add_argument("--ak", help="Access Key ID (also configurable through BCE_BLS_ACCESS_KEY)") parser.add_argument("--sk", help="Secret Access Key (also configurable through BCE_BLS_SECRET_KEY)")The corresponding usage is documented in
SKILL.md:18-21:text 1. Command-line arguments --ak / --sk 2. Environment variables BCE_BLS_ACCESS_KEY / BCE_BLS_SECRET_KEY 3. Configuration file ~/.bce_bls/credentialsTechnical Analysis
The CLI accepts the BCE secret access key through the
--skcommand-line option and gives command-line credentials the highest resolution priority. Secrets supplied this way may be exposed through:- Shell history files.
- Process listings such as
/proc/<pid>/cmdlineor process-monitoring tools. - Terminal session recording.
- CI/CD logs or command tracing.
- Endpoint monitoring and telemetry that records process arguments.
Authenticated BLS access legitimately requires credentials, so reading a dedicated credential file or environment variable is within the Skill's declared scope. Exposing the secret through process arguments, however, is not required for that functionality and increases local credential exposure.
The secret key is otherwise used locally to generate an HMAC signature. The reviewed network code does not directly transmit the secret key and restricts requests to hard-coded Baidu BLS endpoints over HTTPS.
Attack Path
- A user follows the documented usage and runs the Skill with
--akand--sk. - The complete command, including the secret key, is retained in shell history, automation logs, process telemetry, or a live process argument list.
- A local user, monitoring ag ...[truncated 1098 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the
--skcommand-line option and stop documenting command-line secret-key usage. - Prefer a securely permissioned credential file, operating-system keyring, or interactive hidden prompt using
getpass.getpass(). - If environment variables remain supported, document that they may be exposed by CI diagnostics, crash reports, or process-environment inspection and should be scoped to the child process where possible.
- Verify credential-file security before reading it:
- Reject files not owned by the current user.
- Reject group- or world-readable files.
- Recommend mode
0600and a private parent directory.
- Use a short-lived, least-privilege IAM credential restricted to the required BLS read/query actions and resources.
- Avoid printing credentials or Authorization headers in errors and debug logs.
- Rotate credentials that have previously been passed through command-line arguments and remove exposed values from shell history and automation logs.
- Remove the
