T09 · Insecure Skill Coding Practices
- Location
scripts/scout.py:250- Finding
GitHub API Token Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/scout.py, lines 250 and 255
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: MediumVulnerable Code
python parser.add_argument("--token", help="GitHub API Token (or set GITHUB_TOKEN)")python scout = GitHubScout(token=args.token)Technical Analysis
The application permits a GitHub API token to be supplied as a command-line argument. Command-line secrets can be exposed through shell history, process inspection facilities, endpoint monitoring products, diagnostic collections, job definitions, and command logging.
The token is subsequently placed in an HTTP
Authorizationheader and sent only to the fixed official GitHub API endpoint,https://api.github.com. That authenticated network behavior is necessary for the declared GitHub search functionality and is not evidence of unauthorized exfiltration. The weakness is specifically the unnecessary command-line secret input channel.Attack Path
- A user launches the script with a command such as
python3 scripts/scout.py --token TOKEN_VALUE --search transformer. - The complete command may be retained in shell history or captured by process-monitoring and logging systems.
- A local user, administrator, monitoring-system operator, or party with access to collected logs retrieves the token.
- The party reuses the token against GitHub's API.
- Available actions depend on the scopes and repository access granted to that token.
Impact Assessment
Successful exploitation discloses the GitHub API token. An attacker may exercise all GitHub permissions associated with it, potentially including access to private repository metadata or modification of GitHub resources if the user supplied an excessively privileged token.
This issue does not itself escalate beyond the token's existing permissions. Exploitation generally requires local process visibility, shell-history access, or acces ...[truncated 135 chars]
- A user launches the script with a command such as
- Remediation
View remediation
Remediation Suggestions
- Remove the
--tokencommand-line option. - Read the token from
GITHUB_TOKENor a protected credential provider. - If interactive entry is required, use
getpass.getpass()so the token is not echoed. - For configuration-file support, require restrictive file permissions and avoid committing the file.
- Recommend short-lived, fine-grained GitHub tokens with only the permissions required for repository search and public organization enrichment.
- Ensure exceptions, HTTP diagnostics, telemetry, and logs never include authorization headers or token values.
- Document token rotation and revocation procedures in case accidental command-line exposure has already occurred.
- Remove the
