T09 · Insecure Skill Coding Practices
- Location
scripts/lobster_submit.py:82- Finding
API Key and Local Metadata Can Be Sent to an Arbitrary Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
scripts/lobster_submit.py:82-88,scripts/lobster_submit.py:251-260,scripts/lobster_submit.py:350,scripts/lobster_submit.py:446
Vulnerability Type: Unvalidated network destination for authenticated requests
Risk Level: MediumComplete Vulnerable Code
python def resolve_api_url(cli_url: Optional[str]) -> str: if cli_url: return cli_url.rstrip("/") env = os.environ.get("LOBSTER_API_URL") if env: return env.rstrip("/") return DEFAULT_API_URLpython def post_json(url: str, payload: dict, api_key: str) -> dict: body = json.dumps(payload).encode("utf-8") req = urllib.request.Request( url, data=body, headers={ "Content-Type": "application/json", "X-Api-Key": api_key, }, method="POST", )python api_url = resolve_api_url(args.api_url)python result = post_json(f"{api_url}/score/evaluate", payload, api_key)The same endpoint resolution is also used by the confirmation workflow:
python result = post_confirm(f"{api_url}/score/confirm", args.confirm, api_key)Technical Analysis
The
--api-urlargument andLOBSTER_API_URLenvironment variable can replace the intended API endpoint with any URL. The value is only normalized by removing trailing slashes; the code does not:- Require HTTPS.
- Restrict the hostname to
lobster-rank.wondercv.com. - Reject embedded credentials, unexpected ports, or malformed destinations.
- Prevent authentication data from being sent to an untrusted endpoint.
- Explicitly constrain or revalidate redirect destinations.
After resolving the endpoint,
post_jsonunconditionally places the Lobster API key in theX-Api-Keyheader. During evaluation, the request also contains the locally collected Skill inventory, descriptions, file counts, str ...[truncated 2300 chars]- Remediation
View remediation
Remediation Suggestions
-
Use a fixed production endpoint
- Remove
--api-urlandLOBSTER_API_URLfrom production distributions. - Send authenticated requests only to the declared production API.
- Remove
-
Allowlist trusted destinations if overrides are necessary
- Parse the URL with
urllib.parse.urlsplit. - Require the
httpsscheme. - Require the exact hostname
lobster-rank.wondercv.com. - Allow only the expected port.
- Reject user information, fragments, malformed hosts, and unexpected path prefixes.
- Parse the URL with
-
Protect authentication across redirects
- Disable automatic redirects for authenticated requests, or revalidate every redirect destination.
- Never forward
X-Api-Keyto a destination with a different origin. - Reject HTTPS-to-HTTP redirect downgrades.
-
Separate development behavior
- If custom endpoints are needed for testing, require an explicit development-only switch.
- Do not load endpoint overrides implicitly from the environment in normal operation.
- Use separate, non-production credentials for development endpoints.
-
Improve destination transparency
- Display the validated hostname before transmitting data.
- Require explicit user confirmation whenever a non-production development endpoint is selected.
- Include the effective destination in dry-run output without exposing the API key.
-
Reduce credential exposure
- Prefer a permission-restricted credential store or environment variable over the documented
--api-keyargument. - Warn that command-line secrets may be exposed through shell history and local process inspection.
- Support revocation and rotation of potentially disclosed API keys.
- Prefer a permission-restricted credential store or environment variable over the documented
-
