T09 · Insecure Skill Coding Practices
- Location
scripts/bing_maps.py:496- Finding
API Token Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/bing_maps.py, lines 496 and 558
Vulnerability Type: Credential exposure through process arguments and shell history
Risk Level: MediumVulnerable Code
python def resolve_token(args: argparse.Namespace) -> str: token = args.token or os.getenv("DATAIFY_API_TOKEN")python parser.add_argument("--token", help="API token for this run. Bearer prefix is added when missing.")Technical Analysis
The script permits a Dataify API token to be supplied through the
--tokencommand-line option. Command-line arguments are not an appropriate secret transport mechanism because they may be:- Retained in shell history.
- Visible to other local users through process inspection utilities.
- Captured by process-monitoring, diagnostic, telemetry, or audit systems.
- Recorded in terminal logs, automation output, or support bundles.
This option exceeds the minimum authentication mechanism necessary for the Skill because the script already supports reading
DATAIFY_API_TOKENfrom the environment. The token is not transmitted to an unexpected destination; it is used as the authorization credential for the documented Dataify endpoint. The vulnerability concerns local credential exposure before or during execution.Attack Path
- A user runs the script with a command such as
python3 scripts/bing_maps.py --token SECRET .... - The token becomes part of the process argument list and may also be written to shell history.
- Another local user, monitoring process, log collector, or diagnostics tool reads the exposed argument or history entry.
- The recovered token is reused to authenticate to the Dataify API.
- The attacker performs API requests under the victim's account and consumes available credits or accesses capabilities granted to that token.
Impact Assessment
Successful exploitation exposes the Dataify API token. An attacker ...[truncated 363 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the
--tokencommand-line option from the argument parser. - Read the token exclusively from
DATAIFY_API_TOKENor an operating-system credential store. - If interactive entry is necessary, use a non-echoing prompt such as Python's
getpass.getpass()rather than command-line arguments. - Do not print the token, include it in errors, or place it in generated command examples.
- Avoid unnecessarily rewriting the prefixed token into
os.environ; keep it in a local variable for the lifetime of the request. - Document session-scoped environment setup and recommend rotating any token previously supplied through
--token.
- Remove the
