T09 · Insecure Skill Coding Practices
- Location
scripts/github_fetch.py:118- Finding
GitHub Access Token Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/github_fetch.py, lines 118–123 and 128–130
Vulnerability Type: Command-line secret exposure
Risk Level: MediumVulnerable Code
python parser.add_argument( "--token", dest="token_value", default=None, help="Direct token value (use sparingly — prefer --token-env)", )python # Resolve token if args.token_value: token = args.token_value else: token = os.environ.get(args.token_env)Technical Analysis
The script allows a GitHub access token to be supplied directly through the
--tokencommand-line argument. Command-line arguments are not an appropriate secret transport mechanism because plaintext arguments may be exposed through:- Shell command history
- Process inspection utilities and process metadata
- Endpoint monitoring or audit systems
- CI/CD job logs and diagnostic output
- Wrapper scripts or automation logs that record commands
The environment-variable mechanism already provided by the script is sufficient for its declared functionality. Therefore, accepting the token through the command line exceeds the minimum secret-handling interface necessary for the GitHub Issues integration.
The token is not hardcoded, printed by the script, or sent to an unrelated service. Elsewhere, it is used as a bearer token for the fixed HTTPS GitHub API origin. The exposure requires another local user, monitoring service, or logging system to obtain the command line or history.
Attack Path
-
A user or automated process invokes the integration with a plaintext token, for example:
bash python scripts/github_fetch.py \ --owner my-org \ --repo my-project \ --token github_pat_example -
The complete command is retained in shell history, process metadata, a CI log, or an endpoint-monitoring record.
-
An attacker or unauthorized operator with access to t ...[truncated 852 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove the
--tokenargument and accept credentials only through an environment variable or secure credential provider:python token = os.environ.get(args.token_env) if not token: print( f"Error: required credential environment variable " f"{args.token_env!r} is not set.", file=sys.stderr, ) sys.exit(1) -
In automation, inject the token through the platform's protected secret store rather than including it in a command, configuration file, or loggable parameter.
-
Require a fine-grained GitHub token restricted to the necessary repositories and read-only Issues/metadata permissions.
-
Document token rotation and immediate revocation procedures for credentials that may have been supplied through
--token. -
Ensure errors, subprocess wrappers, and diagnostic systems never print or serialize credential values.
-
Where available, prefer short-lived GitHub App installation tokens over long-lived personal access tokens.
-
Update
SKILL.mdand command examples to state explicitly that plaintext command-line credentials are unsupported.
-
