T09 · Insecure Skill Coding Practices
- Location
company-brief.mjs:111- Finding
Configurable API Endpoint Can Expose the OpenMerch API Key
- Content
View full analysis
Vulnerability Details
File Location:
company-brief.mjs:111-116, 190-193
Vulnerability Type: Unrestricted credential-bearing network destination
Risk Level: MediumThe script permits
OPENMERCH_BASE_URLto specify an arbitrary endpoint and sends the OpenMerch API key to that endpoint in every request.js async function call(method, path, body) { const headers = { "X-OpenMerch-Key": apiKey }; if (body !== undefined) headers["Content-Type"] = "application/json"; const res = await fetchFn(`${baseUrl}${path}`, { method, headers, body: body !== undefined ? JSON.stringify(body) : undefined, }); }js const baseUrl = (process.env.OPENMERCH_BASE_URL || "https://api.openmerch.dev").replace( /\/+$/, "", );Technical Analysis
OPENMERCH_BASE_URLis used without validating its scheme, hostname, port, or URL components. The request helper unconditionally attachesX-OpenMerch-Keyto requests constructed from this value.As a result, an attacker who can influence this non-secret environment variable can redirect authenticated requests to a server under their control. The implementation also accepts plaintext HTTP URLs, which could expose the credential and queried company domain to network interception.
A configurable endpoint can be useful for staging and testing, but unrestricted transmission of a production credential exceeds the minimum privileges required for the Skill's normal operation. The documented production functionality only requires authenticated access to the official OpenMerch API.
Attack Path
- An attacker gains the ability to alter the execution environment or deployment configuration.
- The attacker sets
OPENMERCH_BASE_URLto an attacker-controlled HTTP or HTTPS URL. - A user or Agent invokes the Skill for a company-domain lookup.
- The script sends the
X-OpenMerch-Keyheader and requested company domain to the attack ...[truncated 999 chars]
- Remediation
View remediation
Remediation Suggestions
- Parse the configured endpoint with
new URL()and reject malformed URLs. - Require the
https:scheme for all credential-bearing production requests. - Allowlist
api.openmerch.devfor production use rather than accepting arbitrary hosts. - If staging support is required, provide an explicit development-mode opt-in and use a narrow allowlist of approved staging hosts.
- Reject URLs containing user information, fragments, unexpected ports, or other unnecessary components.
- Use separate, restricted non-production credentials for staging and testing.
- Ensure redirects cannot forward the credential to an untrusted origin. Disable redirects or manually validate every redirect destination before resending authenticated requests.
- Add tests confirming that invalid schemes and unapproved hosts are rejected before any network request is made.
- Add tests confirming that credentials are never sent across origins during redirects.
- Update
SKILL.mdto clearly state the endpoint restrictions and safe staging procedure.
- Parse the configured endpoint with
