T09 · Insecure Skill Coding Practices
- Location
references/real-e2e-templates.md:160- Finding
Authorization Tokens May Be Sent to an Unvalidated Configuration-Controlled Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
references/real-e2e-templates.md:160-177
Vulnerability Type: Credential disclosure through an unvalidated network destination
Risk Level: MediumVulnerable Code
text # Setup (once per test suite) setup_suite(): load environment config get base_url from config or service discovery get auth_token (if needed): - real login: POST /auth/login with test credentials - or API key from environment variable store auth_token for reuseThe token is subsequently attached to requests:
text create_response = POST base_url + "/api/resource" headers: { Authorization: auth_token, Content-Type: "application/json" } body: { name: "test-item", value: 42 }Technical Analysis
The E2E template obtains
base_urlfrom configuration or service discovery while allowing the authorization token to come from an environment variable. It does not require validation that the destination is a loopback address, an approved test host, or an authenticated HTTPS endpoint before attaching the token.Projects being tested may control configuration files consumed by the generated tests. A malicious or compromised project can therefore provide an attacker-controlled
base_url. If the user has a test API key or bearer token in the environment, the generated request can disclose that credential to the configured host.The Skill states that only test credentials should be used. This reduces the likely impact but does not prevent unauthorized disclosure or subsequent misuse of those test credentials.
Attack Path
- An attacker adds or modifies project configuration so that
base_urlresolves to an attacker-controlled server. - A user invokes the Skill with a test API key or bearer token available through an environment variable.
- The Skill generates or runs an E2E test using the project-controlled URL.
- The test attaches the environment-sourced token to the `Authorization ...[truncated 677 chars]
- An attacker adds or modifies project configuration so that
- Remediation
View remediation
Remediation Suggestions
- Resolve and display the effective destination before making any authenticated request.
- Allow authenticated requests to loopback addresses by default and require explicit user approval for every non-loopback host.
- Enforce a configurable allowlist of approved test and staging domains.
- Require HTTPS with valid certificate verification for remote destinations.
- Reject URLs containing embedded credentials, unexpected schemes, or ambiguous host representations.
- Disable automatic redirects for authenticated requests, or strip authorization headers whenever the destination origin changes.
- Use short-lived, narrowly scoped tokens created specifically for the current test run.
- Redact authorization headers, cookies, API keys, and login responses from logs and generated reports.
- Abort rather than sending credentials when the destination cannot be conclusively classified as an approved test environment.
