T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/create_launcher.py:22
- Finding
- Hard-Coded FAL API Credential Exposed in Source Code<![CDATA[ ## Vulnerability Details **File Location**: `scripts/create_launcher.py:22-29` **Vulnerability Type**: Hard-coded secret **Risk Level**: High ### Vulnerable Code ```python # Optional: FAL AI for icon generation try: import fal_client FAL_AVAILABLE = True # Set FAL API key if not already set if not os.environ.get("FAL_KEY"): os.environ["FAL_KEY"] = "[REDACTED: hard-coded FAL API credential]" except ImportError: FAL_AVAILABLE = False ``` The original source contains the complete reusable FAL API credential at the redacted location. ### Technical Analysis The script embeds a plaintext FAL API credential and automatically assigns it to the `FAL_KEY` environment variable whenever the user has not configured another key. Anyone able to download or inspect the Skill can extract and reuse this credential independently of the launcher. Environment variables do not protect a secret that is already present in distributed source code. Source archives, repository clones, backups, logs, and installed copies may retain the credential even if it is subsequently removed from the latest version. The credential is used by `generate_icon_with_fal()` when the `--auto-icon` option is enabled: ```python result = fal_client.subscribe( "fal-ai/flux/schnell", arguments={ "prompt": prompt, "image_size": "square", "num_images": 1, }, ) ``` ### Attack Path 1. An attacker obtains the publicly distributed Skill or otherwise reads `scripts/create_launcher.py`. 2. The attacker extracts the hard-coded `FAL_KEY` value. 3. The attacker configures the credential in their own process or directly uses it with the FAL API. 4. API requests are charged to or counted against the credential owner's account until the key is revoked or restricted. No execution of the Skill is required to exploit the exposure. ### Impact Assessment An attacker may obtain unauthorized access to the FAL API capabilities permitted by the ex ...[truncated 489 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed FAL credential immediately. Removing it from the current file is insufficient because historical copies may remain accessible. 2. Remove all default credential assignment from the source: ```python fal_key = os.environ.get("FAL_KEY") if not fal_key: raise RuntimeError( "FAL_KEY is required for --auto-icon. " "Configure it through the environment or a secret manager." ) ``` 3. Obtain credentials from a protected environment variable, macOS Keychain, or an approved secret-management service. 4. Ensure credentials are excluded from repositories, packaged artifacts, examples, tests, and logs. 5. Review API usage and billing records for unauthorized activity. 6. Apply provider-side restrictions where available, including minimum required scopes, usage limits, expiration, and account alerts. 7. Add automated secret scanning to source-control and release pipelines. ]]>
